PHP Class AclHelper

Datei anzeigen Open project: croogo/croogo Class Usage Examples

Public Properties

Property Type Description
$allowedActions array Cached actions per Role

Protected Properties

Property Type Description
$_pathWhitelist Path Whitelist

Public Methods

Method 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

Protected Methods

Method Description
_isWhitelist ( $url ) : boolean Checks whether path is in whitelist

Method Details

__construct() public method

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

_isWhitelist() protected method

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

beforeRender() public method

beforeRender
public beforeRender ( $viewFile )

getAllowedActionsByRoleId() public method

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

getAllowedActionsByUserId() public method

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

linkIsAllowedByRoleId() public method

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

linkIsAllowedByUserId() public method

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
return boolean

Property Details

$_pathWhitelist protected_oe property

Path Whitelist
protected $_pathWhitelist

$allowedActions public_oe property

Cached actions per Role
public array $allowedActions
return array