PolicyManager
in package
Class PolicyManager.
Table of Contents
Properties
- $policies : array<string, string>
- $policyForModels : array<string, string>
- $resolvePolicies : array<string, mixed>
- $resolveRules : array<string, PolicyRuleInterface>
- $rules : array<string, string>
Methods
- __construct() : mixed
- addPolicy() : void
- addRule() : void
- check() : bool
- getExtras() : array<string, bool>
- getModelFor() : string
- getPolicies() : array<string|int, mixed>
- Get policies.
- getPolicyFor() : mixed
- getRuleFor() : mixed
- getRules() : array<string|int, string>
- Get all rules.
- setPolicies() : void
Properties
$policies
private
array<string, string>
$policies
= []
$policyForModels
private
array<string, string>
$policyForModels
= []
$resolvePolicies
private
array<string, mixed>
$resolvePolicies
= []
$resolveRules
private
array<string, PolicyRuleInterface>
$resolveRules
= []
$rules
private
array<string, string>
$rules
= []
Methods
__construct()
public
__construct() : mixed
addPolicy()
public
addPolicy(string $model, string $policy) : void
Parameters
- $model : string
- $policy : string
addRule()
public
addRule(string $model, string $handler) : void
Parameters
- $model : string
- $handler : string
check()
public
check(string $type, string $ability, array<string|int, mixed> $arguments) : bool
Parameters
- $type : string
- $ability : string
- $arguments : array<string|int, mixed>
Return values
boolgetExtras()
public
getExtras(array<string|int, string> $abilities, mixed $context, mixed $resource) : array<string, bool>
Parameters
- $abilities : array<string|int, string>
- $context : mixed
- $resource : mixed
Return values
array<string, bool>getModelFor()
public
getModelFor(string $policy) : string
Parameters
- $policy : string
Return values
stringgetPolicies()
Get policies.
public
getPolicies() : array<string|int, mixed>
Return values
array<string|int, mixed>getPolicyFor()
public
getPolicyFor(string $model) : mixed
Parameters
- $model : string
getRuleFor()
public
getRuleFor(string $ability) : mixed
Parameters
- $ability : string
getRules()
Get all rules.
public
getRules() : array<string|int, string>
Return values
array<string|int, string>setPolicies()
public
setPolicies(array<string, string> $policies) : void
Parameters
- $policies : array<string, string>