PHP Trait Airship\Engine\Bolt\Security

Common security features. Mostly access controls.
Show file Open project: paragonie/airship

Public Properties

Property Type Description
$airship_auth Authentication
$airship_perms Permissions

Public Methods

Method Description
can ( string $action, string $context = '', string $cabin = '', integer $userID ) : boolean Perform a permissions check
completeLogOut ( ) : boolean Completely wipe all authentication mechanisms (Session, Cookie)
getActiveUserId ( ) : integer Get the current user ID. Throws a UserNotLoggedIn exception if you aren't logged in.
isLoggedIn ( ) : boolean Are we logged in to a user account?
isSuperUser ( integer $userId ) : boolean Are we currently logged in as an admin?
tightenSecurityBolt ( ) After loading the Security bolt in place, configure it.
verifySessionCanary ( integer $userID, boolean $logOut = true ) : boolean If another session triggered a password reset, we should be logged out as per the Bridge configuration. (This /is/ an optional feature.)

Protected Methods

Method Description
doAutoLogin ( string $token, string $uid_idx, string $token_idx ) : boolean Let's do an automatic login

Method Details

can() public method

Perform a permissions check
public can ( string $action, string $context = '', string $cabin = '', integer $userID ) : boolean
$action string action label (e.g. 'read')
$context string context regex (in perm_contexts)
$cabin string (defaults to current cabin)
$userID integer (defaults to current user)
return boolean

completeLogOut() public method

Completely wipe all authentication mechanisms (Session, Cookie)
public completeLogOut ( ) : boolean
return boolean

doAutoLogin() protected method

Let's do an automatic login
protected doAutoLogin ( string $token, string $uid_idx, string $token_idx ) : boolean
$token string
$uid_idx string
$token_idx string
return boolean

getActiveUserId() public method

Get the current user ID. Throws a UserNotLoggedIn exception if you aren't logged in.
public getActiveUserId ( ) : integer
return integer

isLoggedIn() public method

Are we logged in to a user account?
public isLoggedIn ( ) : boolean
return boolean

isSuperUser() public method

Are we currently logged in as an admin?
public isSuperUser ( integer $userId ) : boolean
$userId integer (defaults to current user)
return boolean

tightenSecurityBolt() public method

After loading the Security bolt in place, configure it.
public tightenSecurityBolt ( )

verifySessionCanary() public method

If another session triggered a password reset, we should be logged out as per the Bridge configuration. (This /is/ an optional feature.)
public verifySessionCanary ( integer $userID, boolean $logOut = true ) : boolean
$userID integer
$logOut boolean
return boolean

Property Details

$airship_auth public property

public Authentication $airship_auth
return Authentication

$airship_perms public property

public Permissions $airship_perms
return Permissions