PHP Class UserType

Inheritance: extends Eloquent
Show file Open project: sourcefabric/newscoop Class Usage Examples

Public Properties

Property Type Description
$m_columnNames
$m_config
$m_dbTableName
$m_exists
$m_keyColumnNames
$m_keyIsAutoIncrement

Public Methods

Method Description
GetByName ( $p_name ) : mixed Get the user type that matches the given name.
GetUserTypeFromConfig ( $p_configVars ) : mixed Get the user type that matches the given config variables.
GetUserTypes ( ) : array Get all the user types with the exception of those with the Reader permission.
UserType ( $p_userTypeId = null ) : void Constructor
create ( $p_name = null, $p_configVars = [] ) : boolean Create the new UserType with the config variables given.
delete ( ) : boolean Delete the user type.
exists ( ) : boolean Whether the user type exists or not
getConfig ( ) : array Return an array of config values in the form array("varname" => "value");
getId ( ) : integer Get the id of this user type.
getName ( ) : string Get the name of this user type.
getValue ( string $p_varName ) : mixed Return the value of the given variable name.
hasPermission ( string $p_permissionString ) : boolean Return true if the user type has the permission specified.
setPermission ( $p_permissionString, $p_permissionValue ) Set the specified permission.
setValue ( string $p_varName, mixed $p_value ) : void Set the default config value for the given variable.

Method Details

GetByName() public static method

Get the user type that matches the given name.
public static GetByName ( $p_name ) : mixed
$p_name The name of the user type
return mixed null If the user type does not exists or any error UserType object

GetUserTypeFromConfig() public static method

Get the user type that matches the given config variables.
public static GetUserTypeFromConfig ( $p_configVars ) : mixed
$p_configVars An array of permissions variables
return mixed bool False The config passed does not match any user type object $userType The user type object matching

GetUserTypes() public static method

Get all the user types with the exception of those with the Reader permission.
public static GetUserTypes ( ) : array
return array An array of UserType objects.

UserType() public method

Constructor
public UserType ( $p_userTypeId = null ) : void
$p_userTypeId (optional) The user type identifier
return void

create() public method

If a config variable is not set, the default value will be used.
public create ( $p_name = null, $p_configVars = [] ) : boolean
$p_configVars The privileges list to be granted
return boolean TRUE on success, FALSE on failure

delete() public method

Delete the user type.
public delete ( ) : boolean
return boolean TRUE on success, FALSE on failure

exists() public method

Whether the user type exists or not
public exists ( ) : boolean
return boolean $this->m_exists TRUE on success, FALSE on failure

getConfig() public method

Return an array of config values in the form array("varname" => "value");
public getConfig ( ) : array
return array

getId() public method

Get the id of this user type.
public getId ( ) : integer
return integer

getName() public method

Get the name of this user type.
public getName ( ) : string
return string

getValue() public method

If the variable name does not exist, return null.
public getValue ( string $p_varName ) : mixed
$p_varName string
return mixed

hasPermission() public method

Return true if the user type has the permission specified.
public hasPermission ( string $p_permissionString ) : boolean
$p_permissionString string
return boolean

setPermission() public method

Set the specified permission.
public setPermission ( $p_permissionString, $p_permissionValue )
$p_permissionString
$p_permissionValue

setValue() public method

This creates the new config variable if it didn't exist.
public setValue ( string $p_varName, mixed $p_value ) : void
$p_varName string
$p_value mixed
return void

Property Details

$m_columnNames public property

public $m_columnNames

$m_config public property

public $m_config

$m_dbTableName public property

public $m_dbTableName

$m_exists public property

public $m_exists

$m_keyColumnNames public property

public $m_keyColumnNames

$m_keyIsAutoIncrement public property

public $m_keyIsAutoIncrement