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 25)


	
			
Method Summary
 static boolean activateUser (string $activation)
 static boolean addUserToGroup (integer $userId, integer $groupId)
 static mixed clearExpiredTokens ()
 static string genRandomPassword ([integer $length = 16])
 static string getCryptedPassword (string $plaintext, [string $salt = ''], [string $encryption = 'bcrypt'], [boolean $show_encrypt = false])
 static object getProfile ([integer $userId = 0])
 static mixed getRememberCookieData ()
 static string getSalt ([string $encryption = 'md5-hex'], [string $seed = ''], [string $plaintext = ''])
 static string getShortHashedUserAgent ()
 static array getUserGroups (integer $userId)
 static integer getUserId (string $username)
 static boolean invalidateCookie (string $userId, string $cookieName)
 static boolean removeUserFromGroup (integer $userId, integer $groupId)
 static boolean setUserGroups (integer $userId, array $groups)
 static string _toAPRMD5 (string $value, integer $count)
Methods
static activateUser (line 239)

Method to activate a user

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

Method to add a user to a group.

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

Clear all expired tokens for all users.

  • return: Database query result
  • since: 3.2
  • access: public
static mixed clearExpiredTokens ()
static genRandomPassword (line 606)

Generate a random password

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

Formats a password using the current encryption.

  • return: The encrypted password.
  • since: 11.1
  • access: public
static string getCryptedPassword (string $plaintext, [string $salt = ''], [string $encryption = 'bcrypt'], [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.
static getProfile (line 209)

Gets the user profile information

  • since: 11.1
  • access: public
static object getProfile ([integer $userId = 0])
  • integer $userId: The id of the user.
static getRememberCookieData (line 736)

Method to get the remember me cookie data

  • return: An array of information from an authentication cookie or false if there is no cookie
  • since: 3.2
  • access: public
static mixed getRememberCookieData ()
static getSalt (line 489)

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
static 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.
static getShortHashedUserAgent (line 763)

Method to get a hashed user agent string that does not include browser version.

Used when frequent version changes cause problems.

  • return: A hashed user agent string with version replaced by 'abcd'
  • since: 3.2
  • access: public
static string getShortHashedUserAgent ()
static getUserGroups (line 95)

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

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

Returns userid if a user exists

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

Method to remove a cookie record from the database and the browser

  • return: True on success
  • see: JInput::setCookie for more details
  • since: 3.2
  • access: public
static boolean invalidateCookie (string $userId, string $cookieName)
  • string $userId: User ID for this user
  • string $cookieName: Series id (cookie name decoded)
static removeUserFromGroup (line 113)

Method to remove a user from a group.

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

Method to set the groups for a user.

  • return: True on success
  • since: 11.1
  • access: public
static 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.
static _toAPRMD5 (line 641)

Converts to allowed 64 characters for APRMD5 passwords.

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

Documentation generated on Tue, 19 Nov 2013 15:04:36 +0100 by phpDocumentor 1.4.3