PHP Class Scalr_Account_User

See also: Scalr\Model\Entity\Account\User
Deprecation: This class has been deprecated since version 5.4.0. Please use new Scalr\Model\Entity\Account\User entity.
Inheritance: extends Scalr_Model
Show file Open project: scalr/scalr Class Usage Examples

Public Properties

Property Type Description
$accountId
$comments
$dtCreated
$dtLastLogin
$email
$fullname
$loginattempts
$status
$type

Protected Properties

Property Type Description
$account
$dbMessageKeyNotFound
$dbPrimaryKey
$dbPropertyMap
$dbTableName
$password
$permissions
$settingsCache
$varCache

Public Methods

Method Description
addDashboardWidget ( integer $envId, array $widgetConfig, integer $columnNumber, integer $position ) Adds widget to dashboard
applyLdapGroups ( $groups ) Special method for LDAP auth sync LDAP groups to Scalr groups
canEditUser ( Scalr_Account_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 ( Scalr_Account_User $user ) : boolean Checks whether the user is allowed to remove specified user
checkPassword ( string $pwd, boolean $updateLoginAttempt = true ) : boolean Checks password
create ( $email, $accountId )
delete ( $id = null )
getAccount ( ) : Scalr_Account
getAccountId ( )
getAclRoles ( boolean $ignoreCache = false ) : Scalr\Acl\Role\AccountRoleSuperposition Gets account level roles for the user
getAclRolesByEnvironment ( integer $envId, boolean $ignoreCache = false ) : Scalr\Acl\Role\AccountRoleSuperposition Gets roles by specified ID of environment
getAclRolesByTeam ( integer $teamId ) : Scalr\Acl\Role\AccountRoleSuperposition Gets roles by specified ID of team
getDashboard ( integer $envId ) : array Get user dashboard
getDefaultEnvironment ( integer $envId ) : Scalr_Environment Gets environment object for the specified identifier.
getEmail ( ) : string Gets email address of the User
getEnvironments ( string $filter = null, boolean $orderByPriority = false ) : array Gets environments of the current user filtered by name
getGravatarHash ( )
getId ( ) : integer Gets effective user identifier
getLdapUsername ( ) : string Gets LDAP username of the User
getList ( $accountId )
getPermissions ( ) : Scalr_Permissions Gets scalr permission object
getSetting ( string $name, boolean $ignoreCache = false ) : mixed Returns user setting value by name
getSshConsoleSettings ( $ignoreCache = false, $gvi = false, $serverId = null )
getTeams ( ) : array
getType ( )
getUserInfo ( )
getVar ( string $name, boolean $ignoreCache = false ) : mixed Returns user var value by name
init ( $className = null ) : Scalr_Account_User
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
isEmailExists ( $email )
isFinAdmin ( ) : boolean Checks if the user is Financial admin
isInTeam ( integer $teamId ) : boolean Check if user is included in team
isLeadVerified ( ) : boolean
isScalrAdmin ( ) : boolean Checks if the user is Scalr admin
isSubjectLead ( string $projectId = null, string $ccId = null ) : boolean Checks if user has access to project or cost center
isTeamOwner ( integer $teamId = null ) : boolean Checks wheter this user is considered to be the team owner for the specified team.
isTeamOwnerInEnvironment ( integer $envId ) : boolean Checks if the user is both AccountAdmin and member of the specified environment
isTeamUser ( ) : boolean Checks if the user is team user
isUser ( ) : boolean Checks if the user is account user (owner, admin, team user)
loadByApiAccessKey ( string $accessKey ) : Scalr_Account_User Loads user by the specified access key
loadByEmail ( string $email, $accountId = null ) : Scalr_Account_User Loads user by an email
loadBySetting ( string $name, string $value ) : Scalr_Account_User Loads user by the specified unique setting
save ( $forceInsert = false )
setAclRoles ( array $data = [] ) Sets ACL roles to this user
setDashboard ( integer $envId, array $value ) Set user dashboard
setSetting ( string $name, mixed $value ) : void Set user setting
setSshConsoleSettings ( $settings )
setVar ( string $name, mixed $value ) : void Set user var
updateEmail ( $email )
updateLastLogin ( )
updateLoginAttempt ( integer | null $loginattempt = null ) Increases or resets the number of attempts to sign in
updatePassword ( $pwd )

Method Details

addDashboardWidget() public method

Adds widget to dashboard
public addDashboardWidget ( integer $envId, array $widgetConfig, integer $columnNumber, integer $position )
$envId integer The identifier of the environment
$widgetConfig array Widget config
$columnNumber integer optional the number of the column
$position integer optional the position

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 ( Scalr_Account_User $user ) : boolean
$user Scalr_Account_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 ( Scalr_Account_User $user ) : boolean
$user Scalr_Account_User The user to remove
return boolean Returns true if the user is allowed to remove specified user

checkPassword() public method

Checks password
public checkPassword ( string $pwd, boolean $updateLoginAttempt = true ) : boolean
$pwd string A password
$updateLoginAttempt boolean optional Whether it should update the number of attempts
return boolean Returns true if password is valid

create() public method

public create ( $email, $accountId )

delete() public method

See also: Scalr_Model::delete()
public delete ( $id = null )

getAccount() public method

public getAccount ( ) : Scalr_Account
return Scalr_Account

getAccountId() public method

public getAccountId ( )

getAclRoles() public method

Gets account level roles for the user
public getAclRoles ( boolean $ignoreCache = false ) : Scalr\Acl\Role\AccountRoleSuperposition
$ignoreCache boolean
return Scalr\Acl\Role\AccountRoleSuperposition Returns the list of the roles of account level

getAclRolesByEnvironment() public method

Gets roles by specified ID of environment
public getAclRolesByEnvironment ( integer $envId, boolean $ignoreCache = false ) : Scalr\Acl\Role\AccountRoleSuperposition
$envId integer The ID of the client's environment
$ignoreCache boolean optional Ignore cache.
return Scalr\Acl\Role\AccountRoleSuperposition Returns the list of the roles of account level by specified environment

getAclRolesByTeam() public method

Gets roles by specified ID of team
public getAclRolesByTeam ( integer $teamId ) : Scalr\Acl\Role\AccountRoleSuperposition
$teamId integer The ID of the team
return Scalr\Acl\Role\AccountRoleSuperposition Returns the list of the roles of account level by specified team

getDashboard() public method

Get user dashboard
public getDashboard ( integer $envId ) : array
$envId integer
return array

getDefaultEnvironment() public method

In case the identifier is not specified it takes default Environment from the list of the available for current User.
public getDefaultEnvironment ( integer $envId ) : Scalr_Environment
$envId integer optional The identifier of the Environment
return Scalr_Environment Returns Environment object

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, boolean $orderByPriority = false ) : array
$filter string optional Filter string
$orderByPriority boolean optional Order by default_priority
return array

getGravatarHash() public method

public getGravatarHash ( )

getId() public method

Gets effective user identifier
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 user LDAP username

getList() public static method

public static getList ( $accountId )

getPermissions() public method

Gets scalr permission object
public getPermissions ( ) : Scalr_Permissions
return Scalr_Permissions

getSetting() public method

Returns user setting value by name
public getSetting ( string $name, boolean $ignoreCache = false ) : mixed
$name string
$ignoreCache boolean
return mixed $value

getSshConsoleSettings() public method

public getSshConsoleSettings ( $ignoreCache = false, $gvi = false, $serverId = null )

getTeams() public method

public getTeams ( ) : array
return array

getType() public method

public getType ( )

getUserInfo() public method

public getUserInfo ( )

getVar() public method

Returns user var value by name
public getVar ( string $name, boolean $ignoreCache = false ) : mixed
$name string
$ignoreCache boolean
return mixed $value

init() public static method

public static init ( $className = null ) : Scalr_Account_User
return Scalr_Account_User

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

isEmailExists() public method

public isEmailExists ( $email )

isFinAdmin() public method

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

isInTeam() public method

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

isLeadVerified() public method

public isLeadVerified ( ) : boolean
return boolean Returns true if lead is verified

isScalrAdmin() public method

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

isSubjectLead() public method

Checks if user has access to project or cost center
public isSubjectLead ( string $projectId = null, string $ccId = null ) : boolean
$projectId string optional Id of the project
$ccId string optional Id of the cost center
return boolean Returns false if user is not lead of the subject

isTeamOwner() public method

Checks wheter this user is considered to be the team owner for the specified team.
Deprecation: This function has been deprecated since new ACL
public isTeamOwner ( integer $teamId = null ) : boolean
$teamId integer The identifier of the team.
return boolean Returns true if the user is considered to be the team owner for the specified team.

isTeamOwnerInEnvironment() public method

Checks if the user is both AccountAdmin and member of the specified environment
Deprecation: This function has been deprecated since new ACL
public isTeamOwnerInEnvironment ( integer $envId ) : boolean
$envId integer The identifier of the environment
return boolean

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

loadByApiAccessKey() public method

Loads user by the specified access key
public loadByApiAccessKey ( string $accessKey ) : Scalr_Account_User
$accessKey string An access key
return Scalr_Account_User

loadByEmail() public method

Loads user by an email
public loadByEmail ( string $email, $accountId = null ) : Scalr_Account_User
$email string The email of the user
return Scalr_Account_User

loadBySetting() public method

Loads user by the specified unique setting
public loadBySetting ( string $name, string $value ) : Scalr_Account_User
$name string The setting name
$value string The value
return Scalr_Account_User

save() public method

See also: Scalr_Model::save()
public save ( $forceInsert = false )

setAclRoles() public method

This method modifies resords of two tables account_team_users and account_team_user_acls. Attention! It expects full list of the ACL roles relations for user. All missing relations will be removed.
public setAclRoles ( array $data = [] )
$data array ACL roles array which looks like array(teamId => array(accountRoleId1, accountRoleId2, ...))

setDashboard() public method

Set user dashboard
public setDashboard ( integer $envId, array $value )
$envId integer
$value array

setSetting() public method

Set user setting
public setSetting ( string $name, mixed $value ) : void
$name string
$value mixed
return void

setSshConsoleSettings() public method

public setSshConsoleSettings ( $settings )

setVar() public method

Set user var
public setVar ( string $name, mixed $value ) : void
$name string
$value mixed
return void

updateEmail() public method

public updateEmail ( $email )

updateLastLogin() public method

public updateLastLogin ( )

updateLoginAttempt() public method

Increases or resets the number of attempts to sign in
public updateLoginAttempt ( integer | null $loginattempt = null )
$loginattempt integer | null optional The number to increase

updatePassword() public method

public updatePassword ( $pwd )

Property Details

$account protected property

protected $account

$accountId public property

public $accountId

$comments public property

public $comments

$dbMessageKeyNotFound protected property

protected $dbMessageKeyNotFound

$dbPrimaryKey protected property

protected $dbPrimaryKey

$dbPropertyMap protected property

protected $dbPropertyMap

$dbTableName protected property

protected $dbTableName

$dtCreated public property

public $dtCreated

$dtLastLogin public property

public $dtLastLogin

$email public property

public $email

$fullname public property

public $fullname

$loginattempts public property

public $loginattempts

$password protected property

protected $password

$permissions protected property

protected $permissions

$settingsCache protected property

protected $settingsCache

$status public property

public $status

$type public property

public $type

$varCache protected property

protected $varCache