QVCI Library 3.1
 All Classes Namespaces Functions Variables
Public Member Functions | Public Attributes | List of all members
Authuser Class Reference

Public Member Functions

 __construct ()
 
 init ()
 
 is_logged_in ($uid=null)
 
 is_valid_user ($uid=null)
 
 has_permission ($perms=null, $uid=null, $quiet=false)
 
 has_role ($role_ids, $uid=null)
 
 get_permissions ($uid=null)
 
 get_roles ($uid=null)
 
 login ($username, $password, $auto_login=false)
 
 logout ()
 
 switch_user ($user_id)
 

Public Attributes

 $uid = null
 Authorized user_id.
 
 $real_uid = null
 UID for the real user during switch-user.
 
 $m_user = null
 Pointer to user model (being deprecated, use user instead)
 
 $user = null
 Logged in user (object)
 

Constructor & Destructor Documentation

Authuser::__construct ( )

Constructor

Member Function Documentation

Authuser::get_permissions (   $uid = null)

Get a list of permissions for the currently logged-in user, including both individual permissions and those associated with a role.

Parameters
int$uid- optional uid
Authuser::get_roles (   $uid = null)

Get a list of role_ids for the currently logged-in user.

Parameters
int$uid- optional uid
Authuser::has_permission (   $perms = null,
  $uid = null,
  $quiet = false 
)

Test if the user has the given permission(s).

Parameters
mixed$perms
int$uid- optional uid
bool$quiet- don't report invalid perms
Authuser::has_role (   $role_ids,
  $uid = null 
)

Test if the user has the given role(s).

Parameters
int | array$role_ids
int$uid- optional uid
Authuser::init ( )

Initialization function. This function should be called by a post_controller_constructor hook. It will set up the auth user data and perform autologin.

Authuser::is_logged_in (   $uid = null)

Test if the user is logged in.

Authuser::is_valid_user (   $uid = null)

Test if a user is valid. If no uid is specified, then it will test the current user. The user_model defines the valid state.

Parameters
int$uid- optional uid
Authuser::login (   $username,
  $password,
  $auto_login = false 
)

Process the login form POST.

Parameters
str$username
str$password
bool$auto_login
Authuser::logout ( )

Perform user logout.

Authuser::switch_user (   $user_id)

Change to a different user. NOTE: It is expected that the controllers handle all the security details!

Parameters
int$user_id

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