Skip to content
Snippets Groups Projects
Commit 3657a0e8 authored by Moreau Elise's avatar Moreau Elise
Browse files

add users in a group if user is admin

parent bfba0d04
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,13 @@ class AddUserGroupAction extends GroupAction
if (!isset($group)) {
throw new GroupNotFoundException();
}
$currentUser = $this->userRepository->find($_SESSION['userId']);
if ($this->group->hasUser($currentUser)){
return $this->response
->withHeader('Location', '/groups/' . $groupId)
->withStatus(302);
}
$currentUser->addGroup($group);
$this->em->persist($group);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment