Is that a perm?
A simple access control library for CodeIgniter. Here's a quick rundown of the features:
- Use group and/or role-based controls
- Validate single or multiple required roles
- Validate hierarchical or optional roles
- Automatic database configuration
You can set group or role-based controls.
You can use the name of the group or the group's ID
$this->perm->in_group(3);
or:
$this->perm->in_group('admin');
You can validate a single role by using the name of the role in the has_role
method:
$this->perm->has_role('users_create');
You can also pass multiple required roles as an array:
$required_roles = array('admin', 'users');
$this->perm->has_roles($required_roles);
Note: You can use
has_role()
andhas_roles()
interchangeably. Thehas_roles()
method maps tohas_role()
.
If you want to pass a hierarchy of roles, you can do that by separating each role with a colon (:
). If a user has any of the roles in the hierarchy, the method will return true.
$this->perm->has_role('admin:users:users_create');