Class jAuth

Description

This is the main class for authentification process

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


	
			
Method Summary
static boolean changePassword (string $login, string $newpassword)
static object the createUserObject (string $login, string $password)
static string getDriverParam (string $paramName)
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 212)

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

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 getDriverParam (line 76)

return the value of a parameter of the configuration of the current driver

  • return: the value. null if it doesn't exist
  • access: public
static string getDriverParam (string $paramName)
  • string $paramName
static getRandomPassword (line 333)

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

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

construct the user list

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

return the user stored in the php session

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

Says if the user is connected

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

Check if persistant session is enabled in config

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

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

logout a user and delete the user in the php session

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

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

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

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

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

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

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

return the auth driver

  • access: protected
static jIAuthDriver _getDriver ()

Documentation generated on Thu, 22 Mar 2012 22:14:03 +0100 by phpDocumentor 1.4.3