|
@@ 437-450 (lines=14) @@
|
| 434 |
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to assign the user group to the user |
| 435 |
|
* @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the user is already in the given user group |
| 436 |
|
*/ |
| 437 |
|
public function assignUserToUserGroup(User $user, UserGroup $userGroup) |
| 438 |
|
{ |
| 439 |
|
$returnValue = $this->service->assignUserToUserGroup($user, $userGroup); |
| 440 |
|
$this->signalDispatcher->emit( |
| 441 |
|
new AssignUserToUserGroupSignal( |
| 442 |
|
[ |
| 443 |
|
'userId' => $user->id, |
| 444 |
|
'userGroupId' => $userGroup->id, |
| 445 |
|
] |
| 446 |
|
) |
| 447 |
|
); |
| 448 |
|
|
| 449 |
|
return $returnValue; |
| 450 |
|
} |
| 451 |
|
|
| 452 |
|
/** |
| 453 |
|
* Removes a user group from the user. |
|
@@ 461-474 (lines=14) @@
|
| 458 |
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove the user group from the user |
| 459 |
|
* @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the user is not in the given user group |
| 460 |
|
*/ |
| 461 |
|
public function unAssignUserFromUserGroup(User $user, UserGroup $userGroup) |
| 462 |
|
{ |
| 463 |
|
$returnValue = $this->service->unAssignUserFromUserGroup($user, $userGroup); |
| 464 |
|
$this->signalDispatcher->emit( |
| 465 |
|
new UnAssignUserFromUserGroupSignal( |
| 466 |
|
[ |
| 467 |
|
'userId' => $user->id, |
| 468 |
|
'userGroupId' => $userGroup->id, |
| 469 |
|
] |
| 470 |
|
) |
| 471 |
|
); |
| 472 |
|
|
| 473 |
|
return $returnValue; |
| 474 |
|
} |
| 475 |
|
|
| 476 |
|
/** |
| 477 |
|
* Loads the user groups the user belongs to. |