Set User Privilege Data
User Privilege Index |
User Privilege Config |
Get 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.
insert_privilege()
Inserts a new user privilege to the database.
Library and Requirements
Available via the standard library.
Function Parameters
insert_privilege(name, description, custom_data)
Help
Name |
Data Type |
Required |
Default |
Description |
name |
string |
Yes |
FALSE |
Defines the name of the user privilege. |
description |
string |
No |
NULL |
Defines a short description of the user privilege. |
custom_data |
array |
No |
FALSE |
Defines any custom data that is to be inserted into the user privilege table.
|
How it Works
The function runs an SQL INSERT statement to insert the data passed to the function into the user privilege table.
Return Values
Failure:FALSE | An error message will be set.
Success:int | id of user privilege | A status message will be set.
Example
$name = 'privilege 101';
$description = 'Description of privilege 101';
$custom_data = array(
'custom_col_1' => 'custom_value_1',
'custom_col_2' => 'custom_value_2'
);
$this->flexi_auth->insert_privilege($name, $description, $custom_data);
update_privilege()
Updates a user privilege with any submitted data.
Library and Requirements
Available via the standard library.
Function Parameters
update_privilege(privilege_id, privilege_data)
Help
Name |
Data Type |
Required |
Default |
Description |
privilege_id |
int |
Yes |
FALSE |
Defines the id of the user privilege to be updated. |
privilege_data |
array |
Yes |
FALSE |
Defines the columns and data within the user privilege table to be updated.
|
How it Works
The function loops through the 'privilege_data' argument and runs an SQL UPDATE statement by matching the array data with the user privilege table columns.
Return Values
Failure:FALSE | An error message will be set.
Success:TRUE | A status message will be set.
Example
$privilege_id = 101;
$privilege_data = array(
'upriv_name' => 'Example Privilege Name',
'upriv_desc' => 'Description of Example Privilege'
);
$this->flexi_auth->update_privilege($privilege_id, $privilege_data);
delete_privilege()
Deletes a privilege from the user privilege table.
Library and Requirements
Available via the standard library.
Function Parameters
delete_privilege(sql_where)
Help
Name |
Data Type |
Required |
Default |
Description |
sql_where |
string | int | 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 a number is passed, the function will interpret the value as a group id.
|
How it Works
The function generates an SQL WHERE statement from the passed 'sql_where' argument and deletes all matching user privileges.
Return Values
Failure:FALSE | An error message will be set.
Success:TRUE | A status message will be set.
Examples
$sql_where = 101;
$this->flexi_auth->delete_privilege($sql_where);
$sql_where = array(...);
$this->flexi_auth->delete_privilege($sql_where);
insert_privilege_user()
Inserts a new user privilege for a user.
Library and Requirements
Available via the standard library.
Function Parameters
insert_privilege_user(user_id, privilege_id)
Help
Name |
Data Type |
Required |
Default |
Description |
user_id |
int |
Yes |
FALSE |
Defines the id of the user to insert a new user privilege for. |
privilege_id |
int |
Yes |
FALSE |
Defines the id of the user privilege to be inserted for a user. |
How it Works
The function runs an SQL INSERT query inserting the 'user_id' and 'privilege_id' to the User Privilege Users table.
Return Values
Failure:FALSE | An error message will be set.
Success:TRUE | id of new record | A status message will be set.
Example
$user_id = 101;
$privilege_id = 201;
$this->flexi_auth->insert_privilege_user($user_id, $privilege_id);
delete_privilege_user()
Deletes a user privilege for a user.
Library and Requirements
Available via the standard library.
Function Parameters
delete_privilege_user(sql_where)
Help
Name |
Data Type |
Required |
Default |
Description |
sql_where |
string | int | 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 a number is passed, the function will interpret the value as the tables primary key.
|
How it Works
The function generates an SQL WHERE statement from the passed 'sql_where' argument and deletes all matching user privilege users.
Return Values
Failure:FALSE | An error message will be set.
Success:TRUE | A status message will be set.
Examples
$sql_where = 101;
$this->flexi_auth->delete_privilege_user($sql_where);
$sql_where = array(...);
$this->flexi_auth->delete_privilege_user($sql_where);
insert_user_group_privilege()
Inserts a new user privilege for a group.
Library and Requirements
Available via the standard library.
Function Parameters
insert_user_group_privilege(group_id, privilege_id)
Help
Name |
Data Type |
Required |
Default |
Description |
group_id |
int |
Yes |
FALSE |
Defines the id of the user group to insert a new user privilege for. |
privilege_id |
int |
Yes |
FALSE |
Defines the id of the user privilege to be inserted to a user group. |
How it Works
The function runs an SQL INSERT query inserting the 'group_id' and 'privilege_id' to the User Privilege Groups table.
Return Values
Failure:FALSE | An error message will be set.
Success:TRUE | id of new record | A status message will be set.
Example
$group_id = 3;
$privilege_id = 201;
$this->flexi_auth->insert_user_group_privilege($group_id, $privilege_id);
delete_user_group_privilege()
Deletes a user privilege for a group.
Library and Requirements
Available via the standard library.
Function Parameters
delete_user_group_privilege(sql_where)
Help
Name |
Data Type |
Required |
Default |
Description |
sql_where |
string | int | 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 a number is passed, the function will interpret the value as the tables primary key.
|
How it Works
The function generates an SQL WHERE statement from the passed 'sql_where' argument and deletes all matching user privilege users.
Return Values
Failure:FALSE | An error message will be set.
Success:TRUE | A status message will be set.
Examples
$sql_where = 101;
$this->flexi_auth->delete_user_group_privilege($sql_where);
$sql_where = array(...);
$this->flexi_auth->delete_user_group_privilege($sql_where);