Skip to content

Active User library

captainkuro edited this page Jan 11, 2013 · 7 revisions

Category:Libraries::Authentication

Download File:AU.zip

Introduction

The user authorization system that handles login and registration of users. It uses a configuration database table to store user information and stores minimal information in the session. Work correct in CI 1.6.3

Features

  • Login/logout/change password functionality.
  • Registration, with/without e-mail activation.
  • Check page permission for user, user group or user role.
  • Reset forgotten password and generate new password (send on e-mail).
  • Auto-login via cookie or flash session - until browser window open.
  • Support for multiple languages. (Now only English and Russian).
  • Use Template Parser Class.
  • Use CAPTCHA plugin.
  • Admin panel for manage users, groups and roles.
  • Auto-create tables, if it not exist in database.
  • Non replace you files.

Requires and installation:

  1. Check for line in "system/application/config/autoload.php"
$autoload['libraries'] = array('database', 'session');
$autoload['helper'] = array('url'); 
  1. Then check settings in "system/application/config/auconfig.php"

  2. Create (if need) file "system/application/config/email.php" and insert you REAL setting:

<?php
  $config['protocol'] = 'smtp';
  $config['smtp_host'] = 'smtp.provider.com';  
  $config['smtp_user'] = '';
  $config['smtp_pass'] = ''; 
?>
  1. In main controller insert line:
$this->load->library('aulib');        // load AU library
echo $this->aulib->getLoginLink();    // show login/logoff
echo $this->aulib->getManagerLink();  // show back-end link (if need)
  1. Check permission for page: You can use function:
isLogged()            // is user logged
isGroup($group_name)  // is user in specified group
isRole($role_name)    // is user have specified role
denyAccess()          // show deny access page

For example:

if ( !$this->aulib->isRole('admin') ) 
          $this->aulib->denyAccess();
Clone this wiki locally