프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$User | A User object containing properties relevant to session | ||
$UserID | Unique user identifier. |
프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$_Attributes | Attributes of the current user. | ||
$_Preferences | Preferences of the current user. | ||
$_TransientKey | The current user's transient key. |
메소드 | 설명 | |
---|---|---|
__construct ( ) | Private constructor prevents direct instantiation of object | |
addPermissions ( array $perms ) | Add the permissions from a permissions array to this session's permissions. | |
checkPermission ( string | array $permission, boolean $fullMatch = true, string $junctionTable = '', integer | string $junctionID = '' ) : boolean | Checks the currently authenticated user's permissions for the specified permission. | |
checkRankedPermission ( boolean | string $permission ) : boolean | Check the given permission, but also return true if the user has a higher permission. | |
end ( Gdn_Authenticator $Authenticator = null ) | End a session | |
ensureTransientKey ( ) : boolean | object | string | ||
getAttribute ( unknown_type $AttributeName, string $DefaultValue = false ) : mixed | Gets the currently authenticated user's attribute for the specified $AttributeName. | |
getAttributes ( ) : array | ||
getCookie ( $Suffix, null $Default = null ) : mixed | ||
getInstance ( ) : Session | This is the singleton method that return the static Configuration::Instance. | |
getPermissions ( ) : array | Returns all "allowed" permissions for the authenticated user in a one-dimensional array of permission names. | |
getPermissionsArray ( ) : array | Returns all "allowed" permissions for the authenticated user in a one-dimensional array of permission names. | |
getPreference ( string $PreferenceName, mixed $DefaultValue = false ) : mixed | Gets the currently authenticated user's preference for the specified $PreferenceName. | |
getPublicStash ( string $name, boolean $unset = false ) : mixed | Get a public stash value. | |
getTimeZone ( ) : DateTimeZone | Return the time zone for the current user. | |
hourOffset ( ) : integer | Return the timezone hour difference between the user and utc. | |
isValid ( ) : boolean | Ensure that there is an active session. | |
newVisit ( ) : boolean | ||
setAttribute ( string | array $Name, mixed $Value = '' ) | Sets a value in the $this->_Attributes array. This setting will persist only to the end of the page load. It is not intended for making permanent changes to user attributes. | |
setCookie ( $Suffix, $Value, $Expires ) | ||
setPermission ( string | array $PermissionName, null | boolean $Value = null ) : null | Set a permission for the current runtime. | |
setPreference ( string | array $Name, mixed $Value = '', $SaveToDatabase = true ) | Sets a value in the $this->_Preferences array. This setting will persist changes to user prefs. | |
setPublicStash ( string $name, mixed $value ) : Gdn_Session | Sets a public stash value. | |
start ( integer $UserID = false, boolean $SetIdentity = true, boolean $Persist = false ) | Authenticates the user with the provided Authenticator class. | |
stash ( string $name = '', mixed $value = '', boolean $unsetOnRetrieve = true ) : mixed | Place a name/value pair into the user's session stash. | |
transientKey ( $NewKey = null ) : string | Returns the transient key for the authenticated user. | |
validateTransientKey ( string $ForeignKey, $ValidateUser = true ) : boolean | Validates that $ForeignKey was generated by the current user. |
메소드 | 설명 | |
---|---|---|
getStashSession ( Gdn_SQLDriver $sql, string $valueToStash ) : boolean | Gdn_DataSet | Used by $this->stash() to create & manage sessions for users & guests. |
public __construct ( ) |
public addPermissions ( array $perms ) | ||
$perms | array | The permissions to add. |
public checkPermission ( string | array $permission, boolean $fullMatch = true, string $junctionTable = '', integer | string $junctionID = '' ) : boolean | ||
$permission | string | array | The permission (or array of permissions) to check. |
$fullMatch | boolean | If $Permission is an array, $FullMatch indicates if all permissions specified are required. If false, the user only needs one of the specified permissions. |
$junctionTable | string | The name of the junction table for a junction permission. |
$junctionID | integer | string | The JunctionID associated with $Permission (ie. A discussion category identifier). |
리턴 | boolean | Returns **true** if the user has permission or **false** otherwise. |
public end ( Gdn_Authenticator $Authenticator = null ) | ||
$Authenticator | Gdn_Authenticator |
public getAttribute ( unknown_type $AttributeName, string $DefaultValue = false ) : mixed | ||
$AttributeName | unknown_type | The name of the attribute to get. |
$DefaultValue | string | The default value to return if the attribute does not exist. |
리턴 | mixed |
public static getInstance ( ) : Session | ||
리턴 | Session |
public getPermissions ( ) : array | ||
리턴 | array |
public getPermissionsArray ( ) : array | ||
리턴 | array |
public getTimeZone ( ) : DateTimeZone | ||
리턴 | DateTimeZone | Returns the current timezone. |
public hourOffset ( ) : integer | ||
리턴 | integer | The hour offset. |
public setPublicStash ( string $name, mixed $value ) : Gdn_Session | ||
$name | string | The key of the stash value. |
$value | mixed | The value of the stash to set. Pass null to clear the key. |
리턴 | Gdn_Session | $this Returns $this for chaining. |
public start ( integer $UserID = false, boolean $SetIdentity = true, boolean $Persist = false ) | ||
$UserID | integer | The UserID to start the session with. |
$SetIdentity | boolean | Whether or not to set the identity (cookie) or make this a one request session. |
$Persist | boolean | If setting an identity, should we persist it beyond browser restart? |
public stash ( string $name = '', mixed $value = '', boolean $unsetOnRetrieve = true ) : mixed | ||
$name | string | The key of the stash value. |
$value | mixed | The value of the stash to set. Pass null to retrieve the key. |
$unsetOnRetrieve | boolean | Whether or not to unset the key from stash. |
리턴 | mixed | Returns the value of the stash or null on failure. |
public transientKey ( $NewKey = null ) : string | ||
리턴 | string |
public validateTransientKey ( string $ForeignKey, $ValidateUser = true ) : boolean | ||
$ForeignKey | string | The key to validate. |
리턴 | boolean |