PHP 클래스 Prado\Security\TAuthorizationRule

TAuthorizationRule represents a single authorization rule. A rule is specified by an action (required), a list of users (optional), a list of roles (optional), a verb (optional), and a list of IP rules (optional). Action can be either 'allow' or 'deny'. Guest (anonymous, unauthenticated) users are represented by question mark '?'. All users (including guest users) are represented by asterisk '*'. Authenticated users are represented by '@'. Users/roles are case-insensitive. Different users/roles are separated by comma ','. Verb can be either 'get' or 'post'. If it is absent, it means both. IP rules are separated by comma ',' and can contain wild card in the rules (e.g. '192.132.23.33, 192.122.*.*')
부터: 3.0
저자: Qiang Xue ([email protected])
상속: extends Prado\TComponent
파일 보기 프로젝트 열기: pradosoft/prado

공개 메소드들

메소드 설명
__construct ( $action, $users, $roles, $verb = '', $ipRules = '' ) Constructor.
getAction ( ) : string
getAuthenticatedApplied ( ) : boolean
getEveryoneApplied ( ) : boolean
getGuestApplied ( ) : boolean
getIPRules ( ) : array
getRoles ( ) : array
getUsers ( ) : array
getVerb ( ) : string
isUserAllowed ( Prado\Security\IUser $user, $verb, $ip ) : integer

비공개 메소드들

메소드 설명
isIpMatched ( $ip )
isRoleMatched ( $user )
isUserMatched ( $user )
isVerbMatched ( $verb )

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( $action, $users, $roles, $verb = '', $ipRules = '' )

getAction() 공개 메소드

public getAction ( ) : string
리턴 string action, either 'allow' or 'deny'

getAuthenticatedApplied() 공개 메소드

public getAuthenticatedApplied ( ) : boolean
리턴 boolean if this rule applies to authenticated users

getEveryoneApplied() 공개 메소드

public getEveryoneApplied ( ) : boolean
리턴 boolean if this rule applies to everyone

getGuestApplied() 공개 메소드

public getGuestApplied ( ) : boolean
리턴 boolean if this rule applies to everyone

getIPRules() 공개 메소드

부터: 3.1.1
public getIPRules ( ) : array
리턴 array list of IP rules.

getRoles() 공개 메소드

public getRoles ( ) : array
리턴 array list of roles

getUsers() 공개 메소드

public getUsers ( ) : array
리턴 array list of user IDs

getVerb() 공개 메소드

public getVerb ( ) : string
리턴 string verb, may be empty, 'get', or 'post'.

isUserAllowed() 공개 메소드

public isUserAllowed ( Prado\Security\IUser $user, $verb, $ip ) : integer
$user Prado\Security\IUser
리턴 integer 1 if the user is allowed, -1 if the user is denied, 0 if the rule does not apply to the user