Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Public Member Functions | List of all members
eZ\Publish\API\Repository\PermissionResolver Interface Reference

This service provides methods for resolving permissions. More...

Inheritance diagram for eZ\Publish\API\Repository\PermissionResolver:

## Public Member Functions
| getCurrentUserReference ()
| Get current user reference. More...
| setCurrentUserReference (UserReference $userReference)
| Sets the current user to the given $user. More...
| hasAccess ($module, $function, UserReference $userReference=null)
| Low level permission function: Returns boolean value, or an array of limitations that user permission depends on. More...
| canUser ($module, $function, ValueObject $object, array $targets=[])
| Indicates if the current user is allowed to perform an action given by the function on the given objects. More...
| lookupLimitations (string $module, string $function, ValueObject $object, array $targets=[], array $limitationsIdentifiers=[])
| {} More...

## Detailed Description

This service provides methods for resolving permissions.

Definition at line 16 of file API/Repository/PermissionResolver.php.

## Member Function Documentation

## ◆ canUser()

eZ\Publish\Core\Repository\Permission\PermissionResolver::canUser | ( |  | $module,
|  |  | $function,
|  | ValueObject | $object,
|  | array | $targets = `[]`
| ) |  |

Indicates if the current user is allowed to perform an action given by the function on the given objects.

Example: canUser( 'content', 'edit', $content, $location ); This will check edit permission on content given the specific location, if skipped if will check on all locations.

Example2: canUser( 'section', 'assign', $content, $section ); Check if user has access to assign $content to $section.

Exceptions

First deal with Role limitation if any.

Here we accept ACCESS_GRANTED and ACCESS_ABSTAIN, the latter in cases where $object and $targets are not supported by limitation.

Implemented in eZ\Publish\Core\Repository\Permission\CachedPermissionService.

Definition at line 181 of file Core/Repository/Permission/PermissionResolver.php.

## ◆ getCurrentUserReference()

eZ\Publish\API\Repository\PermissionResolver::getCurrentUserReference | ( |  | ) |

Get current user reference.

Returns
  \eZ\Publish\API\Repository\Values\User\UserReference

Implemented in eZ\Publish\Core\Repository\Permission\PermissionResolver, and eZ\Publish\Core\Repository\Permission\CachedPermissionService.

## ◆ hasAccess()

eZ\Publish\API\Repository\PermissionResolver::hasAccess | ( |  | $module,
|  |  | $function,
|  | UserReference | $userReference = `null`
| ) |  |

Low level permission function: Returns boolean value, or an array of limitations that user permission depends on.

Note: boolean value describes full access (true) or no access at all (false), array can be seen as a maybe..

WARNING: This is a low level method, if possible strongly prefer to use canUser() as it is able to handle limitations. This includes Role Assignment limitations, but also future policy limitations added in kernel, or as plain user configuration and/or extending the system.

Exceptions

Implemented in eZ\Publish\Core\Repository\Permission\CachedPermissionService.

## ◆ lookupLimitations()

eZ\Publish\Core\Repository\Permission\PermissionResolver::lookupLimitations | ( | string | $module,
|  | string | $function,
|  | ValueObject | $object,
|  | array | $targets = `[]`,
|  | array | $limitationsIdentifiers = `[]`
| ) |  |

{}

Parameters

  string | $module | The module, aka controller identifier to check permissions on
  string | $function | The function, aka the controller action to check permissions on
  \eZ\Publish\API\Repository\Values\ValueObject | $object | The object to check if the user has access to
  \eZ\Publish\API\Repository\Values\ValueObject[] | $targets | An array of location, parent or "assignment" value objects
  string[] | $limitationsIdentifiers | An array of Limitations identifiers to filter from all which will pass

Returns
  \eZ\Publish\API\Repository\Values\User\LookupLimitationResult

Exceptions

Implemented in eZ\Publish\Core\Repository\Permission\CachedPermissionService.

Definition at line 280 of file Core/Repository/Permission/PermissionResolver.php.

## ◆ setCurrentUserReference()

eZ\Publish\API\Repository\PermissionResolver::setCurrentUserReference | ( | UserReference | $userReference | ) |

Sets the current user to the given $user.

Parameters

  \eZ\Publish\API\Repository\Values\User\UserReference | $userReference |

Implemented in eZ\Publish\Core\Repository\Permission\CachedPermissionService.

The documentation for this interface was generated from the following file:

- API/Repository/PermissionResolver.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.