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/pages/user_ical.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'includes/pages/user_ical.php') diff --git a/includes/pages/user_ical.php b/includes/pages/user_ical.php index f7ed64dd..8a80d681 100644 --- a/includes/pages/user_ical.php +++ b/includes/pages/user_ical.php @@ -5,20 +5,17 @@ */ function user_ical() { - 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('ical', privileges_for_user($user['UID']))) { + if (!in_array('ical', privileges_for_user($user->id))) { engelsystem_error('No privilege for ical.'); } -- cgit v1.2.3-54-g00ecf