|
@@ 422-435 (lines=14) @@
|
| 419 |
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to assign the user group to the user |
| 420 |
|
* @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the user is already in the given user group |
| 421 |
|
*/ |
| 422 |
|
public function assignUserToUserGroup(User $user, UserGroup $userGroup) |
| 423 |
|
{ |
| 424 |
|
$returnValue = $this->service->assignUserToUserGroup($user, $userGroup); |
| 425 |
|
$this->signalDispatcher->emit( |
| 426 |
|
new AssignUserToUserGroupSignal( |
| 427 |
|
array( |
| 428 |
|
'userId' => $user->id, |
| 429 |
|
'userGroupId' => $userGroup->id, |
| 430 |
|
) |
| 431 |
|
) |
| 432 |
|
); |
| 433 |
|
|
| 434 |
|
return $returnValue; |
| 435 |
|
} |
| 436 |
|
|
| 437 |
|
/** |
| 438 |
|
* Removes a user group from the user. |
|
@@ 446-459 (lines=14) @@
|
| 443 |
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove the user group from the user |
| 444 |
|
* @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the user is not in the given user group |
| 445 |
|
*/ |
| 446 |
|
public function unAssignUserFromUserGroup(User $user, UserGroup $userGroup) |
| 447 |
|
{ |
| 448 |
|
$returnValue = $this->service->unAssignUserFromUserGroup($user, $userGroup); |
| 449 |
|
$this->signalDispatcher->emit( |
| 450 |
|
new UnAssignUserFromUserGroupSignal( |
| 451 |
|
array( |
| 452 |
|
'userId' => $user->id, |
| 453 |
|
'userGroupId' => $userGroup->id, |
| 454 |
|
) |
| 455 |
|
) |
| 456 |
|
); |
| 457 |
|
|
| 458 |
|
return $returnValue; |
| 459 |
|
} |
| 460 |
|
|
| 461 |
|
/** |
| 462 |
|
* Loads the user groups the user belongs to. |