Class jAuth

Description

This is the main class for authentification process

Located in /auth/jAuth.class.php (line 96)


	
			
Method Summary
static boolean changePassword (string $login, string $newpassword)
static object the createUserObject (string $login, string $password)
static string getRandomPassword ([int $length = 10])
static object the getUser (string $login)
static array getUserList ([string $pattern = '%'])
static object the getUserSession ()
static boolean isConnected ()
static boolean isPersistant ()
static boolean login (string $login, string $password, [boolean $persistant = false])
static void logout ()
static boolean removeUser (string $login)
static object the saveNewUser (object $user)
static void updateUser (object $user)
static object|false verifyPassword (string $login, string $password)
static array _getConfig ()
Methods
static changePassword (line 266)

change a user password

  • return: true if the change succeed
  • access: public
static boolean changePassword (string $login, string $newpassword)
  • string $login: the login of the user
  • string $newpassword: the new password (not encrypted)
static createUserObject (line 175)

Create a new user object

You should call this method if you want to create a new user. It returns an object, representing a user. Then you should fill its properties and give it to the saveNewUser method.

  • return: returned object depends on the driver
  • since: 1.0b2
  • access: public
static object the createUserObject (string $login, string $password)
  • string $login: the user login
  • string $password: the user password (not encrypted)
static getRandomPassword (line 379)

generate a password with random letter or number

  • return: the generated password
  • access: public
static string getRandomPassword ([int $length = 10])
  • int $length: the length of the generated password
static getUser (line 158)

load user data

This method returns an object, generated by the driver, and which contains data corresponding to the given login. This method should be called if you want to update data of a user. see updateUser method.

  • return: user
  • access: public
static object the getUser (string $login)
  • string $login
static getUserList (line 254)

construct the user list

  • return: array of object
  • access: public
static array getUserList ([string $pattern = '%'])
  • string $pattern: '' for all users
static getUserSession (line 366)

return the user stored in the php session

  • return: user data
  • access: public
static object the getUserSession ()
static isConnected (line 357)

Says if the user is connected

  • access: public
static boolean isConnected ()
static isPersistant (line 328)

Check if persistant session is enabled in config

  • return: true if persistant session in enabled
  • access: public
static boolean isPersistant ()
static login (line 289)

authentificate a user, and create a user in the php session

  • return: true if authentification is ok
  • access: public
static boolean login (string $login, string $password, [boolean $persistant = false])
  • string $login: the login of the user
  • string $password: the password to test (not encrypted)
  • boolean $persistant: (optional) the session must be persistant
static logout (line 339)

logout a user and delete the user in the php session

  • access: public
static void logout ()
static removeUser (line 237)

remove a user send first AuthCanRemoveUser event, then if ok, send AuthRemoveUser and then remove the user.

  • return: true if ok
  • access: public
static boolean removeUser (string $login)
  • string $login: the user login
static saveNewUser (line 197)

Save a new user

if the saving has succeed, a AuthNewUser event is sent The given object should have been created by calling createUserObject method :

example :

   $user = jAuth::createUserObject('login','password');
   $user->email ='bla@foo.com';
   jAuth::saveNewUser($user);
the type of $user depends of the driver, so it can have other properties.

  • return: user (eventually, with additional data)
  • access: public
static object the saveNewUser (object $user)
  • object $user: the user data
static updateUser (line 223)

update user data

It send a AuthUpdateUser event if the saving has succeed. If you want to change the user password, you must use jAuth::changePassword method instead of jAuth::updateUser method.

The given object should have been created by calling getUser method. Example :

   $user = jAuth::getUser('login');
   $user->email ='bla@foo.com';
   jAuth::updateUser($user);
the type of $user depends of the driver, so it can have other properties.

  • access: public
static void updateUser (object $user)
  • object $user: user data
static verifyPassword (line 277)

verify that the password correspond to the login

  • return: if ok, returns the user as object
  • access: public
static object|false verifyPassword (string $login, string $password)
  • string $login: the login of the user
  • string $password: the password to test (not encrypted)
static _getConfig (line 102)

Load the configuration of authentification, stored in the auth plugin config

  • access: protected
static array _getConfig ()
static _getDriver (line 130)

load the auth driver

  • access: protected
static jIAuthDriver _getDriver ()

Documentation generated on Wed, 07 Sep 2011 13:46:43 +0200 by phpDocumentor 1.4.3