PHP 클래스 Psecio\PropAuth\Enforcer

파일 보기 프로젝트 열기: psecio/propauth 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( PolicySet $policySet = null ) Init the object, possibly with an optional policy set
allows ( string $policyName, object $subject, array $addl = [] ) : boolean Locate a policy by key name and determine if the subject is allowed by matching against its properties
denies ( string $policyName, object $subject, array $addl = [] ) : boolean Locate a policy by name and evaluate if the subject is denied by matching against its properties
evaluate ( object $subject, Policy $policy, array $addl = [] ) : boolean Given a subject and a policy, evaluate the pass/fail result of the matching
executeTests ( array $tests, string $type, string $propertyValue, array $addl ) : boolean Execute the tests on the policy to ensure they match/pass
getPropertyValue ( string $type, object $subject ) : mixed Type a few options to get the property value for evaluation
instance ( PolicySet $policySet = null ) : Enforcer Static method to get a new instance of the Enforcer object
setPolicySet ( PolicySet $policySet ) : Enforcer Set the current policy set (overrides, not appends)

메소드 상세

__construct() 공개 메소드

Init the object, possibly with an optional policy set
public __construct ( PolicySet $policySet = null )
$policySet PolicySet Set of Policy instances [optional]

allows() 공개 메소드

Locate a policy by key name and determine if the subject is allowed by matching against its properties
public allows ( string $policyName, object $subject, array $addl = [] ) : boolean
$policyName string Policy name to evaluate
$subject object Subject to evaluate against
$addl array
리턴 boolean Pass/fail result of evaluation

denies() 공개 메소드

Locate a policy by name and evaluate if the subject is denied by matching against its properties
public denies ( string $policyName, object $subject, array $addl = [] ) : boolean
$policyName string Policy key name
$subject object Subject to evluate against
$addl array
리턴 boolean Pass/fail of evluation

evaluate() 공개 메소드

Given a subject and a policy, evaluate the pass/fail result of the matching
public evaluate ( object $subject, Policy $policy, array $addl = [] ) : boolean
$subject object Subject to match against
$policy Policy Policy to evaluate
$addl array
리턴 boolean Pass/fail status of evaluation

executeTests() 공개 메소드

Execute the tests on the policy to ensure they match/pass
public executeTests ( array $tests, string $type, string $propertyValue, array $addl ) : boolean
$tests array A set of Check instances to evaluate
$type string Type of tests to evaluate with
$propertyValue string Value to evaluate against
$addl array Additional values to pass through to the test
리턴 boolean Pass/fail status of the evaluation (if exception not thrown)

getPropertyValue() 공개 메소드

Type a few options to get the property value for evaluation
public getPropertyValue ( string $type, object $subject ) : mixed
$type string Type of check being performed
$subject object Object to get the property value from
리턴 mixed Either the found property value or null if not found

instance() 공개 정적인 메소드

Static method to get a new instance of the Enforcer object
public static instance ( PolicySet $policySet = null ) : Enforcer
$policySet PolicySet Set of policies [optional]
리턴 Enforcer instance

setPolicySet() 공개 메소드

Set the current policy set (overrides, not appends)
public setPolicySet ( PolicySet $policySet ) : Enforcer
$policySet PolicySet Set of Policy objects
리턴 Enforcer instance