summaryrefslogtreecommitdiff
path: root/includes/sys_menu.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-11-12 14:41:23 +0100
committermsquare <msquare@notrademark.de>2018-12-02 12:53:31 +0100
commitc33940f64a1e5b59afd700010247382f5b7b2df3 (patch)
tree453b8810c90cd78e75a1425a4f4f002e585d121a /includes/sys_menu.php
parent951828a4f1175f99666a48629ea125640cc7c598 (diff)
Moved permission checks to Authenticator class
Diffstat (limited to 'includes/sys_menu.php')
-rw-r--r--includes/sys_menu.php20
1 files changed, 9 insertions, 11 deletions
diff --git a/includes/sys_menu.php b/includes/sys_menu.php
index e4f79766..b4c04a98 100644
--- a/includes/sys_menu.php
+++ b/includes/sys_menu.php
@@ -45,15 +45,15 @@ function header_render_hints()
*/
function make_user_submenu()
{
- global $privileges, $page;
+ global $page;
$user_submenu = make_language_select();
- if (in_array('user_settings', $privileges) || in_array('logout', $privileges)) {
+ if (auth()->can('user_settings') || auth()->can('logout')) {
$user_submenu[] = toolbar_item_divider();
}
- if (in_array('user_settings', $privileges)) {
+ if (auth()->can('user_settings')) {
$user_submenu[] = toolbar_item_link(
page_link_to('user_settings'),
'list-alt',
@@ -62,7 +62,7 @@ function make_user_submenu()
);
}
- if (in_array('logout', $privileges)) {
+ if (auth()->can('logout')) {
$user_submenu[] = toolbar_item_link(
page_link_to('logout'),
'log-out',
@@ -79,7 +79,7 @@ function make_user_submenu()
*/
function make_navigation()
{
- global $page, $privileges;
+ global $page;
$menu = [];
$pages = [
@@ -91,7 +91,7 @@ function make_navigation()
];
foreach ($pages as $menu_page => $title) {
- if (in_array($menu_page, $privileges)) {
+ if (auth()->can($menu_page)) {
$menu[] = toolbar_item_link(page_link_to($menu_page), '', $title, $menu_page == $page);
}
}
@@ -115,7 +115,7 @@ function make_navigation()
];
foreach ($admin_pages as $menu_page => $title) {
- if (in_array($menu_page, $privileges)) {
+ if (auth()->can($menu_page)) {
$admin_menu[] = toolbar_item_link(
page_link_to($menu_page),
'',
@@ -140,16 +140,14 @@ function make_navigation()
*/
function make_room_navigation($menu)
{
- global $privileges;
-
- if (!in_array('view_rooms', $privileges)) {
+ if (!auth()->can('view_rooms')) {
return $menu;
}
// Get a list of all rooms
$rooms = Rooms();
$room_menu = [];
- if (in_array('admin_rooms', $privileges)) {
+ if (auth()->can('admin_rooms')) {
$room_menu[] = toolbar_item_link(page_link_to('admin_rooms'), 'list', __('Manage rooms'));
}
if (count($room_menu) > 0) {