public function loadRoleAssignment($roleAssignmentId)
    {
        if ($this->repository->hasAccess('role', 'read') !== true) {
            throw new UnauthorizedException('role', 'read');
        }

        $spiRoleAssignment = $this->userHandler->loadRoleAssignment($roleAssignmentId);
        $userService = $this->repository->getUserService();
        $role = $this->loadRole($spiRoleAssignment->roleId);
        $roleAssignment = null;

        // First check if the Role is assigned to a User
        // If no User is found, see if it belongs to a UserGroup
        try {
            $user = $userService->loadUser($spiRoleAssignment->contentId);
            $roleAssignment = $this->roleDomainMapper->buildDomainUserRoleAssignmentObject(
                $spiRoleAssignment,
                $user,
                $role
            );
        } catch (APINotFoundException $e) {
            try {
                $userGroup = $userService->loadUserGroup($spiRoleAssignment->contentId);
                $roleAssignment = $this->roleDomainMapper->buildDomainUserGroupRoleAssignmentObject(
                    $spiRoleAssignment,
                    $userGroup,
                    $role
                );
            } catch (APINotFoundException $e) {
                // Do nothing
            }
        }

        return $roleAssignment;
    }
public function loadRoleAssignment($roleAssignmentId)
    {
        if ($this->repository->hasAccess('role', 'read') !== true) {
            throw new UnauthorizedException('role', 'read');
        }

        $spiRoleAssignment = $this->userHandler->loadRoleAssignment($roleAssignmentId);
        $userService = $this->repository->getUserService();
        $role = $this->loadRole($spiRoleAssignment->roleId);
        $roleAssignment = null;

        // First check if the Role is assigned to a User
        // If no User is found, see if it belongs to a UserGroup
        try {
            $user = $userService->loadUser($spiRoleAssignment->contentId);
            $roleAssignment = $this->roleDomainMapper->buildDomainUserRoleAssignmentObject(
                $spiRoleAssignment,
                $user,
                $role
            );
        } catch (APINotFoundException $e) {
            try {
                $userGroup = $userService->loadUserGroup($spiRoleAssignment->contentId);
                $roleAssignment = $this->roleDomainMapper->buildDomainUserGroupRoleAssignmentObject(
                    $spiRoleAssignment,
                    $userGroup,
                    $role
                );
            } catch (APINotFoundException $e) {
                // Do nothing
            }
        }

        return $roleAssignment;
    }
public function loadRoleAssignment ( $ roleAssignmentId ) { if ( $ this -> repository -> hasAccess ( 'role' , 'read' ) !== true ) { throw new UnauthorizedException ( 'role' , 'read' ) ; } $ spiRoleAssignment = $ this -> userHandler -> loadRoleAssignment ( $ roleAssignmentId ) ; $ userService = $ this -> repository -> getUserService ( ) ; $ role = $ this -> loadRole ( $ spiRoleAssignment -> roleId ) ; $ roleAssignment = null ; // First check if the Role is assigned to a User // If no User is found, see if it belongs to a UserGroup try { $ user = $ userService -> loadUser ( $ spiRoleAssignment -> contentId ) ; $ roleAssignment = $ this -> roleDomainMapper -> buildDomainUserRoleAssignmentObject ( $ spiRoleAssignment , $ user , $ role ) ; } catch ( APINotFoundException $ e ) { try { $ userGroup = $ userService -> loadUserGroup ( $ spiRoleAssignment -> contentId ) ; $ roleAssignment = $ this -> roleDomainMapper -> buildDomainUserGroupRoleAssignmentObject ( $ spiRoleAssignment , $ userGroup , $ role ) ; } catch ( APINotFoundException $ e ) { // Do nothing } } return $ roleAssignment ; }
Loads a role assignment for the given id.

@throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role
@throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the role assignment was not found

@param mixed $roleAssignmentId

@return \eZ\Publish\API\Repository\Values\User\RoleAssignment
Loads a role assignment for the given id .