public function loadRoleAssignmentForUser($userId, $roleId, Request $request)
    {
        $user = $this->userService->loadUser($userId);
        $roleAssignments = $this->roleService->getRoleAssignmentsForUser($user);

        foreach ($roleAssignments as $roleAssignment) {
            if ($roleAssignment->getRole()->id == $roleId) {
                return new Values\RestUserRoleAssignment($roleAssignment, $userId);
            }
        }

        throw new Exceptions\NotFoundException("Role assignment not found: '{$request->getPathInfo()}'.");
    }
public function loadRoleAssignmentForUser($userId, $roleId, Request $request)
    {
        $user = $this->userService->loadUser($userId);
        $roleAssignments = $this->roleService->getRoleAssignmentsForUser($user);

        foreach ($roleAssignments as $roleAssignment) {
            if ($roleAssignment->getRole()->id == $roleId) {
                return new Values\RestUserRoleAssignment($roleAssignment, $userId);
            }
        }

        throw new Exceptions\NotFoundException("Role assignment not found: '{$request->getPathInfo()}'.");
    }
public function loadRoleAssignmentForUser ( $ userId , $ roleId , Request $ request ) { $ user = $ this -> userService -> loadUser ( $ userId ) ; $ roleAssignments = $ this -> roleService -> getRoleAssignmentsForUser ( $ user ) ; foreach ( $ roleAssignments as $ roleAssignment ) { if ( $ roleAssignment -> getRole ( ) -> id == $ roleId ) { return new Values \ RestUserRoleAssignment ( $ roleAssignment , $ userId ) ; } } throw new Exceptions \ NotFoundException ( "Role assignment not found: '{$request->getPathInfo()}'." ) ; }
Returns a role assignment to the given user.

@param $userId
@param $roleId

@throws \eZ\Publish\Core\REST\Common\Exceptions\NotFoundException

@return \eZ\Publish\Core\REST\Server\Values\RestUserRoleAssignment
Returns a role assignment to the given user .