| @@ 801-825 (lines=25) @@ | ||
| 798 | /** |
|
| 799 | * @see \eZ\Publish\API\Repository\RoleService::getRoleAssignmentsForUser() |
|
| 800 | */ |
|
| 801 | public function getRoleAssignmentsForUser(User $user, $inherited = false) |
|
| 802 | { |
|
| 803 | $response = $this->client->request( |
|
| 804 | 'GET', |
|
| 805 | $this->requestParser->generate('userRoleAssignments'), |
|
| 806 | new Message( |
|
| 807 | array('Accept' => $this->outputVisitor->getMediaType('RoleAssignmentList')) |
|
| 808 | ) |
|
| 809 | ); |
|
| 810 | ||
| 811 | $roleAssignments = $this->inputDispatcher->parse($response); |
|
| 812 | ||
| 813 | $userRoleAssignments = array(); |
|
| 814 | foreach ($roleAssignments as $roleAssignment) { |
|
| 815 | $userRoleAssignments[] = new UserRoleAssignment( |
|
| 816 | array( |
|
| 817 | 'limitation' => $roleAssignment->getRoleLimitation(), |
|
| 818 | 'role' => $roleAssignment->getRole(), |
|
| 819 | 'user' => $user, |
|
| 820 | ) |
|
| 821 | ); |
|
| 822 | } |
|
| 823 | ||
| 824 | return $userRoleAssignments; |
|
| 825 | } |
|
| 826 | ||
| 827 | /** |
|
| 828 | * Returns the roles assigned to the given user group. |
|
| @@ 836-860 (lines=25) @@ | ||
| 833 | * |
|
| 834 | * @return \eZ\Publish\API\Repository\Values\User\UserGroupRoleAssignment[] |
|
| 835 | */ |
|
| 836 | public function getRoleAssignmentsForUserGroup(UserGroup $userGroup) |
|
| 837 | { |
|
| 838 | $response = $this->client->request( |
|
| 839 | 'GET', |
|
| 840 | $this->requestParser->generate('groupRoleAssignments'), |
|
| 841 | new Message( |
|
| 842 | array('Accept' => $this->outputVisitor->getMediaType('RoleAssignmentList')) |
|
| 843 | ) |
|
| 844 | ); |
|
| 845 | ||
| 846 | $roleAssignments = $this->inputDispatcher->parse($response); |
|
| 847 | ||
| 848 | $userGroupRoleAssignments = array(); |
|
| 849 | foreach ($roleAssignments as $roleAssignment) { |
|
| 850 | $userGroupRoleAssignments[] = new UserGroupRoleAssignment( |
|
| 851 | array( |
|
| 852 | 'limitation' => $roleAssignment->getRoleLimitation(), |
|
| 853 | 'role' => $roleAssignment->getRole(), |
|
| 854 | 'userGroup' => $userGroup, |
|
| 855 | ) |
|
| 856 | ); |
|
| 857 | } |
|
| 858 | ||
| 859 | return $userGroupRoleAssignments; |
|
| 860 | } |
|
| 861 | ||
| 862 | /** |
|
| 863 | * Instantiates a role create class. |
|