From 4e09ee3eb255160c88a378375d69123a3e000497 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Thu, 11 Oct 2018 01:26:34 +0200 Subject: Replaced more user related stuff (Contains some buggy stuff too...) --- includes/controller/shifts_controller.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'includes/controller/shifts_controller.php') 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.'); } -- cgit v1.2.3-54-g00ecf