User Guide | User Privilege Configuration

The key concept of the flexi auth library is to give the developer a toolbox of functions that they can use to build a user authentication system matching the custom specifications required by their site.

One of the ways that the library enhances the customisation of the authentication system is by allowing many of the internal library settings to be defined by the developer via the libraries config file.

User Privilege Configuration

User Privilege Index | Get User Privilege Data | Set User Privilege Data
Config Setup Information

Table Schema Diagram

Table and Config File Settings

User Privilege Table | User Privilege Users Table | User Privilege Groups Table

Help with the Table Configuration

Show / Hide Help

Config Name: The name that flexi auth internally references the config setting by.

Default: The default value set within the config file.

Data Type: The data type that is expected by the config setting.

  • bool : Requires a boolean value of 'TRUE' or 'FALSE'.
  • string : Requires a textual value.
  • int : Requires a numeric value. It does not matter whether the value is an integer, float, decimal etc.
  • array : Requires an array.


Config File Location

The config file is located in CodeIgniters 'config' folder and is named 'flexi_auth.php'.

Schema Diagram : User Privilege Table

A database table schema diagram, showing how the user privilege table is related to the primary user account table.

Note: Table and columns names are defined using their config names referenced within the config file. The names within brackets are the default demo names.

User Privilege Table

The user privilege table is used to allocate role privileges to users.
Whilst very similar to user groups, multiple privileges can be assigned to a user, the users privilege (and group if desired) can then be looked up to verify if a user has permission to perform an action or access specific data.
For example, 2 users could be in an 'Moderator' group, 1 of the users could be allowed to update data, whilst the other could only view the data.


Table and Column Setup
Help
Config Name Default Data Type Description
table user_privileges - The tables name.
id upriv_id int The tables primary key.
name upriv_name string The name of the privilege.
description upriv_desc string A brief description of the privilege.
Example
// Defining the table and column names.
$config['database']['user_privileges']['table'] = 'user_privileges';
$config['database']['user_privileges']['columns']['id'] = 'upriv_id';

User Privilege Users Table

The user privilege user table is used to assign privileges to users. Multiple privileges can be assigned to a user.


Table and Column Setup
Help
Config Name Default Data Type Description
table user_privilege_users - The tables name.
id upriv_users_id int The tables primary key.
user_id upriv_users_uacc_fk int The foreign key to the user account table.
privilege_id upriv_users_upriv_fk int The foreign key to the user privilege table.
Example
// Defining the table and column names.
$config['database']['user_privilege_users']['table'] = 'user_privilege_users';
$config['database']['user_privilege_users']['columns']['id'] = 'upriv_users_id';

User Privilege Groups Table

The user privilege group table is used to assign privileges to user groups. Multiple privileges can be assigned to a user group.


Table and Column Setup
Help
Config Name Default Data Type Description
table user_privilege_groups - The tables name.
id upriv_groups_id int The tables primary key.
group_id upriv_groups_ugrp_fk int The foreign key to the user group table.
privilege_id upriv_groups_upriv_fk int The foreign key to the user privilege table.
Example
// Defining the table and column names.
$config['database']['user_privilege_groups']['table'] = 'user_privilege_groups';
$config['database']['user_privilege_groups']['columns']['id'] = 'upriv_groups_id';