public
|
#
__construct( flDb $db, flUserAdapter $adapter = null )
Construct the object.
Parameters
- $db
- The database object.
- $adapter
- user manager adapter.
|
public
flUserAdapter
|
#
getAdapter( )
Get the user authentication adapter in use.
Get the user authentication adapter in use.
Returns
|
public
integer
|
#
isUsernameUsed( string $username )
Test if the given username is already used.
Test if the given username is already used.
Parameters
- $username
- The username to test.
Returns
integer 0 if the username is not used; else non-zero.
|
public
integer
|
#
isEmailUsed( string $email )
Test if the given email address is already used.
Test if the given email address is already used.
Parameters
- $email
- The email address to test.
Returns
integer 0 if the email is not used; else non-zero.
|
public
integer
|
#
create( string $username, string $email, string $password, string $state, string $tz, string $displayName = '', string $bio = '' )
Create a user within the database.
Create a user within the database.
Parameters
- $username
- The username or null if creating an unnamed user.
- $email
- The users email address.
- $password
- The users password.
- $state
- The state to create the user in: 'active','disabled','pending'
- $tz
- The timezone string for the user.
- $displayName
- The display name for the user.
- $bio
- The users bio.
Returns
integer The user id or 0 if the user could not be created.
|
public
|
#
delete( integer $uid )
Delete the user.
Parameters
- $uid
- The id of the user to delete
|
public
boolean
|
#
setPassword( integer $uid, string $password )
Set a new password for the user.
Set a new password for the user.
Parameters
- $uid
- The id of the user to set the password for.
- $password
- The new password for the user.
Returns
boolean true if the password was set for the user; else false.
|
public
boolean
|
#
setEmail( integer $uid, string $email )
Set a new email address for the user.
Set a new email address for the user.
Parameters
- $uid
- The id of the user to set the email for.
- $email
- The email address to set for the user.
Returns
boolean true if the email address was updated; else false.
|
public
boolean
|
#
setTimezone( integer $uid, string $tz )
Set a timezone for the user.
Set a timezone for the user.
Parameters
- $uid
- The id of the user to set the email for.
- $tz
- The new timezone.
Returns
boolean true if the email address was updated; else false.
|
public
boolean
|
#
changeUsername( integer $uid, string $username )
Change the username of an existing user.
Change the username of an existing user.
Parameters
- $uid
- The id of the user to update.
- $username
- The new username of the user.
Returns
boolean true if the username was updated; else false.
|
public
boolean
|
#
changeDisplayName( integer $uid, string $name )
Change the display name of an existing user.
Change the display name of an existing user.
Parameters
- $uid
- The id of the user to update.
- $name
- The new display name for the user.
Returns
boolean true if the username was updated; else false.
|
public
boolean
|
#
changeBio( integer $uid, string $bio )
Change the bio of an existing user.
Change the bio of an existing user.
Parameters
- $uid
- The id of the user to update.
- $bio
- The new bio for the user.
Returns
boolean true if the username was updated; else false.
|
protected
array
|
#
_buildFind( string $sel, string $term, array $where, boolean $exact, integer $role )
Build the query to find a user.
Build the query to find a user.
Parameters
- $sel
- The item(s) to return.
- $term
- The term to search for.
- $where
- The fields to search in or ALL to search in ALL.
- $exact
- true if exact matching should be used; else false for loose.
- $role
- ID of role users must be a member of.
Returns
array [0] The query string, [1] The query parameters
|
public
array
|
#
find( string $term, array $where, boolean $exact, integer $start = 0, integer $limit = 1000, integer $role = null )
Find a user or users matching a search.
Find a user or users matching a search.
Parameters
- $term
- The term to search for.
- $where
- The fields to search in or ALL to search in ALL.
- $exact
- true if exact matching should be used; else false for loose.
- $start
- The start position in the results to return.
- $limit
- The number of results to return.
- $role
- ID of role users must be a member of.
Returns
array The list of uids found.
|
public
integer
|
#
numFindMatches( string $term, array $where, boolean $exact, integer $role = null )
Find the number of users that match a search.
Find the number of users that match a search.
Parameters
- $term
- The term to search for.
- $where
- The fields to search in or ALL to search in ALL.
- $exact
- true if exact matching should be used; else false for loose.
- $role
- ID of role users must be a member of.
Returns
integer The number of users matched.
|
public
|
#
prunePendingActivation( integer $before )
Prune accounts that are pending email activation.
Prune accounts that are pending email activation.
Parameters
- $before
- The time in seconds relative to now before which accounts are pruned newer accounts are left untouched.
|
public
array
|
#
getInfo( integer $uid )
Get the information about a user.
Get the information about a user.
Parameters
- $uid
- The user id to get information about.
Returns
array Array holding the information about the user or false on error.
|
public
string
|
#
getState( integer $uid )
Get the state of a user.
Parameters
- $uid
- The id of the user to get the status for.
Returns
string One of 'active','disabled','pending', 'blocked'
|
public
boolean
|
#
setState( integer $uid, string $state )
Update the state of a user.
Update the state of a user.
Parameters
- $uid
- The id of the user to update.
- $state
- One of 'active','disabled','pending'
Returns
boolean true if the status was updated else false.
|
public
boolean
|
#
setAuthKey( integer $uid, string $key )
Update the authentication key of a user.
Update the authentication key of a user.
Parameters
- $uid
- The id of the user to update.
- $key
- The new authentication key to set.
Returns
boolean true if the status was updated else false.
|
public
boolean
|
#
block( integer $uid, integer $blockedBy, integer $for, string $reason )
Block a user.
Parameters
- $uid
- The id of the user to block.
- $blockedBy
- The id of the user applying the block.
- $for
- The time in days to block the account for or 0 to block forever.
- $reason
- The reason for the block.
Returns
boolean true if the block was applied; else false.
|
public
array
|
#
getBlockInfo( integer $uid )
Get the information about a block on a user.
Get the information about a block on a user.
Parameters
- $uid
- The id of the user to get the block information about.
Returns
array Array holding the block information or null if the user is not blocked.
|
public
string
|
#
getVerificationHash( integer $uid )
Get a verification hash which can be sent via email to verify a new user.
Get a verification hash which can be sent via email to verify a new user.
Parameters
- $uid
- The id of the user to get the verification hash for.
Returns
string The hash.
Throws
|
public
boolean
|
#
verifyHash( string $email, string $hash )
The email address of the user to verify the hash for.
The email address of the user to verify the hash for.
If the hash is verified then the user state is changed from pending to active.
Parameters
- $email
- The email address of the user.
- $hash
- The hash string exactly as created by getVerificationHash
Returns
boolean true if the hash is verified; else false.
|
public
|
#
authUser( flResponse $response, integer $uid )
Force the given user ID to be authenticated.
Force the given user ID to be authenticated.
Parameters
- $response
- The response object.
- $uid
- The ID of the user to authenticate.
|
public
|
#
forceLogout( integer $uid )
Force the user to be logged out of all computers.
Force the user to be logged out of all computers.
Parameters
- $uid
- The ID of the user to logout.
|
public
array
|
#
getUserRoles( integer $uid, string $name = 'displayname' )
Get the roles assigned to a user.
Get the roles assigned to a user.
Parameters
- $uid
- The id of the user to get the roles for.
- $name
- If to get the 'displayname' or the 'rolename'.
Returns
array Array of role IDs and their display names.
|
public
boolean
|
#
setUserRoles( integer $uid, array $roles, boolean $byName = false )
Set the roles for a user.
Set the roles for a user.
Parameters
- $uid
- The id of the user to set the roles for.
- $roles
- Array of role Ids to assign to the user.
- $byName
- true to set the roles by role name ignoring unknown roles, else false.
Returns
boolean true if the role set; else false.
|
public
boolean
|
#
remoteAuth( )
Test if using remote authentication.
Test if using remote authentication.
Returns
boolean true if remote authentication; else false.
|