diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-11-12 14:41:23 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2018-12-02 12:53:31 +0100 |
commit | c33940f64a1e5b59afd700010247382f5b7b2df3 (patch) | |
tree | 453b8810c90cd78e75a1425a4f4f002e585d121a /includes/model | |
parent | 951828a4f1175f99666a48629ea125640cc7c598 (diff) |
Moved permission checks to Authenticator class
Diffstat (limited to 'includes/model')
-rw-r--r-- | includes/model/Shifts_model.php | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index d6fbe3b6..4be65dda 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -422,17 +422,16 @@ function Shift_signup_allowed_admin($needed_angeltype, $shift_entries) */ function Shift_signout_allowed($shift, $angeltype, $signout_user_id) { - global $privileges; $user = auth()->user(); // user shifts admin can sign out any user at any time - if (in_array('user_shifts_admin', $privileges)) { + if (auth()->can('user_shifts_admin')) { return true; } // angeltype supporter can sign out any user at any time from their supported angeltype if ( - in_array('shiftentry_edit_angeltype_supporter', $privileges) + auth()->can('shiftentry_edit_angeltype_supporter') && User_is_AngelType_supporter($user, $angeltype) ) { return true; @@ -466,14 +465,12 @@ function Shift_signup_allowed( $needed_angeltype, $shift_entries ) { - global $privileges; - - if (in_array('user_shifts_admin', $privileges)) { + if (auth()->can('user_shifts_admin')) { return Shift_signup_allowed_admin($needed_angeltype, $shift_entries); } if ( - in_array('shiftentry_edit_angeltype_supporter', $privileges) + auth()->can('shiftentry_edit_angeltype_supporter') && User_is_AngelType_supporter(auth()->user(), $angeltype) ) { return Shift_signup_allowed_angeltype_supporter($needed_angeltype, $shift_entries); |