rex_user
in package
Uses
rex_instance_pool_trait
Class for users.
Tags
Table of Contents
Properties
- $role : rex_user_role_interface|null
- User role instance.
- $roleClass : rex_user_role_interface>
- Class name for user roles.
- $sql : rex_sql
- SQL instance.
Methods
- __construct() : mixed
- clearInstance() : void
- Removes the instance of the given key.
- clearInstancePool() : void
- Clears the instance pool.
- forLogin() : self|null
- fromSql() : self
- get() : self|null
- getComplexPerm() : rex_complex_perm|null
- Returns the complex perm for the user.
- getEmail() : string
- Returns the email.
- getId() : int
- Returns the ID.
- getLanguage() : string
- Returns the language.
- getLogin() : string
- Returns the user login.
- getName() : string
- Returns the name.
- getStartPage() : string
- Returns the start page.
- getValue() : string
- Returns the value for the given key.
- hasPerm() : bool
- Returns if the user has the given permission.
- hasRole() : bool
- Returns if the user has a role.
- isAdmin() : bool
- Returns if the user is an admin.
- require() : self
- setRoleClass() : void
- Sets the role class.
- addInstance() : void
- Adds an instance.
- getInstance() : static|null
- Returns the instance for the given key.
- hasInstance() : bool
- Checks whether an instance exists for the given key.
Properties
$role
User role instance.
protected
rex_user_role_interface|null
$role
$roleClass
Class name for user roles.
protected
static rex_user_role_interface>
$roleClass
$sql
SQL instance.
protected
rex_sql
$sql
Methods
__construct()
public
__construct(rex_sql $sql) : mixed
Parameters
- $sql : rex_sql
clearInstance()
Removes the instance of the given key.
public
static clearInstance(mixed $key) : void
Parameters
- $key : mixed
-
Key
clearInstancePool()
Clears the instance pool.
public
static clearInstancePool() : void
forLogin()
public
static forLogin(string $login) : self|null
Parameters
- $login : string
Return values
self|nullfromSql()
public
static fromSql(rex_sql $sql) : self
Parameters
- $sql : rex_sql
Return values
selfget()
public
static get(int $id) : self|null
Parameters
- $id : int
Return values
self|nullgetComplexPerm()
Returns the complex perm for the user.
public
getComplexPerm(string $key) : rex_complex_perm|null
Parameters
- $key : string
-
Complex perm key
Tags
Return values
rex_complex_perm|null —Complex perm
getEmail()
Returns the email.
public
getEmail() : string
Return values
string —getId()
Returns the ID.
public
getId() : int
Return values
intgetLanguage()
Returns the language.
public
getLanguage() : string
Return values
string —Language
getLogin()
Returns the user login.
public
getLogin() : string
Return values
string —Login
getName()
Returns the name.
public
getName() : string
Return values
string —Name
getStartPage()
Returns the start page.
public
getStartPage() : string
Return values
string —Start page
getValue()
Returns the value for the given key.
public
getValue(string $key) : string
Parameters
- $key : string
-
Key
Return values
string —value
hasPerm()
Returns if the user has the given permission.
public
hasPerm(string $perm) : bool
Parameters
- $perm : string
-
Perm key
Return values
boolhasRole()
Returns if the user has a role.
public
hasRole() : bool
Return values
boolisAdmin()
Returns if the user is an admin.
public
isAdmin() : bool
Return values
boolrequire()
public
static require(int $id) : self
Parameters
- $id : int
Return values
selfsetRoleClass()
Sets the role class.
public
static setRoleClass(rex_user_role_interface> $class) : void
Parameters
- $class : rex_user_role_interface>
-
Class name
addInstance()
Adds an instance.
protected
static addInstance(mixed $key, self $instance) : void
Parameters
- $key : mixed
-
Key
- $instance : self
-
Instance
getInstance()
Returns the instance for the given key.
protected
static getInstance(mixed $key[, callable $createCallback = null ]) : static|null
If the instance does not exist it will be created by calling the $createCallback
Parameters
- $key : mixed
-
Key
- $createCallback : callable = null
-
Callback, will be called to create a new instance
Tags
Return values
static|nullhasInstance()
Checks whether an instance exists for the given key.
protected
static hasInstance(mixed $key) : bool
Parameters
- $key : mixed
-
Key