PHP Class Scalr\Model\Entity\Account\User

Since: 5.4.0 (21.02.2015)
Author: Vitaliy Demidov ([email protected])
Inheritance: extends Scalr\Model\AbstractEntity
Show file Open project: scalr/scalr Class Usage Examples

Public Properties

Property Type Description
$accountId integer Identifier of the account which User corresponds to
$comments string The comments
$created DateTime The timestamp when the record is created
$email string The email address of the user
$fullName string The full name of the User
$id integer The identifier of the User
$lastLogin DateTime The last timemestamp when the User signed in
$loginAttempts integer The number of failed sign-in attempts
$password string The password
$status string The status of the User
$type string The type

Public Methods

Method Description
__construct ( ) Constructor
applyLdapGroups ( $groups ) Special method for LDAP auth sync LDAP groups to Scalr groups
canEditUser ( User $user ) : boolean Checks whether the user is allowed to edit specified user
canManageAcl ( ) : boolean Checks whether the user is allowed to manage ACL
canRemoveUser ( User $user ) : boolean Checks whether the user is allowed to remove specified user
fetchSettings ( ) : array Fetches all settings from the database
getAccount ( ) : Client Gets account entity
getAccountId ( ) : integer Gets Identifier of the Account
getAclRoles ( boolean $ignoreCache = false ) : Scalr\Acl\Role\AccountRoleSuperposition Gets account level roles
getAclRolesByEnvironment ( integer $envId, boolean $ignoreCache = false ) : Scalr\Acl\Role\AccountRoleSuperposition Gets roles by specified identifier of the Environment
getEmail ( ) : string Gets email address of the User
getEnvironments ( string $filter = null ) : array Gets environments of the current user filtered by name
getId ( ) : integer Gets Identifier of the User
getLdapUsername ( ) : string Gets LDAP username of the User
getSetting ( string $name, boolean $useCache = true ) : string | null Gets specified setting
getTeams ( ) : array Gets user teams
hasAccessToEnvironment ( integer $envId ) : boolean Checks whether this user has access to the specified environment
inTeam ( integer $teamId ) : boolean Check if user is included in team
isAccountAdmin ( ) : boolean Checks if the user is account admin
isAccountOwner ( ) : boolean Checks if the user is account owher
isAccountSuperAdmin ( ) : boolean Checks if the user is account admin
isAdmin ( ) : boolean Checks if the user is admin user (scalr, financial). It means user doesn't have current environment
isFinAdmin ( ) : boolean Checks if the user is Financial admin
isScalrAdmin ( ) : boolean Checks if the user is Scalr admin
isTeamUser ( ) : boolean Checks if the user is team user
isUser ( ) : boolean Checks if the user is account user (owner, admin, team user)
saveSetting ( string $name, string $value ) : User Saves the value of the specified setting to the database
setSetting ( string $name, string $value ) : User Sets the value of the specified setting

Method Details

__construct() public method

Constructor
public __construct ( )

applyLdapGroups() public method

Special method for LDAP auth sync LDAP groups to Scalr groups
public applyLdapGroups ( $groups )
$groups

canEditUser() public method

Checks whether the user is allowed to edit specified user
public canEditUser ( User $user ) : boolean
$user User The user to edit
return boolean Returns true if the user is allowed to edit specified user

canManageAcl() public method

Checks whether the user is allowed to manage ACL
public canManageAcl ( ) : boolean
return boolean Returns true if user is allowed to manage ACL

canRemoveUser() public method

Checks whether the user is allowed to remove specified user
public canRemoveUser ( User $user ) : boolean
$user User The user to remove
return boolean Returns true if the user is allowed to remove specified user

fetchSettings() public method

Fetches all settings from the database
public fetchSettings ( ) : array
return array Returns all settings

getAccount() public method

Gets account entity
public getAccount ( ) : Client
return Scalr\Model\Entity\Client

getAccountId() public method

Gets Identifier of the Account
public getAccountId ( ) : integer
return integer Returns identifier of the Account

getAclRoles() public method

Gets account level roles
public getAclRoles ( boolean $ignoreCache = false ) : Scalr\Acl\Role\AccountRoleSuperposition
$ignoreCache boolean Whether it shoud ignore cache
return Scalr\Acl\Role\AccountRoleSuperposition Returns the list of the roles of account level

getAclRolesByEnvironment() public method

Gets roles by specified identifier of the Environment
public getAclRolesByEnvironment ( integer $envId, boolean $ignoreCache = false ) : Scalr\Acl\Role\AccountRoleSuperposition
$envId integer The identifier of the Environment
$ignoreCache boolean optional Whether it should ignore cache
return Scalr\Acl\Role\AccountRoleSuperposition Returns the list of the roles of account level by specified environment

getEmail() public method

Gets email address of the User
public getEmail ( ) : string
return string Returns user email address

getEnvironments() public method

Gets environments of the current user filtered by name
public getEnvironments ( string $filter = null ) : array
$filter string optional Filter string
return array

getId() public method

Gets Identifier of the User
public getId ( ) : integer
return integer Returns identifier of the User

getLdapUsername() public method

Gets LDAP username of the User
public getLdapUsername ( ) : string
return string Returns LDAP username

getSetting() public method

Gets specified setting
public getSetting ( string $name, boolean $useCache = true ) : string | null
$name string The name of the setting
$useCache boolean optional Whether it should use cache
return string | null Returns the value on success or NULL if it does not exist.

getTeams() public method

Gets user teams
public getTeams ( ) : array
return array

hasAccessToEnvironment() public method

Checks whether this user has access to the specified environment
public hasAccessToEnvironment ( integer $envId ) : boolean
$envId integer The identifier of the environment
return boolean Returns TRUE if the user has access to the specified environment

inTeam() public method

Check if user is included in team
public inTeam ( integer $teamId ) : boolean
$teamId integer
return boolean

isAccountAdmin() public method

Checks if the user is account admin
public isAccountAdmin ( ) : boolean
return boolean Returns true if user is account admin

isAccountOwner() public method

Checks if the user is account owher
public isAccountOwner ( ) : boolean
return boolean Returns true if user is account owner.

isAccountSuperAdmin() public method

Checks if the user is account admin
public isAccountSuperAdmin ( ) : boolean
return boolean Returns true if user is account super admin

isAdmin() public method

Checks if the user is admin user (scalr, financial). It means user doesn't have current environment
public isAdmin ( ) : boolean
return boolean

isFinAdmin() public method

Checks if the user is Financial admin
public isFinAdmin ( ) : boolean
return boolean Returns true if user is Financial Admin

isScalrAdmin() public method

Checks if the user is Scalr admin
public isScalrAdmin ( ) : boolean
return boolean Returns true if user is Scalr Admin

isTeamUser() public method

Checks if the user is team user
public isTeamUser ( ) : boolean
return boolean Returns true if user is team user

isUser() public method

Checks if the user is account user (owner, admin, team user)
public isUser ( ) : boolean
return boolean

saveSetting() public method

Saves the value of the specified setting to the database
public saveSetting ( string $name, string $value ) : User
$name string The name of the setting
$value string The value
return User

setSetting() public method

Sets the value of the specified setting
public setSetting ( string $name, string $value ) : User
$name string The name of the setting
$value string The value
return User

Property Details

$accountId public property

Identifier of the account which User corresponds to
public int $accountId
return integer

$comments public property

The comments
public string $comments
return string

$created public property

The timestamp when the record is created
public DateTime $created
return DateTime

$email public property

The email address of the user
public string $email
return string

$fullName public property

The full name of the User
public string $fullName
return string

$id public property

The identifier of the User
public int $id
return integer

$lastLogin public property

The last timemestamp when the User signed in
public DateTime $lastLogin
return DateTime

$loginAttempts public property

The number of failed sign-in attempts
public int $loginAttempts
return integer

$password public property

The password
public string $password
return string

$status public property

The status of the User
public string $status
return string

$type public property

The type
public string $type
return string