| @@ 101-108 (lines=8) @@ | ||
| 98 | ||
| 99 | if ($userEntity->getGroups()->contains($group)) { |
|
| 100 | $this->addFlash('warning', $this->__('The selected user is already a member of this group.')); |
|
| 101 | } else { |
|
| 102 | $userEntity->addGroup($group); |
|
| 103 | $this->get('doctrine')->getManager()->flush(); |
|
| 104 | $this->addFlash('status', $this->__('Done! The user was added to the group.')); |
|
| 105 | // Let other modules know that we have updated a group. |
|
| 106 | $adduserEvent = new GenericEvent(['gid' => $gid, 'uid' => $uid]); |
|
| 107 | $this->get('event_dispatcher')->dispatch(GroupEvents::GROUP_ADD_USER, $adduserEvent); |
|
| 108 | } |
|
| 109 | ||
| 110 | return $this->redirectToRoute('zikulagroupsmodule_membershipadministration_list', ['gid' => $gid]); |
|
| 111 | } |
|
| @@ 187-195 (lines=9) @@ | ||
| 184 | if ($currentUser->isLoggedIn()) { |
|
| 185 | $uid = $currentUser->get('uid'); |
|
| 186 | $user = $this->get('zikula_users_module.user_repository')->find($uid); |
|
| 187 | if ($this->get('zikula_users_module.helper.access_helper')->logout()) { |
|
| 188 | $event = new GenericEvent($user, [ |
|
| 189 | 'authenticationMethod' => $request->getSession()->get('authenticationMethod'), |
|
| 190 | 'uid' => $uid, |
|
| 191 | ]); |
|
| 192 | $this->get('event_dispatcher')->dispatch(AccessEvents::LOGOUT_SUCCESS, $event); |
|
| 193 | } else { |
|
| 194 | $this->addFlash('error', $this->__('Error! You have not been logged out.')); |
|
| 195 | } |
|
| 196 | } |
|
| 197 | ||
| 198 | return isset($returnUrl) ? $this->redirect($returnUrl) : $this->redirectToRoute('home'); |
|