Свойство | Тип | Описание | |
---|---|---|---|
$_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 |
public __construct ( Cake\Controller\ComponentRegistry $registry, array $config = [] ) | ||
$registry | Cake\Controller\ComponentRegistry | component registry |
$config | array | config |
protected _loadPermissions ( string $key ) : array | ||
$key | string | name of the configuration file to read permissions from |
Результат | array | permissions |
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 |
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 |
protected array $_defaultPermissions | ||
Результат | array |