X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=time.php;h=d75854c831e7bb2ea80da92aa82b116a00a1cbd3;hb=11bfec0ff88b649a934556e8b4812d65715c7509;hp=270a8aaef0c23efed927ae1520a2f7621418c4f3;hpb=fd0872d9e582113346fa1e93557f370286c5c9f2;p=timetracker.git diff --git a/time.php b/time.php index 270a8aae..d75854c8 100644 --- a/time.php +++ b/time.php @@ -34,18 +34,20 @@ import('ttClientHelper'); import('ttTimeHelper'); import('DateAndTime'); -// This is a now removed check whether user browser supports cookies. -// if (!isset($_COOKIE['tt_PHPSESSID'])) { - // This test gives a false-positive if user goes directly to this page - // as from a desktop shortcut (on first request only). - // die ("Your browser's cookie functionality is turned off. Please turn it on."); -// } - -// Access check. -if (!ttAccessAllowed('track_own_time')) { +// Access checks. +if (!(ttAccessAllowed('track_own_time') || ttAccessAllowed('track_time'))) { header('Location: access_denied.php'); exit(); } +if ($user->behalf_id && (!$user->can('track_time') || !$user->checkBehalfId())) { + header('Location: access_denied.php'); // Trying on behalf, but no right or wrong user. + exit(); +} +if (!$user->behalf_id && !$user->can('track_own_time') && !$user->adjustBehalfId()) { + header('Location: access_denied.php'); // Trying as self, but no right for self, and noone to work on behalf. + exit(); +} +// End of access checks. // Initialize and store date in session. $cl_date = $request->getParameter('date', @$_SESSION['date']); @@ -103,9 +105,13 @@ $_SESSION['task'] = $cl_task; // Elements of timeRecordForm. $form = new Form('timeRecordForm'); -if ($user->canManageTeam()) { - $user_list = ttTeamHelper::getActiveUsers(array('putSelfFirst'=>true)); - if (count($user_list) > 1) { +if ($user->can('track_time')) { + if ($user->can('track_own_time')) + $options = array('status'=>ACTIVE,'max_rank'=>$user->rank-1,'include_self'=>true,'self_first'=>true); + else + $options = array('status'=>ACTIVE,'max_rank'=>$user->rank-1); + $user_list = $user->getUsers($options); + if (count($user_list) >= 1) { $form->addInput(array('type'=>'combobox', 'onchange'=>'this.form.submit();', 'name'=>'onBehalfUser',