|
@@ 665-688 (lines=24) @@
|
| 662 |
|
* @param \eZ\Publish\API\Repository\Values\User\Role $role |
| 663 |
|
* @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup |
| 664 |
|
*/ |
| 665 |
|
public function unassignRoleFromUserGroup(APIRole $role, UserGroup $userGroup) |
| 666 |
|
{ |
| 667 |
|
$values = $this->requestParser->parse('group', $userGroup->id); |
| 668 |
|
$userGroupId = $values['group']; |
| 669 |
|
|
| 670 |
|
$values = $this->requestParser->parse('role', $role->id); |
| 671 |
|
$roleId = $values['role']; |
| 672 |
|
|
| 673 |
|
$response = $this->client->request( |
| 674 |
|
'DELETE', |
| 675 |
|
$this->requestParser->generate('groupRoleAssignment', array('group' => $userGroupId, 'role' => $roleId)), |
| 676 |
|
new Message( |
| 677 |
|
// @todo: What media-type should we set here? Actually, it should be |
| 678 |
|
// all expected exceptions + none? Or is "Section" correct, |
| 679 |
|
// since this is what is to be expected by the resource |
| 680 |
|
// identified by the URL? |
| 681 |
|
array('Accept' => $this->outputVisitor->getMediaType('RoleAssignmentList')) |
| 682 |
|
) |
| 683 |
|
); |
| 684 |
|
|
| 685 |
|
if (!empty($response->body)) { |
| 686 |
|
$this->inputDispatcher->parse($response); |
| 687 |
|
} |
| 688 |
|
} |
| 689 |
|
|
| 690 |
|
/** |
| 691 |
|
* Assigns a role to the given user. |
|
@@ 732-755 (lines=24) @@
|
| 729 |
|
* @param \eZ\Publish\API\Repository\Values\User\Role $role |
| 730 |
|
* @param \eZ\Publish\API\Repository\Values\User\User $user |
| 731 |
|
*/ |
| 732 |
|
public function unassignRoleFromUser(APIRole $role, User $user) |
| 733 |
|
{ |
| 734 |
|
$values = $this->requestParser->parse('user', $user->id); |
| 735 |
|
$userId = $values['user']; |
| 736 |
|
|
| 737 |
|
$values = $this->requestParser->parse('role', $role->id); |
| 738 |
|
$roleId = $values['role']; |
| 739 |
|
|
| 740 |
|
$response = $this->client->request( |
| 741 |
|
'DELETE', |
| 742 |
|
$this->requestParser->generate('userRoleAssignment', array('user' => $userId, 'role' => $roleId)), |
| 743 |
|
new Message( |
| 744 |
|
// @todo: What media-type should we set here? Actually, it should be |
| 745 |
|
// all expected exceptions + none? Or is "Section" correct, |
| 746 |
|
// since this is what is to be expected by the resource |
| 747 |
|
// identified by the URL? |
| 748 |
|
array('Accept' => $this->outputVisitor->getMediaType('RoleAssignmentList')) |
| 749 |
|
) |
| 750 |
|
); |
| 751 |
|
|
| 752 |
|
if (!empty($response->body)) { |
| 753 |
|
$this->inputDispatcher->parse($response); |
| 754 |
|
} |
| 755 |
|
} |
| 756 |
|
|
| 757 |
|
/** |
| 758 |
|
* Removes the given role assignment. |