|
@@ 801-820 (lines=20) @@
|
| 798 |
|
* @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup |
| 799 |
|
* @param \eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation $roleLimitation an optional role limitation (which is either a subtree limitation or section limitation) |
| 800 |
|
*/ |
| 801 |
|
public function assignRoleToUserGroup(APIRole $role, UserGroup $userGroup, RoleLimitation $roleLimitation = null) |
| 802 |
|
{ |
| 803 |
|
$roleAssignment = new RoleAssignment( |
| 804 |
|
array( |
| 805 |
|
'role' => $role, |
| 806 |
|
'limitation' => $roleLimitation, |
| 807 |
|
) |
| 808 |
|
); |
| 809 |
|
|
| 810 |
|
$inputMessage = $this->outputVisitor->visit($roleAssignment); |
| 811 |
|
$inputMessage->headers['Accept'] = $this->outputVisitor->getMediaType('RoleAssignmentList'); |
| 812 |
|
|
| 813 |
|
$result = $this->client->request( |
| 814 |
|
'POST', |
| 815 |
|
$this->requestParser->generate('groupRoleAssignments', array('group' => $userGroup->id)), |
| 816 |
|
$inputMessage |
| 817 |
|
); |
| 818 |
|
|
| 819 |
|
$this->inputDispatcher->parse($result); |
| 820 |
|
} |
| 821 |
|
|
| 822 |
|
/** |
| 823 |
|
* removes a role from the given user group. |
|
@@ 868-887 (lines=20) @@
|
| 865 |
|
* @param \eZ\Publish\API\Repository\Values\User\User $user |
| 866 |
|
* @param \eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation $roleLimitation an optional role limitation (which is either a subtree limitation or section limitation) |
| 867 |
|
*/ |
| 868 |
|
public function assignRoleToUser(APIRole $role, User $user, RoleLimitation $roleLimitation = null) |
| 869 |
|
{ |
| 870 |
|
$roleAssignment = new RoleAssignment( |
| 871 |
|
array( |
| 872 |
|
'role' => $role, |
| 873 |
|
'limitation' => $roleLimitation, |
| 874 |
|
) |
| 875 |
|
); |
| 876 |
|
|
| 877 |
|
$inputMessage = $this->outputVisitor->visit($roleAssignment); |
| 878 |
|
$inputMessage->headers['Accept'] = $this->outputVisitor->getMediaType('RoleAssignmentList'); |
| 879 |
|
|
| 880 |
|
$result = $this->client->request( |
| 881 |
|
'POST', |
| 882 |
|
$this->requestParser->generate('userRoleAssignments', array('user' => $user->id)), |
| 883 |
|
$inputMessage |
| 884 |
|
); |
| 885 |
|
|
| 886 |
|
$this->inputDispatcher->parse($result); |
| 887 |
|
} |
| 888 |
|
|
| 889 |
|
/** |
| 890 |
|
* removes a role from the given user. |