Orion PHP  0.11.12
The PHP5.3 framework
Orion\Core\Auth Class Reference

List of all members.

Static Public Member Functions

static login ($noredirect=false)
static manualLogin ($user, $password)
static allow ($slug, $noredirect=false)
static logout ()
static logged ()
static refreshData ()
static user ()

Public Attributes

const E_NO_DATA = 53
const E_UNKNOWN = 54
const E_NOT_VERIFIED = 55

Static Private Attributes

static $user = null

Detailed Description

Orion authentification class.

For performance matters, roles and levels are stored into an arrayMap in configuration file

Thibaut Despoulain BSD 4-clauses

Definition at line 22 of file auth.php.

Member Function Documentation

static Orion\Core\Auth::allow ( slug,
noredirect = false 
) [static]

Must be called AFTER Core::login() Allows access only to logged users that have a level equal to or less than provided role. If permission is nsot granted, it will automatically redirect the user to the login module.

Note that while it's doing all login/auth/redirection work automatically, you still have to create the corresponding user table in your database in addition to provide the login module into orion's module directory.

See also:
Core MainConfig LoginModule
string$slugthe role identifier (ie: 'administrator', 'member', etc.). See your configuration file for a liste of roles and their permission level.
bool TRUE if user has the permission, FALSE otherwise (even if redirected)

Definition at line 201 of file auth.php.

static Orion\Core\Auth::logged ( ) [static]

Is a user logged in ?

Not for security testing !!! Use allow($slug) instead


Definition at line 251 of file auth.php.

static Orion\Core\Auth::login ( noredirect = false) [static]

Try loging the user in.

  • Checks if already logged in session var
  • If not, check for post data from login module
  • Otherwise, redirect to login module

If user if found and password/login match, user data is stored into $this->user attributes, that you can access using Core->user()->name; for example.

If login fails, a redirection occurs toward login module , using /error/err_code routing.

Definition at line 68 of file auth.php.

static Orion\Core\Auth::logout ( ) [static]

Logs the user out. Unsets the session data.

Definition at line 231 of file auth.php.

static Orion\Core\Auth::manualLogin ( user,
) [static]

Manual login method

int Returns 0 if success, else returns a specific error code that is > 0

Definition at line 143 of file auth.php.

static Orion\Core\Auth::refreshData ( ) [static]

Refresh user data from database.

or false if refresh failed.

Definition at line 269 of file auth.php.

static Orion\Core\Auth::user ( ) [static]

Gets user data

Core $user

Definition at line 299 of file auth.php.

Member Data Documentation

Core AuthUser Orion::Core\Auth::$user = null [static, private]

User data (once logged in)

Definition at line 53 of file auth.php.

const Orion::Core\Auth::E_LEVEL_RESTRICT = 52

Core error : Permission level too low

Definition at line 35 of file auth.php.

const Orion::Core\Auth::E_LOGIN_MISMATCH = 50

Core error : Login field mismatch

Definition at line 27 of file auth.php.

const Orion::Core\Auth::E_NO_DATA = 53

Core error : Missing login data

Definition at line 39 of file auth.php.

const Orion::Core\Auth::E_NOT_VERIFIED = 55

Core error : User is not verified

Definition at line 47 of file auth.php.

const Orion::Core\Auth::E_PASSWORD_MISMATCH = 51

Core error : Password field mismatch

Definition at line 31 of file auth.php.

const Orion::Core\Auth::E_UNKNOWN = 54

Core error Unknown error

Definition at line 43 of file auth.php.

The documentation for this class was generated from the following file: