From c33940f64a1e5b59afd700010247382f5b7b2df3 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Mon, 12 Nov 2018 14:41:23 +0100 Subject: Moved permission checks to Authenticator class --- includes/view/User_view.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'includes/view/User_view.php') diff --git a/includes/view/User_view.php b/includes/view/User_view.php index 2b4154b4..275a31ca 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -352,8 +352,6 @@ function User_view_shiftentries($needed_angel_type) */ function User_view_myshift($shift, $user_source, $its_me) { - global $privileges; - $shift_info = '' . $shift['name'] . ''; if ($shift['title']) { $shift_info .= '
' . $shift['title'] . ''; @@ -382,7 +380,7 @@ function User_view_myshift($shift, $user_source, $its_me) $myshift['duration'] = '

' . round(-($shift['end'] - $shift['start']) / 3600 * 2, 2) . ' h' . '

'; - if (in_array('user_shifts_admin', $privileges)) { + if (auth()->can('user_shifts_admin')) { $myshift['comment'] .= '
' . '

' . __('Freeloaded') . ': ' . $shift['freeload_comment'] . '

'; } else { @@ -393,7 +391,7 @@ function User_view_myshift($shift, $user_source, $its_me) $myshift['actions'] = [ button(shift_link($shift), glyph('eye-open') . __('view'), 'btn-xs') ]; - if ($its_me || in_array('user_shifts_admin', $privileges)) { + if ($its_me || auth()->can('user_shifts_admin')) { $myshift['actions'][] = button( page_link_to('user_myshifts', ['edit' => $shift['id'], 'id' => $user_source->id]), glyph('edit') . __('edit'), -- cgit v1.2.3