com\setasign\Konquadrat\Permission

PermissionControl Class PermissionControl

File: /Konquadrat/src/Permission/PermissionControl.php

Class hierarchy

Implements

Summary

Properties

$logger

$queryFilter

private ?callable PermissionControl::$queryFilter

$resourceDefinitionManager


Methods

__construct()

public PermissionControl::__construct (
ResourceDefinitionManager $resourceDefinitionManager
)
Parameters
$resourceDefinitionManager: ResourceDefinitionManager
 

__sleep()

public PermissionControl::__sleep (
void
): void

allow()

public \com\setasign\SetaFramework\Permissions\PermissionControl::allow (
\com\setasign\SetaFramework\Permissions\ResourceDefinition $resource,
array|string|callable|null $actionsOrCallback = null
): void

Allow one or more actions of a resource

Parameters
$resource: \com\setasign\SetaFramework\Permissions\ResourceDefinition
 
$actionsOrCallback: array|string|callable|null
 
Exceptions

Throws \InvalidArgumentException

checkOwnPermissions()

protected \com\setasign\SetaFramework\Permissions\PermissionControl::checkOwnPermissions (
string $name,
string $actionName,
?object $object
): int
Parameters
$name: string
  • the ResourceDefinition name
$actionName: string
  • the action name
$object: ?object
  • the allowed/denied object
Return Values
  • 1 : allowed, -1 : denied

checkRolesPermissions()

deny()

public \com\setasign\SetaFramework\Permissions\PermissionControl::deny (
\com\setasign\SetaFramework\Permissions\ResourceDefinition $resource,
array|string|callable|null $actionsOrCallback = null
): void

Deny one or more actions of a resource

Parameters
$resource: \com\setasign\SetaFramework\Permissions\ResourceDefinition
 
$actionsOrCallback: array|string|callable|null
 
Exceptions

Throws \InvalidArgumentException

filterQuery()

getIndividualPermissions()

Get all individual permissions that are defined in the $actions array

getResourceDefinitionManager()

getRoles()

Gets all added roles

isAllowed()

Checks whether an action of a resource is allowed

Parameters
$nameOrObject: object|string|\com\setasign\SetaFramework\Permissions\ResourceDefinition
 
$action: string
 

requirePermission()

Checks whether a action of a resource is allowed and if not an exception will be thrown

Parameters
$nameOrObject: object|string|\com\setasign\SetaFramework\Permissions\ResourceDefinition
 
$action: string
 
Exceptions

Throws \com\setasign\SetaFramework\Permissions\PermissionException If the permission is rejected!

setLogger()

public \com\setasign\SetaFramework\Permissions\PermissionControl::setLogger (
\Psr\Log\LoggerInterface $logger
): void

Sets a logger instance on the object.

Parameters
$logger: \Psr\Log\LoggerInterface
 

setupQueryFilter()

public PermissionControl::setupQueryFilter (
callable $callback
): void
Parameters
$callback: callable

Params: Select $query, string $type