private function flattenArrayOfLimitationsForCurrentUser(array $hasAccess): array
    {
        $currentUserId = $this->permissionResolver->getCurrentUserReference()->getUserId();

        if (\is_array($this->flattenArrayOfLimitations[$currentUserId])) {
            return $this->flattenArrayOfLimitations[$currentUserId];
        }

        $limitations = [];
        foreach ($hasAccess as $permissionSet) {
            if ($permissionSet['limitation'] !== null) {
                $limitations[] = $permissionSet['limitation'];
            }
            /** @var \eZ\Publish\API\Repository\Values\User\Policy $policy */
            foreach ($permissionSet['policies'] as $policy) {
                $policyLimitations = $policy->getLimitations();
                if (!empty($policyLimitations)) {
                    foreach ($policyLimitations as $policyLimitation) {
                        $limitations[$policy->id][] = $policyLimitation;
                    }
                }
            }
        }

        return $this->flattenArrayOfLimitations[$currentUserId] = $limitations;
    }
private function flattenArrayOfLimitationsForCurrentUser(array $hasAccess): array
    {
        $currentUserId = $this->permissionResolver->getCurrentUserReference()->getUserId();

        if (\is_array($this->flattenArrayOfLimitations[$currentUserId])) {
            return $this->flattenArrayOfLimitations[$currentUserId];
        }

        $limitations = [];
        foreach ($hasAccess as $permissionSet) {
            if ($permissionSet['limitation'] !== null) {
                $limitations[] = $permissionSet['limitation'];
            }
            /** @var \eZ\Publish\API\Repository\Values\User\Policy $policy */
            foreach ($permissionSet['policies'] as $policy) {
                $policyLimitations = $policy->getLimitations();
                if (!empty($policyLimitations)) {
                    foreach ($policyLimitations as $policyLimitation) {
                        $limitations[$policy->id][] = $policyLimitation;
                    }
                }
            }
        }

        return $this->flattenArrayOfLimitations[$currentUserId] = $limitations;
    }
private function flattenArrayOfLimitationsForCurrentUser ( array $ hasAccess ) : array { $ currentUserId = $ this -> permissionResolver -> getCurrentUserReference ( ) -> getUserId ( ) ; if ( \ is_array ( $ this -> flattenArrayOfLimitations [ $ currentUserId ] ) ) { return $ this -> flattenArrayOfLimitations [ $ currentUserId ] ; } $ limitations = [ ] ; foreach ( $ hasAccess as $ permissionSet ) { if ( $ permissionSet [ 'limitation' ] !== null ) { $ limitations [ ] = $ permissionSet [ 'limitation' ] ; } /** @var \eZ\Publish\API\Repository\Values\User\Policy $policy */ foreach ( $ permissionSet [ 'policies' ] as $ policy ) { $ policyLimitations = $ policy -> getLimitations ( ) ; if ( ! empty ( $ policyLimitations ) ) { foreach ( $ policyLimitations as $ policyLimitation ) { $ limitations [ $ policy -> id ] [ ] = $ policyLimitation ; } } } } return $ this -> flattenArrayOfLimitations [ $ currentUserId ] = $ limitations ; }
This method should only be used for very specific use cases. It should be used in a content cases
where assignment limitations are not relevant.

@param array $hasAccess

@return array
This method should only be used for very specific use cases . It should be used in a content cases where assignment limitations are not relevant .