Skip to content
Snippets Groups Projects
Commit 718e7331 authored by David Siegfried's avatar David Siegfried
Browse files

prevent php-errors on public-booking-plans, refs #1339

Merge request studip/studip!875
parent fd49ac1d
No related branches found
No related tags found
No related merge requests found
......@@ -37,30 +37,33 @@ 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')
);
$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'
);
if ($this->user) {
$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')
);
$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()
......
......@@ -61,18 +61,20 @@
</a>
</td>
<td class="actions">
<?
$perms = [
'show_global_admin_actions' => $show_global_admin_actions,
'show_admin_actions' => $resource->userHasPermission($user, 'admin'),
'show_tutor_actions' => $resource->userHasPermission($user, 'tutor'),
'show_autor_actions' => $resource->userHasPermission($user, 'autor'),
'show_user_actions' => $resource->userHasPermission($user, 'user'),
'user_has_booking_rights' => $resource->userHasBookingRights($user)];
?>
<?= $this->render_partial('resources/_common/_action_menu.php',
compact('resource') + $perms
);?>
<? if ($user) :?>
<?
$perms = [
'show_global_admin_actions' => $show_global_admin_actions,
'show_admin_actions' => $resource->userHasPermission($user, 'admin'),
'show_tutor_actions' => $resource->userHasPermission($user, 'tutor'),
'show_autor_actions' => $resource->userHasPermission($user, 'autor'),
'show_user_actions' => $resource->userHasPermission($user, 'user'),
'user_has_booking_rights' => $resource->userHasBookingRights($user)];
?>
<?= $this->render_partial('resources/_common/_action_menu.php',
compact('resource') + $perms
)?>
<? endif ?>
</td>
</tr>
<? endforeach ?>
......
<?= $this->render_partial(
'resources/_common/_grouped_room_list.php',
['grouped_rooms' => $grouped_rooms]
['grouped_rooms' => $grouped_rooms, 'user' => $user]
) ?>
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