PHP Class AclHelper

Afficher le fichier Open project: croogo/croogo Class Usage Examples

Méthodes publiques

Свойство Type Description
$allowedActions array Cached actions per Role

Protected Properties

Свойство Type Description
$_pathWhitelist Path Whitelist

Méthodes publiques

Méthode Description
__construct ( View $View, $settings = [] ) Constructor
beforeRender ( $viewFile ) beforeRender
getAllowedActionsByRoleId ( integer $roleId ) : array Returns an array of allowed actions for current logged in Role
getAllowedActionsByUserId ( integer $userId ) : array Returns an array of allowed actions for current logged in User
linkIsAllowedByRoleId ( integer $roleId, $url ) : boolean Check if url is allowed for the Role
linkIsAllowedByUserId ( integer $userId, array | string $url ) : boolean Check if url is allowed for the User

Méthodes protégées

Méthode Description
_isWhitelist ( $url ) : boolean Checks whether path is in whitelist

Method Details

__construct() public méthode

Constructor
public __construct ( View $View, $settings = [] )
$View View

_isWhitelist() protected méthode

Checks whether path is in whitelist
protected _isWhitelist ( $url ) : boolean
Résultat boolean True if path is in the whitelist

beforeRender() public méthode

beforeRender
public beforeRender ( $viewFile )

getAllowedActionsByRoleId() public méthode

Returns an array of allowed actions for current logged in Role
public getAllowedActionsByRoleId ( integer $roleId ) : array
$roleId integer Role id
Résultat array

getAllowedActionsByUserId() public méthode

Returns an array of allowed actions for current logged in User
public getAllowedActionsByUserId ( integer $userId ) : array
$userId integer User id
Résultat array

linkIsAllowedByRoleId() public méthode

Check if url is allowed for the Role
public linkIsAllowedByRoleId ( integer $roleId, $url ) : boolean
$roleId integer Role id
$url array
Résultat boolean

linkIsAllowedByUserId() public méthode

Check if url is allowed for the User
public linkIsAllowedByUserId ( integer $userId, array | string $url ) : boolean
$userId integer User Id
$url array | string link/url to check
Résultat boolean

Property Details

$_pathWhitelist protected_oe property

Path Whitelist
protected $_pathWhitelist

$allowedActions public_oe property

Cached actions per Role
public array $allowedActions
Résultat array