X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=charts.php;h=862a2fad61b3be312ff0a0c7df539d3540d894bb;hb=45ca7d2258832cb0d2465eb16dd646d925458106;hp=adaa8ae52496ebd5456f7ab1b4d6068505c03ad6;hpb=9af5722a81d1999243ac3a3d51d3cf3c3256d86a;p=timetracker.git diff --git a/charts.php b/charts.php index adaa8ae5..862a2fad 100644 --- a/charts.php +++ b/charts.php @@ -46,6 +46,10 @@ if (!$user->isPluginEnabled('ch')) { header('Location: feature_disabled.php'); exit(); } +if (!$user->exists()) { + header('Location: access_denied.php'); // Nobody to display a chart for. + exit(); +} if ($user->behalf_id && (!$user->can('view_charts') || !$user->checkBehalfId())) { header('Location: access_denied.php'); // Trying on behalf, but no right or wrong user. exit(); @@ -69,9 +73,6 @@ if ($request->isPost() && $userChanged) { $user->setOnBehalfUser($user_id); } else { $user_id = $user->getUser(); - // Handle a situation for no users in on behalf group. - if ($user->behalfGroup && $user_id == $user->id) - $user_id = null; } $uc = new ttUserConfig(); @@ -114,10 +115,11 @@ $chart_form = new Form('chartForm'); // User dropdown. Changes the user "on behalf" of whom we are working. if ($user->can('view_charts')) { + $rank = $user->getMaxRankForGroup($user->getGroup()); if ($user->can('view_own_charts')) - $options = array('status'=>ACTIVE,'max_rank'=>$user->rank-1,'include_self'=>true,'self_first'=>true); + $options = array('status'=>ACTIVE,'max_rank'=>$rank,'include_self'=>true,'self_first'=>true); else - $options = array('status'=>ACTIVE,'max_rank'=>$user->rank-1); + $options = array('status'=>ACTIVE,'max_rank'=>$rank); $user_list = $user->getUsers($options); if (count($user_list) >= 1) { $chart_form->addInput(array('type'=>'combobox',