Skip to content
Snippets Groups Projects
Commit 373b28b6 authored by André Noack's avatar André Noack
Browse files

Resolve #5008 "PHPLib - Öffentliche Belegungspläne gehen nicht"

Closes #5008

Merge request studip/studip!3799
parent 1b7714d2
No related branches found
No related tags found
No related merge requests found
......@@ -22,11 +22,13 @@
*/
class Resources_RoomPlanningController extends AuthenticatedController
{
protected $allow_nobody = true;
public function before_filter(&$action, &$args)
{
$anonymous_actions = ['booking_plan', 'anonymous_booking_plan_data'];
if (in_array($action, $anonymous_actions)) {
$this->allow_nobody = true;
if (!in_array($action, $anonymous_actions) && $GLOBALS['user']->id === 'nobody') {
throw new AccessDeniedException();
}
parent::before_filter($action, $args);
}
......
......@@ -26,14 +26,12 @@
*/
class RoomManagement_OverviewController extends AuthenticatedController
{
protected $allow_nobody = true;
public function before_filter(&$action, &$args)
{
if ($action === 'public_booking_plans') {
if (Config::get()->RESOURCES_SHOW_PUBLIC_ROOM_PLANS) {
$this->allow_nobody = true;
} else {
throw new AccessDeniedException();
}
if ($action !== 'public_booking_plans' && $GLOBALS['user']->id === 'nobody') {
throw new AccessDeniedException();
}
parent::before_filter($action, $args);
......@@ -434,6 +432,9 @@ class RoomManagement_OverviewController extends AuthenticatedController
*/
public function public_booking_plans_action()
{
if (!Config::get()->RESOURCES_SHOW_PUBLIC_ROOM_PLANS) {
throw new AccessDeniedException();
}
if (Navigation::hasItem('/resources/overview/public_booking_plans')) {
Navigation::activateItem('/resources/overview/public_booking_plans');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment