NOT_LOGGED
NOT_LOGGED
The abstract user class
The user class represents an user known by the current website as a permanent entity. This class is commonly inherited by a user class for registered users. But an user can be a Facebook user or a Site user for example.
Require core plugin
getEntityObject(string $objType, string $objID = null) : \Orpheus\EntityDescriptor\PermanentEntity
Get entity instance by type and id
string | $objType | |
string | $objID |
getEntityWhereclause(string $prefix = '') : string
Helper method to get whereclause string from an entity
string | $prefix | The prefix for fields, e.g "table." (with dot) |
Helper method to get whereclause string from an entity. The related entity should have entity_type and entity_id fields.
getField(string $field) : \Orpheus\EntityDescriptor\FieldDescriptor
Get field descriptor from field name
string | $field |
update(array $input, array<mixed,string> $fields, boolean $noEmptyWarning = true, \Orpheus\Publisher\PermanentObject\&int $errCount, \Orpheus\Publisher\PermanentObject\&int $successCount) : \Orpheus\Publisher\PermanentObject\1
Update this permanent object from input data array
array | $input | The input data we will check and extract, used by children |
array<mixed,string> | $fields | The array of fields to check |
boolean | $noEmptyWarning | True to do not report warning for empty data (instead return 0). Default value is true. |
\Orpheus\Publisher\PermanentObject\&int | $errCount | Output parameter for the number of occurred errors validating fields. |
\Orpheus\Publisher\PermanentObject\&int | $successCount | Output parameter for the number of successes updating fields. |
in case of success, else 0.
getUpdateOperation(array $input, array<mixed,string> $fields) : \Orpheus\Publisher\Transaction\UpdateTransactionOperation
Get the update operation
array | $input | The input data we will check and extract, used by children |
array<mixed,string> | $fields | The array of fields to check |
extractUpdateQuery(array $input, \Orpheus\Publisher\PermanentObject\PermanentObject $object) : array
Extract an update query from this object
array | $input | |
\Orpheus\Publisher\PermanentObject\PermanentObject | $object |
getDeleteOperation() : \Orpheus\Publisher\Transaction\DeleteTransactionOperation
Get the delete operation for this object
onEdit(array $data, \Orpheus\Publisher\PermanentObject\PermanentObject $object)
Run for Object edit
array | $data | the new data |
\Orpheus\Publisher\PermanentObject\PermanentObject | $object | the old data |
None found |
onValidateInput(array $input, array $fields, \Orpheus\Publisher\PermanentObject\PermanentObject $object)
Callback when validating input
array | $input | |
array | $fields | |
\Orpheus\Publisher\PermanentObject\PermanentObject | $object |
None found |
onSaved(array $data, integer|\Orpheus\Publisher\PermanentObject\PermanentObject $object)
Callbakc when object was saved
array | $data | |
integer|\Orpheus\Publisher\PermanentObject\PermanentObject | $object |
None found |
save() : boolean
Save this permanent object
True in case of success
If some fields was modified, it saves these fields using the SQL Adapter.
None found |
None found |
None found |
None found |
reload(string $field = null) : boolean
Reload fields from database
string | $field | The field to reload, default is null (all fields). |
True if done
Update the current object's fields from database. If $field is not set, it reloads only one field else all fields. Also it removes the reloaded fields from the modified ones list.
None found |
isDeleted() : boolean
Check if this object is deleted
True if this object is deleted
Checks if this object is known as deleted.
None found |
isValid() : boolean
Check if this object is valid
True if this object is valid
Check if this object is not deleted. May be used for others cases.
None found |
warning |
Be sure what you are doing before calling this function (never out of this class' context). Mark this object as deleted |
---|
getValue( $key = null) : mixed
Get one value or all values
$key | Name of the field to get. |
Get the value of field $key or all data values if $key is null.
None found |
setValue(string $key, mixed $value) : \Orpheus\Publisher\PermanentObject\PermanentObject
Set the value of a field
string | $key | Name of the field to set |
mixed | $value | New value of the field |
Set the field $key with the new $value.
None found |
equals(object $o) : boolean
Verify equality with another object
object | $o | The object to compare. |
True if this object represents the same data, else False.
Compare the class and the ID field value of the 2 objects.
None found |
logEvent(string $event, integer $time = null, string $ipAdd = null)
Log an event
string | $event | The event to log in this object |
integer | $time | A specified time to use for logging event |
string | $ipAdd | A specified IP Adress to use for logging event |
None found |
fillLogEvent(array $array, string $event)
Add an $event log in this $array
array | $array | |
string | $event |
None found |
getLogEvent(string $event, integer $time = null, string $ipAdd = null)
Get the log of an event
string | $event | The event to log in this object |
integer | $time | A specified time to use for logging event |
string | $ipAdd | A specified IP Adress to use for logging event |
None found |
object(\Orpheus\Publisher\PermanentObject\PermanentObject|integer $obj) : \Orpheus\Publisher\PermanentObject\PermanentObject
Get the object whatever we give to it
\Orpheus\Publisher\PermanentObject\PermanentObject|integer | $obj |
None found |
isFieldEditable(string $fieldname) : boolean
Test if $fieldname is editable
string | $fieldname |
None found |
get(array $options = NULL) : \Orpheus\SQLRequest\SQLSelectRequest|static|array<mixed,static>
Get some permanent objects
array | $options | The options used to get the permanents object |
An array of array containing object's data
None found |
load(mixed|array<mixed,mixed> $id, boolean $nullable = true, boolean $usingCache = true) : \Orpheus\EntityDescriptor\User\PermanentObject
Load an user object
mixed|array<mixed,mixed> | $id | The object ID to load or a valid array of the object's data |
boolean | $nullable | True to silent errors row and return null |
boolean | $usingCache | True to cache load and set cache, false to not cache |
The object
It tries to optimize by getting directly the logged user if he has the same ID.
None found |
cacheObjects(array $objects) : array
Cache an array of objects
array | $objects |
None found |
getCacheStats() : \Orpheus\Publisher\PermanentObject\PermanentObject
Get cache stats
None found |
delete(integer $in) : integer
Delete a permanent object
integer | $in | The object ID to delete or the delete array. |
The number of deleted rows.
None found |
None found |
None found |
None found |
escapeIdentifier(string $identifier = null) : string
Escape identifier through instance
string | $identifier | The identifier to escape. Default is table name. |
The escaped identifier
None found |
ei(string $identifier = null) : string
Escape identifier through instance
string | $identifier | The identifier to escape. Default is table name. |
The escaped identifier
None found |
formatValue(scalar $value) : string
Escape value through instance
scalar | $value | The value to format |
The formatted $Value
None found |
fv(scalar $value) : string
Escape value through instance
scalar | $value | The value to format |
The formatted $Value
None found |
formatValueList(array $list) : string
Escape values through instance and return as list string
array | $list | The list of values |
The formatted list string
todo |
Change to use formatFieldValue($name, $value) ? |
---|
create(array $input = array(), array $fields = null, integer $errCount) : integer
Create a new permanent object
array | $input | The input data we will check, extract and create the new object. |
array | $fields | The array of fields to check. Default value is null. |
integer | $errCount | Output parameter to get the number of found errors. Default value is 0 |
The ID of the new permanent object.
None found |
getCreateOperation(array $input, array<mixed,string> $fields) : \Orpheus\Publisher\Transaction\CreateTransactionOperation
Get the create operation
array | $input | The input data we will check and extract, used by children |
array<mixed,string> | $fields | The array of fields to check |
None found |
onValidCreate(array $input, integer $newErrors) : boolean
Callback when validating create
array | $input | |
integer | $newErrors |
None found |
extractCreateQuery(array $input) : array
Extract a create query from this class
array | $input |
None found |
createAndGet(array $input = array(), array|null $fields = null, integer $errCount) : \Orpheus\Publisher\PermanentObject\PermanentObject
Create a new permanent object
array | $input | The input data we will check, extract and create the new object. |
array|null | $fields | The array of fields to check. Default value is null. |
integer | $errCount | Output parameter to get the number of found errors. Default value is 0 |
The new permanent object
None found |
completeFields(array $data) : array
Complete missing fields
array | $data | The data array to complete. |
The completed data array.
Complete an array of data of an object of this class by setting missing fields with empty string.
None found |
None found |
None found |
getTable() : \Orpheus\Publisher\PermanentObject\The
Get the table of this class
table of this class.
None found |
getIDField() : \Orpheus\Publisher\PermanentObject\The
Get the ID field name of this class
ID field of this class.
None found |
getDomain() : \Orpheus\Publisher\PermanentObject\The
Get the domain of this class
domain of this class.
Get the domain of this class, can be guessed from $table or specified in $domain.
None found |
getValidator() : \Orpheus\Publisher\PermanentObject\The
Get the validator of this class
validator of this class.
Get the validator of this class.
None found |
None found |
applyToObject( $data, $id)
Apply for new object
$data | The new data to process. |
|
$id | The ID of the new object. |
None found |
checkUserInput(array $input, array<mixed,string> $fields = null, \Orpheus\Publisher\PermanentObject\PermanentObject $ref = null, integer $errCount) : \Orpheus\Publisher\PermanentObject\The
Check user input
array | $input | The user input data to check. |
array<mixed,string> | $fields | The array of fields to check. Default value is null. |
\Orpheus\Publisher\PermanentObject\PermanentObject | $ref | The referenced object (update only). Default value is null. |
integer | $errCount | The resulting error count, as pointer. Output parameter. |
valid data.
Check if the class could generate a valid object from $input. The method could modify the user input to fix them but it must return the data. The data are passed through the validator, for different cases:
None found |
checkForObject( $data, $ref = null)
Check for object
$data | The new data to process. |
|
$ref | The referenced object (update only). Default value is null. |
None found |
testUserInput( $input, $fields = null, $ref = null, $errCount)
Test user input
$input | The new data to process. |
|
$fields | The array of fields to check. Default value is null. |
|
$ref | The referenced object (update only). Default value is null. |
|
$errCount | The resulting error count, as pointer. Output parameter. |
None found |
getClassData(array $classData = null) : array
Get all gathered data about this class
array | $classData |
None found |
getSQLAdapter() : \Orpheus\SQLAdapter\SQLAdapter
Get the SQL Adapter of this class
None found |
throwException(string $message)
Throw an UserException
string | $message | the text message, may be a translation string |
None found |
throwNotFound(string $message = null)
Throw a NotFoundException
string | $message | the text message, may be a translation string |
None found |
text(string $text, array|string $values = array()) : string
Translate text according to the object domain
string | $text | The text to translate |
array|string | $values | The values array to replace in text. Could be used as second parameter. |
The translated text
None found |
_text(\Orpheus\Publisher\PermanentObject\sting $text, array|string $values = array())
Translate text according to the object domain
\Orpheus\Publisher\PermanentObject\sting | $text | The text to translate |
array|string | $values | The values array to replace in text. Could be used as second parameter. |
None found |
None found |
isLogin(string $f = self::IS_LOGGED) : boolean
Gets the Log in status of this user in the current session.
string | $f |
True
None found |
login(string $force = false)
Log in this user to the current session.
string | $force |
None found |
logout(string $reason = null) : boolean
Log out this user from the current session.
string | $reason |
None found |
checkPerm(integer|string $right) : boolean
Check permissions
integer|string | $right | The right to compare, can be the right string to look for or an integer. |
True if this user has enough acess level.
Compare the accesslevel of this user to the incoming right. $right could be an int (accesslevel) or a string (right)
None found |
checkAccess(string $module) : boolean
Check access permissions
string | $module | The module to check |
True if this user has enough acess level to access to this module
warning |
Obsolete |
---|
checkPermissions(array $input)
Check if current logged user can edit this one
array | $input | The input |
None found |
canAlter(\Orpheus\EntityDescriptor\User\AbstractUser $user) : boolean
Check if this user can alter data on the given user
\Orpheus\EntityDescriptor\User\AbstractUser | $user | The user we want to edit |
True if this user has enough acess level to edit $user or he is altering himself
None found |
canDo(string $action, object $object = null) : boolean
Check if this user can affect data on the given user
string | $action | The action to look for |
object | $object | The object we want to edit |
True if this user has enough access level to alter $object (or he is altering himself)
None found |
userLogin(array $data, string $loginField = 'email') : \Orpheus\SQLRequest\SQLSelectRequest|\Orpheus\EntityDescriptor\User\AbstractUser|array<mixed,\Orpheus\Publisher\PermanentObject\static>
Logs in an user using data
array | $data | |
string | $loginField |
None found |
listLoginFields() : array<mixed,string>
List all available login fields
None found |
httpLogin()
Log in an user from HTTP authentication according to server variables PHP_AUTH_USER and PHP_AUTH_PW
None found |
httpCreate() : \Orpheus\EntityDescriptor\User\User
Create user from HTTP authentication
object
warning |
Require other data than name and password ard optional Create user from HTTP authentication |
---|
httpAuthenticate() : boolean
Login from HTTP authentication, create user if not existing
warning |
Require other data than name and password are optional Create user from HTTP authentication |
---|
hashPassword( $str) : \Orpheus\EntityDescriptor\User\The
Hash a password
$str | The clear password. |
hashed string.
None found |
isLogged() : True
Check if the client is logged in
if the current client is logged in
None found |
getLoggedUserID() : integer|string
Get ID if user is logged
The id of the current client logged in
Get the ID of the current user or 0.
None found |
getLoggedUser() : \Orpheus\EntityDescriptor\User\AbstractUser
Get logged user object
The user of the current client logged in
Get the user objectof the current logged client, or null.
None found |
isAdmin() : boolean
Check if this user has admin right
True if this user is logged and is admin.
Checks if this user has admin access level. This is often used to determine if the current user can access to the admin panel.
None found |
loggedCanAccessToRoute(string $route, integer $accesslevel) : boolean
Check if this user can access to a module
string | $route | The route to look for |
integer | $accesslevel | The access level |
True if this user can access to $module
None found |
loggedHasDeveloperAccess() : boolean
Check if this user has developer access
True if this user has developer access
None found |
getRoleAccesslevel(string $role) : integer
Get acesslevel of a role
string | $role |
None found |
loggedCanDo(string $action, \Orpheus\EntityDescriptor\User\AbstractUser $object = null) : boolean
Check if this user can do a restricted action
string | $action | The action to look for |
\Orpheus\EntityDescriptor\User\AbstractUser | $object | The object to edit if editing one or null. Default value is null |
True if this user can do this $action
None found |
None found |
parseFieldValue(string $name, string $value) : string
Parse the value from SQL scalar to PHP type
string | $name | The field name to parse |
string | $value | The field value to parse |
The parse $value
None found |
formatFieldValue(string $name, mixed $value) : string
Format the value
string | $name | The field name to format |
mixed | $value | The field value to format |
The formatted $Value
None found |
addModFields( $field)
Mark the field as modified
$field | The field to mark as modified. Adds the $field to the modified fields array. |
None found |
listModifiedFields() : array<mixed,string>
List all modified fields
None found |
None found |
checkCache() : \Orpheus\Publisher\PermanentObject\PermanentObject
Check if this object is cached and cache it
None found |