Initial coding of group editor done.
[timetracker.git] / roles.php
index cd17da3..fe68329 100644 (file)
--- a/roles.php
+++ b/roles.php
@@ -36,8 +36,19 @@ if (!ttAccessAllowed('manage_roles')) {
   header('Location: access_denied.php');
   exit();
 }
+$group_id = (int)$request->getParameter('group_id');
+if ($group_id && !$user->isGroupValid($group_id)) {
+  header('Location: access_denied.php');
+  exit();
+}
 // End of access checks.
 
+if ($group_id) {
+  // We are passed a valid group_id (most likely from group_edit.php).
+  // Set on behalf group accordingly.
+  $user->setOnBehalfGroup($group_id);
+}
+
 $smarty->assign('active_roles', ttTeamHelper::getActiveRolesForUser());
 $smarty->assign('inactive_roles', ttTeamHelper::getInactiveRolesForUser());
 $smarty->assign('title', $i18n->get('title.roles'));