Skip to content
This repository was archived by the owner on Jun 10, 2022. It is now read-only.

abbddkr/Authct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Authct

Roles Management Library for Codeigniter Framework

Installation

first of all , roles must be in config/roles.php as array like the following example

config/roles.php
----------------
$config['all_roles'] =  array(
	// use public for visitors and non-logged in users
	'public'  =>  array(
	'default_page'  =>  'home',
	'allowed_pages'  => ['home/*','welcome/index','welcome/login'],
	'blocked_pages'  => ['welcome/*']
	),

	'admin'  =>  array(
	'default_page'  =>  'welcome/defaultPage',
	'allowed_pages'=> ['welcome/*'],
	'blocked_pages'=> ['']

	),

	// another example
	'user'  =>  array(
	'default_page'  =>  'user/defaultPage',
	'allowed_pages'  => ['user/*'],
	'blocked_pages'=> ['user/backup'],
	),
);

Usage

$this->load->library('authct');
$this->authct->setUserRole('admin'); // set role name in session
$this->authct->checkCurrentUri(); // check the current uri    
$this->authct->is_role('admin'); // return 1 if user role is equal to admin

for more, take a look at controllers/Welcome.php & controllers/Home.php

About

Roles Management Library for Codeigniter Framework

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published