Provides access and utility methods for handling role storage in the database.
MY_Model
Roles
| Role_model | Provides access and utility methods for handling role storage in the database. |
| Functions | |
| __construct() | Class constructor. |
| find() | Returns a single role, with an array of permissions. |
| find_by_name() | Locates a role based on the role name. |
| update() | A simple update of the role. |
| can_delete_role() | Verifies that a role can be deleted. |
| delete() | Deletes a role. |
| default_role_id() | Returns the id of the default role. |
| get_role_permissions() | Finds the permissions and role_permissions array for a single role. |
function delete( $id = 0, $purge = false )
Deletes a role. By default, it will perform a soft_delete and leave the permissions untouched. However, if $purge == TRUE, then all permissions related to this role are also deleted.
| $id | An integer with the role_id to delete. |
| $purge | If false, will perform a soft_delete. If true, will remove the role and related permissions from db. |
true/false
Class constructor.
public function __construct()
Returns a single role, with an array of permissions.
public function find( $id = null )
Locates a role based on the role name.
public function find_by_name( $name = null )
A simple update of the role.
public function update( $id = null, $data = null )
Verifies that a role can be deleted.
public function can_delete_role( $role_id = )
Deletes a role.
function delete( $id = 0, $purge = false )
Returns the id of the default role.
public function default_role_id()
Finds the permissions and role_permissions array for a single role.
public function get_role_permissions( & $role )