diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-10-11 01:26:34 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2018-10-31 13:43:23 +0100 |
commit | 4e09ee3eb255160c88a378375d69123a3e000497 (patch) | |
tree | e4a03ff40c939473cc1278f8286675cfa31e4556 /includes/controller/shifts_controller.php | |
parent | 7c6afc2bfe3263b91ecabf5530da57fe1162ea0b (diff) |
Replaced more user related stuff
(Contains some buggy stuff too...)
Diffstat (limited to 'includes/controller/shifts_controller.php')
-rw-r--r-- | includes/controller/shifts_controller.php | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index b56440e5..07e81957 100644 --- a/includes/controller/shifts_controller.php +++ b/includes/controller/shifts_controller.php @@ -353,20 +353,17 @@ function shift_next_controller() */ function shifts_json_export_controller() { - global $user; $request = request(); if (!$request->has('key') || !preg_match('/^[\da-f]{32}$/', $request->input('key'))) { engelsystem_error('Missing key.'); } - $key = $request->input('key'); - - $user = User_by_api_key($key); - if (empty($user)) { + $user = auth()->apiUser('key'); + if (!$user) { engelsystem_error('Key invalid.'); } - if (!in_array('shifts_json_export', privileges_for_user($user['UID']))) { + if (!in_array('shifts_json_export', privileges_for_user($user->id))) { engelsystem_error('No privilege for shifts_json_export.'); } |