- if ($user->canManageTeam())
- $users = ttTeamHelper::getUsers(); // Active and inactive users for managers.
+ if ($user->can('view_reports') || $user->can('view_all_reports')) {
+ $max_rank = $user->rank-1;
+ if ($user->can('view_all_reports')) $max_rank = 512;
+ if ($user->can('view_own_reports'))
+ $options = array('max_rank'=>$max_rank,'include_self'=>true);
+ else
+ $options = array('max_rank'=>$max_rank);
+ $users = $user->getUsers($options); // Active and inactive users.
+ }