diff options
Diffstat (limited to 'app/controllers/room_management/overview.php')
| -rw-r--r-- | app/controllers/room_management/overview.php | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/app/controllers/room_management/overview.php b/app/controllers/room_management/overview.php index d98ba9f..b4f1d63 100644 --- a/app/controllers/room_management/overview.php +++ b/app/controllers/room_management/overview.php @@ -36,31 +36,19 @@ class RoomManagement_OverviewController extends AuthenticatedController } } parent::before_filter($action, $args); - $this->user = User::findCurrent(); - $this->show_resource_actions = ( - ResourceManager::userHasGlobalPermission($this->user, 'autor') - || - ResourceManager::userHasResourcePermissions($this->user, 'autor') - ); - $this->show_admin_actions = ( - $this->user_is_global_resource_admin - || - ResourceManager::userHasResourcePermissions($this->user) - || - $GLOBALS['perm']->have_perm('root') - ); + if ($action == 'public_booking_plans') { + //Nothing else to be done in that case. + return; + } + + $this->user = User::findCurrent(); $this->user_is_global_resource_user = ResourceManager::userHasGlobalPermission($this->user); $this->user_is_root = $GLOBALS['perm']->have_perm('root'); $this->user_is_global_resource_admin = ResourceManager::userHasGlobalPermission( $this->user, 'admin' ) || $this->user_is_root; - $this->show_global_admin_actions = $this->user_is_global_resource_admin - && ResourceManager::userHasGlobalPermission( - $this->user, - 'admin' - ); } public function index_action() @@ -77,6 +65,20 @@ class RoomManagement_OverviewController extends AuthenticatedController throw new AccessDeniedException(); } + $this->show_resource_actions = ( + ResourceManager::userHasGlobalPermission($this->user, 'autor') + || + ResourceManager::userHasResourcePermissions($this->user, 'autor') + ); + + $this->show_admin_actions = ( + $this->user_is_global_resource_admin + || + ResourceManager::userHasResourcePermissions($this->user) + || + $GLOBALS['perm']->have_perm('root') + ); + if (!$this->show_admin_actions) { $this->redirect($this->url_for('/rooms')); return; @@ -383,6 +385,11 @@ class RoomManagement_OverviewController extends AuthenticatedController } else { $this->rooms = Room::findAll(); } + + $this->show_global_admin_actions = ResourceManager::userHasGlobalPermission( + $this->user, + 'admin' + ); } else { //Get only the locations for which //the user has at least user permissions: @@ -410,6 +417,11 @@ class RoomManagement_OverviewController extends AuthenticatedController ORDER BY sort_position DESC, name ASC, mkdate ASC"; $this->rooms = Room::findBySql($rooms_sql, $rooms_parameter); + + $this->show_global_admin_actions = ResourceManager::userHasGlobalPermission( + $this->user, + 'admin' + ); } if (!$this->rooms) { @@ -467,4 +479,4 @@ class RoomManagement_OverviewController extends AuthenticatedController ); } } -} +}
\ No newline at end of file |
