TITAN Library for PHP5  5.6.0
Web Software Development Kit for PHP5
auth Class Reference

Titan Authentication Class. More...

Public Member Functions

 __construct ($auth_type=NULL)
 
 check ($level_needed=2, $key_needed= '', $desc= '')
 
 login ($type= 'session', $user= '', $pass= '')
 
 lookup ($user, $with_pass=false)
 
 key ($key)
 
 unlock ($lock, $any_one_key=true)
 
 higher (&$user)
 
 root ()
 
 infolder ($folder)
 
 ingroup ($group)
 
 memberof ($group, $username= '')
 
 get_acct_info ($var)
 
 show_logout ($buffer=true)
 
 logout ($full=false)
 

Data Fields

 $level = 0
 Login level.
 
 $error = ''
 Error message, if any.
 

Protected Attributes

 $ttl_lvl1 = '+1 hour'
 TTL for username only.
 
 $ttl_lvl2 = '+1 hour'
 TTL for full login.
 

Detailed Description

Titan Authentication Class.

Class: \tl\core\auth

Author
James E. Bush work@.nosp@m.bush.nosp@m..cc
Version
5.6.0

Login levels:

0 = The user is NOT logged in.
1 = We have the user's name from a cookie, but the user is NOT logged in.
2 = The user is logged in.

Methods of determining login level:

Type          Username            Password                Result

'password'    string username     string password         level 2
'session'     session username    session password        level 2
'session'     session username    (no password)           level 1
(failed login of any type)                                level 0

Constructor & Destructor Documentation

__construct (   $auth_type = NULL)

Constructor

Parameters
string$auth_typeMust be one of the following:
'web'                 TITAN_PLATFORM customer authentication
'admin'               TITAN_PLATFORM staff authentication
\tl\core\auth_type    Custom authentication

Member Function Documentation

check (   $level_needed = 2,
  $key_needed = '',
  $desc = '' 
)

Check if the user is logged in, display login form and exit if not.

Parameters
string$level_needed(optional) The login level needed to continue (default) 2 = The user must be fully logged in.
string$key_needed(optional) The name of a key needed to access the application (default) '' = No key is required.
string$desc(optional) Description of the application to use if the user does not have a required key (default) ''
login (   $type = 'session',
  $user = '',
  $pass = '' 
)

Perform login

Use ONLY if you want to handle failed login manually.

Parameters
string$passThe plain text password to encrypt
string$type(optional) Either 'session' or 'password' (default) 'session'
string$user(optional) The username to attempt login (default) ''
string$pass(optional) The password to attempt login (default) ''
Returns
integer The login level

It is up to the calling program to handle the login level appropriately.

lookup (   $user,
  $with_pass = false 
)

Lookup and return a user account

Parameters
string$userThe username of the account to lookup
boolean$with_pass(optional) Should the returned account retain the password? (default) false = remove the password from the returned account
Returns
object A stdClass object representing the requested account.
key (   $key)

Does the user have a specific key?

Parameters
string$keyThe name of the key
Returns
bolean Does the user have the key? (If the user is has "root", they have ALL keys.)
unlock (   $lock,
  $any_one_key = true 
)

Can the user unlock the lock(s)

Parameters
string$lockThe name of the lock, or a colon-delimited string of lock names
boolean$any_one_key(optional) Does any one key unlock multople locks? If false, ALL keys are required. (default) true
Returns
bolean Can the user unlock the lock?
higher ( $user)

Does the current user have access to manage a named user?

Parameters
object$userThe named user to compare to the current user
Returns
boolean Does the current user have access to manage the named user?
root ( )

Does the current user have root access?

Returns
boolean Does the current user have root access?
infolder (   $folder)

Determine if the user is in a particular AD folder (OU)

Parameters
string$folderThe name of the folder to check
Returns
boolean
ingroup (   $group)

Determine if the user is a member of a particular AD group

Alias of auth->memberof()

Parameters
string$groupThe name of the group to check
Returns
boolean
memberof (   $group,
  $username = '' 
)

Determine if the user is a member of a particular AD group

Parameters
string$groupThe name of the group to check
string$username(optional) The name of the user to check (default) $this->acct->username
Returns
boolean
get_acct_info (   $var)

Get display information about the current user account.

Parameters
string$varThe variable to lookup
Variable       Description                     Example

'name'         first name, space, last name    'John Doe'
'initials'     first and last name initials    'JD'
show_logout (   $buffer = true)

Return a logout link

Parameters
boolean$bufferShould the link be sent to $html?
Returns
string The text of the logout link
logout (   $full = false)

Log the currnt user out

Parameters
boolean$full(optional) Completely log the user out? true = level 0, false = level 1 (default) false

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