User Guide | Getting User Privilege Data

The flexi auth library functions for getting data from the user privilege tables.

Get User Privilege Data

User Privilege Index | User Privilege Config | Set User Privilege Data

Help with Function Parameters

Show / Hide Help

Name: The name of the function parameter (argument).

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

  • 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.

Required: Defines whether the parameter requires a value to be submitted.

Default: Defines the default parameter value that is used if no other value is submitted.

get_privileges()

Gets a list of user privileges filtered by a custom SQL WHERE statement.


Library and Requirements

Available via the standard library.

Function Parameters
get_privileges(sql_select, sql_where) Help
Name Data Type Required Default Description
sql_select string | array No FALSE Define the database fields returned via an SQL SELECT statement.
Read the defining SQL documentation for further information.
sql_where string | array No FALSE Set the SQL WHERE statement used to filter the database records to return.
Read the defining SQL documentation for further information.
How it Works

The function uses the defined 'sql_where' argument to create an SQL WHERE statement to filter a list of user privileges from the user privilege table.

The data returned by the query is defined via the 'sql_select' argument. If no columns are specified, all columns will be returned.

Notes

This function is compatible with flexi auths 'Query Builder' functions.


This function can be chained with CodeIgniters query functions 'result()', 'row()' etc.

Read the Query Result documentation for further information on all the combined flexi auth and CodeIgniter functions that are available.

Return Values

Failure:FALSE

Success:object

Examples
// Read the defining SQL documentation for further information on setting SQL statements.
$sql_select = array(...);
$sql_where = array(...);

// Example of chaining CI's query function 'result()'.
// Read the Query Result documentation for further information on available functions.
$this->flexi_auth->get_privileges($sql_select, $sql_where)->result();

get_user_privileges()

Get the user privileges for a user.


Library and Requirements

Available via the standard library.

Function Parameters
get_user_privileges(sql_select, sql_where) Help
Name Data Type Required Default Description
sql_select string | array No FALSE Define the database fields returned via an SQL SELECT statement.
Read the defining SQL documentation for further information.
sql_where string | array No FALSE

Set the SQL WHERE statement used to filter the database records to return. Read the defining SQL documentation for further information.

If no value is passed to the 'sql_where' argument, the function will use the sessions user id to filter privileges for the current logged in user.

How it Works

The function runs an SQL SELECT query that joins the User Privilege and User Privilege Users table together.

The function uses the defined 'sql_where' argument to create an SQL WHERE statement to filter a list of user privileges.

If no value is passed to the 'sql_where' argument, the function will use the sessions user id to filter privileges for the current logged in user.

The data returned by the query is defined via the 'sql_select' argument. If no columns are specified, all columns will be returned.

Notes

This function is compatible with flexi auths 'Query Builder' functions.


This function can be chained with CodeIgniters query functions 'result()', 'row()' etc.

Read the Query Result documentation for further information on all the combined flexi auth and CodeIgniter functions that are available.

Return Values

Failure:FALSE

Success:object

Examples
// Example #1 : Using the session user id of a logged in user.
$this->flexi_auth->get_user_privileges(FALSE, FALSE);
// Example #2 : Defining a specific SQL WHERE condition and specific columns to return.
// Read the defining SQL documentation for further information on setting SQL statements.
$sql_select = array(...);
$sql_where = array(...);

// Example of chaining CI's query function 'result()'.
// Read the Query Result documentation for further information on available functions.
$this->flexi_auth->get_user_privileges($sql_select, $sql_where)->result();

get_user_group_privileges()

Get the user privileges for a user group.


Library and Requirements

Available via the standard library.

Function Parameters
get_user_group_privileges(sql_select, sql_where) Help
Name Data Type Required Default Description
sql_select string | array No FALSE Define the database fields returned via an SQL SELECT statement.
Read the defining SQL documentation for further information.
sql_where string | array No FALSE

Set the SQL WHERE statement used to filter the database records to return. Read the defining SQL documentation for further information.

If no value is passed to the 'sql_where' argument, the function will use the sessions user group id to filter privileges for the current logged in user.

How it Works

The function runs an SQL SELECT query that joins the User Privilege and User Privilege Groups table together.

The function uses the defined 'sql_where' argument to create an SQL WHERE statement to filter a list of user privileges.

If no value is passed to the 'sql_where' argument, the function will use the sessions user group id to filter privileges for the current logged in user.

The data returned by the query is defined via the 'sql_select' argument. If no columns are specified, all columns will be returned.

Notes

This function is compatible with flexi auths 'Query Builder' functions.


This function can be chained with CodeIgniters query functions 'result()', 'row()' etc.

Read the Query Result documentation for further information on all the combined flexi auth and CodeIgniter functions that are available.

Return Values

Failure:FALSE

Success:object

Examples
// Example #1 : Using the session group id of a logged in user.
$this->flexi_auth->get_user_group_privileges(FALSE, FALSE);
// Example #2 : Defining a specific SQL WHERE condition and specific columns to return.
// Read the defining SQL documentation for further information on setting SQL statements.
$sql_select = array(...);
$sql_where = array(...);

// Example of chaining CI's query function 'result()'.
// Read the Query Result documentation for further information on available functions.
$this->flexi_auth->get_user_group_privileges($sql_select, $sql_where)->result();