PHP Class Scalr_Session

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

Méthodes publiques

Méthode Description
__call ( string $name, array $params ) : string | Scalr_Session This method is used to provide getters and setters for the session vars
create ( integer $userId, integer $ruid = null ) Creates a session
destroy ( ) Destroy session (including cookies). If session was created by admin, who logged into user (cookie auth is not equal to session auth), then destroy only session and re-create from cookie
getInstance ( boolean $isAutomaticRequest = false ) : Scalr_Session
getRealUserId ( ) : integer Gets real user identifier which is used to sign in to Scalr
getUserId ( ) : integer Gets effective user identifier
isAuthenticated ( )
isCookieKeepSession ( ) : boolean Check if cookies is valid and isn't expired
isVirtual ( ) : boolean Checks whether the session is created by Scalr Admin
keepSession ( ) Set special cookies. We could re-create session based on that cookies.
sessionLog ( $log )

Méthodes protégées

Méthode Description
createCookieHash ( integer $userId, integer $expire, string $sault, string $hash ) : string
createHash ( $userId, $sault ) : string
getAccountHash ( integer $userId ) : string Return account's hash. It's used for reseting keepSession on a whole account
getUserHash ( integer $userId ) : string Return user's hash (id:email:password)
restore ( boolean $checkKeepSessionCookie = true, boolean $isAutomaticRequest = false ) Check if session is valid and is not expired. If no valid session, check cookie keepSession.

Private Methods

Méthode Description
getReflectionClass ( ) : ReflectionClass Gets a reflection class
startSession ( ) Starts session suppressing warnings and notices

Method Details

__call() public méthode

This method is used to provide getters and setters for the session vars
public __call ( string $name, array $params ) : string | Scalr_Session
$name string
$params array
Résultat string | Scalr_Session

create() public static méthode

Creates a session
public static create ( integer $userId, integer $ruid = null )
$userId integer The effective identifier of the user
$ruid integer optional Real user identifier which is used to sign in to Scalr (Admin UserId)

createCookieHash() protected static méthode

protected static createCookieHash ( integer $userId, integer $expire, string $sault, string $hash ) : string
$userId integer ID of user
$expire integer Timestamp when cookie will be expired
$sault string
$hash string
Résultat string

createHash() protected static méthode

protected static createHash ( $userId, $sault ) : string
$userId
$sault
Résultat string

destroy() public static méthode

Destroy session (including cookies). If session was created by admin, who logged into user (cookie auth is not equal to session auth), then destroy only session and re-create from cookie
public static destroy ( )

getAccountHash() protected static méthode

Return account's hash. It's used for reseting keepSession on a whole account
protected static getAccountHash ( integer $userId ) : string
$userId integer
Résultat string

getInstance() public static méthode

public static getInstance ( boolean $isAutomaticRequest = false ) : Scalr_Session
$isAutomaticRequest boolean
Résultat Scalr_Session

getRealUserId() public méthode

Gets real user identifier which is used to sign in to Scalr
public getRealUserId ( ) : integer
Résultat integer Returns real user identifier which is used to sign in to Scalr

getUserHash() protected static méthode

Return user's hash (id:email:password)
protected static getUserHash ( integer $userId ) : string
$userId integer
Résultat string

getUserId() public méthode

Gets effective user identifier
public getUserId ( ) : integer
Résultat integer Returns effective user identifier

isAuthenticated() public méthode

public isAuthenticated ( )

isCookieKeepSession() public static méthode

Check if cookies is valid and isn't expired
public static isCookieKeepSession ( ) : boolean
Résultat boolean

isVirtual() public méthode

Checks whether the session is created by Scalr Admin
public isVirtual ( ) : boolean
Résultat boolean Returns true if the session is created by Scalr Admin

keepSession() public static méthode

Set special cookies. We could re-create session based on that cookies.
public static keepSession ( )

restore() protected static méthode

Check if session is valid and is not expired. If no valid session, check cookie keepSession.
protected static restore ( boolean $checkKeepSessionCookie = true, boolean $isAutomaticRequest = false )
$checkKeepSessionCookie boolean If true check cookie keepSession
$isAutomaticRequest boolean If true don't update sessionLastTime

sessionLog() public static méthode

public static sessionLog ( $log )