X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=expenses.php;h=7291414aac7a0af629a5f8085ef2a38897a0e96e;hb=40e7c879cbbc4f00227c039f1a86d48f81e10101;hp=00b43179c23f3a0a93b22273db09581c8fd608d1;hpb=4dcb88a76a3de466ee6116ae0852f53ba2b259a5;p=timetracker.git diff --git a/expenses.php b/expenses.php index 00b43179..7291414a 100644 --- a/expenses.php +++ b/expenses.php @@ -42,6 +42,14 @@ if (!$user->isPluginEnabled('ex')) { header('Location: feature_disabled.php'); exit(); } +if ($user->behalf_id && (!$user->can('track_expenses') || !$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_expenses') && !$user->adjustBehalfId()) { + header('Location: access_denied.php'); // Trying as self, but no right for self, and noone to work on behalf. + exit(); +} // Initialize and store date in session. $cl_date = $request->getParameter('date', @$_SESSION['date']); @@ -64,9 +72,13 @@ $cl_cost = $request->getParameter('cost'); // Elements of expensesForm. $form = new Form('expensesForm'); -if ($user->canManageTeam()) { - $user_list = ttTeamHelper::getActiveUsers(array('putSelfFirst'=>true)); - if (count($user_list) > 1) { +if ($user->can('track_expenses')) { + if ($user->can('track_own_expenses')) + $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',