コード例 #1
0
 private function updateGroup()
 {
     $id = $this->request->get('id');
     $name = $this->request->get('name');
     $description = $this->request->get('description');
     try {
         if ($id) {
             $user_group = new User_ForgeUGroup($id, $name, $description);
             $this->user_group_manager->updateUserGroup($user_group);
         } else {
             $user_group = $this->user_group_factory->createForgeUGroup($name, $description);
             $this->request->set('id', $user_group->getId());
         }
     } catch (User_UserGroupNameInvalidException $e) {
         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('admin_permission_delegation', 'user_group_already_exists'));
     } catch (User_UserGroupNotFoundException $e) {
         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('admin_permission_delegation', 'ugroup_not_found'));
     }
     $this->index();
 }
コード例 #2
0
ファイル: TestDataBuilder.php プロジェクト: ndjido/tuleap
 public function delegatePermissionsToManageUser()
 {
     $user = $this->user_manager->getUserById(self::TEST_USER_3_ID);
     // Create group
     $user_group_dao = new UserGroupDao();
     $user_group_factory = new User_ForgeUserGroupFactory($user_group_dao);
     $user_group = $user_group_factory->createForgeUGroup('site remote admins', '');
     // Grant Retrieve Membership permissions
     $permission = new User_ForgeUserGroupPermission_UserManagement();
     $permissions_dao = new User_ForgeUserGroupPermissionsDao();
     $user_group_permissions_manager = new User_ForgeUserGroupPermissionsManager($permissions_dao);
     $user_group_permissions_manager->addPermission($user_group, $permission);
     // Add user to group
     $user_group_users_dao = new User_ForgeUserGroupUsersDao();
     $user_group_users_manager = new User_ForgeUserGroupUsersManager($user_group_users_dao);
     $user_group_users_manager->addUserToForgeUserGroup($user, $user_group);
     return $this;
 }