| @@ 967-991 (lines=25) @@ | ||
| 964 | /** |
|
| 965 | * @see \eZ\Publish\API\Repository\RoleService::getRoleAssignmentsForUser() |
|
| 966 | */ |
|
| 967 | public function getRoleAssignmentsForUser(User $user, $inherited = false) |
|
| 968 | { |
|
| 969 | $response = $this->client->request( |
|
| 970 | 'GET', |
|
| 971 | $this->requestParser->generate('userRoleAssignments'), |
|
| 972 | new Message( |
|
| 973 | array('Accept' => $this->outputVisitor->getMediaType('RoleAssignmentList')) |
|
| 974 | ) |
|
| 975 | ); |
|
| 976 | ||
| 977 | $roleAssignments = $this->inputDispatcher->parse($response); |
|
| 978 | ||
| 979 | $userRoleAssignments = array(); |
|
| 980 | foreach ($roleAssignments as $roleAssignment) { |
|
| 981 | $userRoleAssignments[] = new UserRoleAssignment( |
|
| 982 | array( |
|
| 983 | 'limitation' => $roleAssignment->getRoleLimitation(), |
|
| 984 | 'role' => $roleAssignment->getRole(), |
|
| 985 | 'user' => $user, |
|
| 986 | ) |
|
| 987 | ); |
|
| 988 | } |
|
| 989 | ||
| 990 | return $userRoleAssignments; |
|
| 991 | } |
|
| 992 | ||
| 993 | /** |
|
| 994 | * Returns the roles assigned to the given user group. |
|
| @@ 1002-1026 (lines=25) @@ | ||
| 999 | * |
|
| 1000 | * @return \eZ\Publish\API\Repository\Values\User\UserGroupRoleAssignment[] |
|
| 1001 | */ |
|
| 1002 | public function getRoleAssignmentsForUserGroup(UserGroup $userGroup) |
|
| 1003 | { |
|
| 1004 | $response = $this->client->request( |
|
| 1005 | 'GET', |
|
| 1006 | $this->requestParser->generate('groupRoleAssignments'), |
|
| 1007 | new Message( |
|
| 1008 | array('Accept' => $this->outputVisitor->getMediaType('RoleAssignmentList')) |
|
| 1009 | ) |
|
| 1010 | ); |
|
| 1011 | ||
| 1012 | $roleAssignments = $this->inputDispatcher->parse($response); |
|
| 1013 | ||
| 1014 | $userGroupRoleAssignments = array(); |
|
| 1015 | foreach ($roleAssignments as $roleAssignment) { |
|
| 1016 | $userGroupRoleAssignments[] = new UserGroupRoleAssignment( |
|
| 1017 | array( |
|
| 1018 | 'limitation' => $roleAssignment->getRoleLimitation(), |
|
| 1019 | 'role' => $roleAssignment->getRole(), |
|
| 1020 | 'userGroup' => $userGroup, |
|
| 1021 | ) |
|
| 1022 | ); |
|
| 1023 | } |
|
| 1024 | ||
| 1025 | return $userGroupRoleAssignments; |
|
| 1026 | } |
|
| 1027 | ||
| 1028 | /** |
|
| 1029 | * Instantiates a role create class. |
|