class JUserHelper


Located at : UKNOWVA_ROOT/libraries/joomla/user/helper.php

Authorisation helper class, provides static methods to perform various tasks relevant to the Joomla user and authorisation classes

This class has influences and some method logic from the Horde Auth package

Methods

static mixed
addUserToGroup(integer $userId, integer $groupId)

Method to add a user to a group.

static mixed
getUserGroups(integer $userId)

Method to get a list of groups a user is in.

static mixed
removeUserFromGroup(integer $userId, integer $groupId)

Method to remove a user from a group.

static mixed
setUserGroups(integer $userId, array $groups)

Method to set the groups for a user.

object
getProfile(integer $userId)

Gets the user profile information

static boolean
activateUser(string $activation)

Method to activate a user

static integer
getUserId(string $username)

Returns userid if a user exists

static string
getCryptedPassword(string $plaintext, string $salt = '', string $encryption = 'md5-hex', boolean $show_encrypt = false)

Formats a password using the current encryption.

static string
getSalt(string $encryption = 'md5-hex', string $seed = '', string $plaintext = '')

Returns a salt for the appropriate kind of password encryption.

static string
genRandomPassword(integer $length = 8)

Generate a random password

getSubUserGroups($groups, $include_self = false)

No description

getGroupByName($groupname, $ignorecase = true)

No description

getGroupByID($id)

No description

Details

at line 34
static mixed addUserToGroup(integer $userId, integer $groupId)

Method to add a user to a group.

Parameters

integer $userId The id of the user.
integer $groupId The id of the group.

Return Value

mixed Boolean true on success, JException on error.

at line 92
static mixed getUserGroups(integer $userId)

Method to get a list of groups a user is in.

Parameters

integer $userId The id of the user.

Return Value

mixed Array on success, JException on error.

at line 109
static mixed removeUserFromGroup(integer $userId, integer $groupId)

Method to remove a user from a group.

Parameters

integer $userId The id of the user.
integer $groupId The id of the group.

Return Value

mixed Boolean true on success, JException on error.

at line 150
static mixed setUserGroups(integer $userId, array $groups)

Method to set the groups for a user.

Parameters

integer $userId The id of the user.
array $groups An array of group ids to put the user in.

Return Value

mixed Boolean true on success, JException on error.

at line 205
object getProfile(integer $userId)

Gets the user profile information

Parameters

integer $userId The id of the user.

Return Value

object

at line 236
static boolean activateUser(string $activation)

Method to activate a user

Parameters

string $activation Activation string

Return Value

boolean True on success

at line 284
static integer getUserId(string $username)

Returns userid if a user exists

Parameters

string $username The username to search on

Return Value

integer The user id or 0 if not found

at line 311
static string getCryptedPassword(string $plaintext, string $salt = '', string $encryption = 'md5-hex', boolean $show_encrypt = false)

Formats a password using the current encryption.

Parameters

string $plaintext The plaintext password to encrypt.
string $salt The salt to use to encrypt the password. [] If not present, a new salt will be generated.
string $encryption The kind of pasword encryption to use. Defaults to md5-hex.
boolean $show_encrypt Some password systems prepend the kind of encryption to the crypted password ({SHA}, etc). Defaults to false.

Return Value

string The encrypted password.

at line 407
static string getSalt(string $encryption = 'md5-hex', string $seed = '', string $plaintext = '')

Returns a salt for the appropriate kind of password encryption.

Optionally takes a seed and a plaintext password, to extract the seed of an existing password, or for encryption types that use the plaintext in the generation of the salt.

Parameters

string $encryption The kind of pasword encryption to use. Defaults to md5-hex.
string $seed The seed to get the salt from (probably a previously generated password). Defaults to generating a new seed.
string $plaintext The plaintext password that we're generating a salt for. Defaults to none.

Return Value

string The generated or extracted salt.

at line 489
static string genRandomPassword(integer $length = 8)

Generate a random password

Parameters

integer $length Length of the password to generate

Return Value

string Random Password

at line 506
getSubUserGroups($groups, $include_self = false)

Parameters

$groups
$include_self

at line 545
getGroupByName($groupname, $ignorecase = true)

Parameters

$groupname
$ignorecase

at line 566
getGroupByID($id)

Parameters

$id