-
-// Get user id we are editing from the request.
-$user_id = (int) $request->getParameter('id');
-
-// Get user details.
-$user_details = ttUserHelper::getUserDetails($user_id);
-
-// Security checks.
-$ok_to_go = $user->canManageTeam(); // Are we authorized for user management?
-if ($ok_to_go) $ok_to_go = $ok_to_go && $user_details; // Are we editing a real user?
-if ($ok_to_go) $ok_to_go = $ok_to_go && ($user->team_id == $user_details['team_id']); // User belongs to our team?
-if ($ok_to_go && $user->isCoManager() && (ROLE_COMANAGER == $user_details['role']))
- $ok_to_go = ($user->id == $user_details['id']); // Comanager is not allowed to edit other comanagers.
-if ($ok_to_go && $user->isCoManager() && (ROLE_MANAGER == $user_details['role']))
- $ok_to_go = false; // Comanager is not allowed to edit a manager.
-if (!$ok_to_go) {
- die ($i18n->getKey('error.sys'));
+$user_id = (int)$request->getParameter('id');
+$user_details = $user->getUserDetails($user_id);
+if (!$user_details) {
+ header('Location: access_denied.php');
+ exit();