This user guide is still in a developement phase. Be patient and you will get out more!
In the meanwhile check out the forum!
The FreakAuth_light© (read it Freak OUT!) package includes:
Requirements:
Follow these steps to install the FreakAuth_light library:
If you see a strange output, make sure you have :
- configured your php.ini file with short_open_tag = On. This is needed because in the templates we have used short tags for echo like <?=
- set the base_url properly in application/config/config.php
FreakAuth_light is based on 4 main default roles:
You can add your custom roles in application/config/freakauth_light.php
Look for this variable: $config['FAL_roles']
Default configuration:
$config['FAL_roles'] = array(
//don't change the two following lines//
'superadmin' => 1,
'admin' => 2,
//end don't change
//add your custom roles here
//'editor' => 3,
//'gallery_manager' => 4
//--------------------------
//don't change the following line
'user' => 100,
);
Roles work by INHERITANCE
This means that the lower the value of the role, the higher in the hierarchy
i.e superadmin (value 1) has more rights than admin (value 2)
i.e editor (value 3) has more rights than user (value 100)
You can also set usergroups with the same hierarchy
i.e.
...
'editor' => 4,
'gallery_manager' => 4
...
WARNING do not set custom groups with value 1 or 2
$this->freakauth_light->check() //this restricts acess to registered users and user-groups higher in the hierarchy (i.e. admin, superadmin)
$this->freakauth_light->check('admin') //this restricts acess to 'admin' and user-groups higher in the hierarchy (i.e. superadmin)
$this->freakauth_light->check('admin', true) //this restricts acess to 'admin' ONLY
For this purpose have a look at the file application/controllers/example.php
If you are to lazy to look at that file create a controller as follows:
<?php
class Example extends Controller {
function Example()
{
parent::Controller();
//thanks to this line of code you can protect this controller
//and reserve access to logged in users
$this->freakauth_light->check();
}
##### index #####
function index()
{
echo '<h1>You can view this message because you logged in and are at least an user!</h1>';
}
}
?>
CASE 2: just lock a particular controller method
<?php
class Example extends Controller
{
function Example()
{
parent::Controller();
}
##### index #####
function index()
{
echo '<h1>You can view this message because it\'s free for everybody!</h1>';
}
function test()
{
//thanks to this line of code you can protect this controller
//and reserve access to logged in users
$this->freakauth_light->check();
echo '<h1>You can view this message because you logged in and are at least an user!</h1>';
}
}
?>
There are 4 methods in the FreakAuth_light library to perform this operation.
Each method as a helper counterpart.
The methods are:
The first 3 of these methods are specific, while the forth is more general:
Checksif a user is logged in, returns false if FreakAuth system is not activated, Returns true if a valid user is logged, false otherwise
Checks if a user is an administrator, returns false if FreakAuth system is not activated, returns true if admin or superadmin, otherwise false
Checks if an administrator has superadmin credentials, returns false if FreakAuth system is not activated, returns true if superadmin, otherwise false
Method used to check if a logged in member belongs to the custom role (group)
It requires 2 optional parameters
The first parameter specifies the user groups as a comma separated string
The second parameter specifies whether we want to check to the specified groups ONLY or for AT LEAST those group membership in the hierarchy
(returns true also if the logged user belongs to a group higher in the hierarchy)
Example usage in a controller
$this->freakauth_light->belongsToGroup()
//returns true if the visitor is logged in and he is AT LEAST an user
$this->freakauth_light->belongsToGroup('user,editor')
//returns true if the visitor is logged in and he is AT LEAST an user or an editor (therefore it returns true also if he belongs to user-groups higher in the hierarchy (i.e. superadmin)
$this->freakauth_light->belongsToGroup('admin', true)
//returns true if the visitor is logged in and is an 'admin' ONLY
In the above examples change $this->freakauth_light->belongsToGroup() to belongsToGroup() if you prefer to use the corresponding helper function
Coming soon...
Have a look at the files in the application/views/FreakAuth_light/email and change them as you like.
The language file is in:
system/languages/english/freakauth_lang.php
Read here for further infos: Creating Language Files
If you don't see the CAPTCHA images it is because in order to make CAPTCHA functionality to work properly you must make your folders www.YOUR_WEBSITE.com/tmp
writable (chmod (777)). Do the same with www.YOUR_WEBSITE.com/public and subfolders
Have a look at the file system/application/config/freakauth_light.php
In this file you can choose whether to use CAPTCHA for:
You can decide wheter to use upper case letters, letters&numbers, or letters&numbers&special characters in the generated image.
CAPTCHA images are stored in root_directory/tmp .
CAPTCHA images get deleted every time a new captcha get displayed if the CAPTCHA images are older than 10 minutes.
Read this tutorial:
Read this tutorial:
It is possible to get the following data from the user session with the following methos:
$this->db_session->userdata('id'); $this->db_session->userdata('user_name');$this->db_session->userdata('role');jQuery is needed by FreakAuth in order to fade out the flash messages. If you are using other Javascript frameworks (Prototype, Script.aculo.us, Mootools) along with jQuery, you might experience some conflicts.
To avoid these conflicts try this:
jQuery.noConflict();
jQuery(document).ready(function($) {
$("#flashMessage").show("normal",
function()
{
$("#flashMessage").fadeOut(10000);
}
);
});
For further documentation about this issue have a look at:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|public|tmp|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
$config['index_page'] = "";