diff options
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.'); } |