PHP 클래스 CakeDC\Users\Auth\SimpleRbacAuthorize

Matches current plugin/controller/action against defined permissions in permissions.php file
상속: extends Cake\Auth\BaseAuthorize, use trait Cake\Log\LogTrait
파일 보기 프로젝트 열기: CakeDC/users 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_defaultConfig
$_defaultPermissions array Default permissions to be loaded if no provided permissions

공개 메소드들

메소드 설명
__construct ( Cake\Controller\ComponentRegistry $registry, array $config = [] ) Autoload permission configuration
authorize ( array $user, Cake\Network\Request $request ) : boolean Match the current plugin/controller/action against loaded permissions Set a default role if no role is provided

보호된 메소드들

메소드 설명
_checkPermissions ( array $user, string $role, Cake\Network\Request $request ) : boolean Match against permissions, return if matched Permissions are processed based on the 'permissions' config values
_loadPermissions ( string $key ) : array Load config and retrieve permissions If the configuration file does not exist, or the permissions key not present, return defaultPermissions To be mocked
_matchOrAsterisk ( string | array $possibleValues, string | mixed | null $value, boolean $allowEmpty = false ) : boolean Check if rule matched or '*' present in rule matching anything
_matchPermission ( array $permission, array $user, string $role, Cake\Network\Request $request ) : null | boolean Match the rule for current permission
_startsWith ( string $haystack, string $needle ) : boolean Checks if $heystack begins with $needle

메소드 상세

__construct() 공개 메소드

Autoload permission configuration
public __construct ( Cake\Controller\ComponentRegistry $registry, array $config = [] )
$registry Cake\Controller\ComponentRegistry component registry
$config array config

_checkPermissions() 보호된 메소드

Match against permissions, return if matched Permissions are processed based on the 'permissions' config values
protected _checkPermissions ( array $user, string $role, Cake\Network\Request $request ) : boolean
$user array current user array
$role string effective role for the current user
$request Cake\Network\Request request
리턴 boolean true if there is a match in permissions

_loadPermissions() 보호된 메소드

Load config and retrieve permissions If the configuration file does not exist, or the permissions key not present, return defaultPermissions To be mocked
protected _loadPermissions ( string $key ) : array
$key string name of the configuration file to read permissions from
리턴 array permissions

_matchOrAsterisk() 보호된 메소드

Check if rule matched or '*' present in rule matching anything
protected _matchOrAsterisk ( string | array $possibleValues, string | mixed | null $value, boolean $allowEmpty = false ) : boolean
$possibleValues string | array Values that are accepted (from permission config)
$value string | mixed | null Value to check with. We'll check the DASHERIZED value too
$allowEmpty boolean If true and $value is null, the rule will pass
리턴 boolean

_matchPermission() 보호된 메소드

Match the rule for current permission
protected _matchPermission ( array $permission, array $user, string $role, Cake\Network\Request $request ) : null | boolean
$permission array The permission configuration
$user array Current user data
$role string Effective user's role
$request Cake\Network\Request Current request
리턴 null | boolean Null if permission is discarded, boolean if a final result is produced

_startsWith() 보호된 메소드

Checks if $heystack begins with $needle
또한 보기: http://stackoverflow.com/a/7168986/2588539
protected _startsWith ( string $haystack, string $needle ) : boolean
$haystack string The whole string
$needle string The beginning to check
리턴 boolean

authorize() 공개 메소드

Match the current plugin/controller/action against loaded permissions Set a default role if no role is provided
public authorize ( array $user, Cake\Network\Request $request ) : boolean
$user array user data
$request Cake\Network\Request request
리턴 boolean

프로퍼티 상세

$_defaultConfig 보호되어 있는 프로퍼티

protected $_defaultConfig

$_defaultPermissions 보호되어 있는 프로퍼티

Default permissions to be loaded if no provided permissions
protected array $_defaultPermissions
리턴 array