Joomla! Platform 12.1

Abstract Class JUserHelper

Description

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

  • abstract:
  • since: 11.1

Located in /libraries/joomla/user/helper.php (line 22)

Abstract class JUserHelper   (Subpackage User)
Method Summary
Static method static boolean activateUser (string $activation)
Static method static boolean addUserToGroup (integer $userId, integer $groupId)
Static method static string genRandomPassword ([integer $length = 8])
Static method static string getCryptedPassword (string $plaintext, [string $salt = ''], [string $encryption = 'md5-hex'], [boolean $show_encrypt = false])
Static method static string getSalt ([string $encryption = 'md5-hex'], [string $seed = ''], [string $plaintext = ''])
Static method static array getUserGroups (integer $userId)
Static method static integer getUserId (string $username)
Static method static boolean removeUserFromGroup (integer $userId, integer $groupId)
Static method static boolean setUserGroups (integer $userId, array $groups)
Static method static string _toAPRMD5 (string $value, integer $count)
Method object getProfile ([integer $userId = 0])
Methods
activateUser (line 226)

Method to activate a user

  • return: True on success
  • since: 11.1
  • access: public
boolean activateUser (string $activation)
  • string $activation: Activation string
addUserToGroup (line 35)

Method to add a user to a group.

  • return: True on success
  • throws: RuntimeException
  • since: 11.1
  • access: public
boolean addUserToGroup (integer $userId, integer $groupId)
  • integer $userId: The id of the user.
  • integer $groupId: The id of the group.
genRandomPassword (line 505)

Generate a random password

  • return: Random Password
  • since: 11.1
  • access: public
string genRandomPassword ([integer $length = 8])
  • integer $length: Length of the password to generate
getCryptedPassword (line 303)

Formats a password using the current encryption.

  • return: The encrypted password.
  • since: 11.1
  • access: public
string getCryptedPassword (string $plaintext, [string $salt = ''], [string $encryption = 'md5-hex'], [boolean $show_encrypt = false])
  • 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 password 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.
getProfile (line 196)

Gets the user profile information

  • since: 11.1
  • access: public
object getProfile (integer $userId)
  • integer $userId: The id of the user.
getSalt (line 406)

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.

  • return: The generated or extracted salt.
  • since: 11.1
  • access: public
string getSalt ([string $encryption = 'md5-hex'], [string $seed = ''], [string $plaintext = ''])
  • string $encryption: The kind of password 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.
getUserGroups (line 88)

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

  • return: List of groups
  • since: 11.1
  • access: public
array getUserGroups (integer $userId)
  • integer $userId: The id of the user.
getUserId (line 274)

Returns userid if a user exists

  • return: The user id or 0 if not found.
  • since: 11.1
  • access: public
integer getUserId (string $username)
  • string $username: The username to search on.
removeUserFromGroup (line 106)

Method to remove a user from a group.

  • return: True on success
  • since: 11.1
  • access: public
boolean removeUserFromGroup (integer $userId, integer $groupId)
  • integer $userId: The id of the user.
  • integer $groupId: The id of the group.
setUserGroups (line 146)

Method to set the groups for a user.

  • return: True on success
  • since: 11.1
  • access: public
boolean setUserGroups (integer $userId, array $groups)
  • integer $userId: The id of the user.
  • array $groups: An array of group ids to put the user in.
_toAPRMD5 (line 539)

Converts to allowed 64 characters for APRMD5 passwords.

  • return: converted to the 64 MD5 characters.
  • since: 11.1
  • access: protected
string _toAPRMD5 (string $value, integer $count)
  • string $value: The value to convert.
  • integer $count: The number of characters to convert.
/html>