\GB_User_Roles
GeniBase User Roles.
The role option is simple, the structure is organized by role name that store
the name in value of the 'name' key. The capabilities are stored as an array
in the value of the 'capability' key.
array (
'rolename' => array (
'name' => 'rolename',
'capabilities' => array()
)
)
Synopsis
class GB_User_Roles
{
- // members
- public $roles;
- public array $role_objects = ;
- public array $role_names = ;
- public $role_key;
- public bool $use_db = true;
- private static GB_User_Roles $_instance;
- // methods
- public void __construct()
- public static GB_User_Roles getInstance()
- protected void _init()
- public void reinit()
- public GB_Role|null add_role()
- public void remove_role()
- public void add_cap()
- public void remove_cap()
- public GB_Role|null get_role()
- public array get_names()
- public bool is_role()
Violations
Checkstyle
Line | Column | Severity | Message |
---|---|---|---|
1004 | 20 | warning | Property name "$_instance" should not be prefixed with an underscore to indicate visibility |
1025 | 33 | error | TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL" |
1043 | 15 | warning | Method name "_init" should not be prefixed with an underscore to indicate visibility |
1053 | 9 | error | Inline control structures are not allowed |
1076 | 9 | error | Inline control structures are not allowed |
1082 | 9 | error | Inline control structures are not allowed |
1112 | 12 | error | Method name "GB_User_Roles::add_role" is not in camel caps format |
1114 | 9 | error | Inline control structures are not allowed |
1121 | 9 | error | Inline control structures are not allowed |
1137 | 12 | error | Method name "GB_User_Roles::remove_role" is not in camel caps format |
1139 | 9 | error | Inline control structures are not allowed |
1146 | 9 | error | Inline control structures are not allowed |
1149 | 9 | error | Inline control structures are not allowed |
1166 | 12 | error | Method name "GB_User_Roles::add_cap" is not in camel caps format |
1168 | 9 | error | Inline control structures are not allowed |
1172 | 9 | error | Inline control structures are not allowed |
1187 | 12 | error | Method name "GB_User_Roles::remove_cap" is not in camel caps format |
1189 | 9 | error | Inline control structures are not allowed |
1193 | 9 | error | Inline control structures are not allowed |
1207 | 12 | error | Method name "GB_User_Roles::get_role" is not in camel caps format |
1209 | 9 | error | Inline control structures are not allowed |
1211 | 9 | error | Expected 1 space after ELSE keyword; newline found |
1211 | 9 | error | Inline control structures are not allowed |
1223 | 12 | error | Method name "GB_User_Roles::get_names" is not in camel caps format |
1238 | 12 | error | Method name "GB_User_Roles::is_role" is not in camel caps format |
Members
private
- $_instance
—
GB_User_Roles
Singular instance of class.
public
- $role_key
—
string
Option name for storing role list. - $role_names
—
array
List of role names. - $role_objects
—
array
List of the role objects. - $roles
—
array
List of roles and capabilities. - $use_db
—
bool
Whether to use the database for retrieval and storage.
Methods
protected
- _init() — Set up the object properties.
public
- __construct() — Constructor
- add_cap() — Add capability to role.
- add_role() — Add role name with capabilities to list.
- getInstance() — Get singular instance of class.
- get_names() — Retrieve list of role names.
- get_role() — Retrieve role object by name.
- is_role() — Whether role name is currently in the list of available roles.
- reinit() — Reinitialize the object
- remove_cap() — Remove capability from role.
- remove_role() — Remove role by name.
History
-
2017-05-18T21:45:34+00:00 (commit #62babba)
Author: Limych (andrey@khrolenok.ru) / Commiter: Limych (andrey@khrolenok.ru)
Pre 3.0.0
-
2017-05-16T19:52:59+00:00 (commit #fd0a296)
Author: Limych (andrey@khrolenok.ru) / Commiter: Limych (andrey@khrolenok.ru)
PSR-2 applied
-
2016-01-25T17:45:50+00:00 (commit #97e2af2)
Author: Limych (andrey@khrolenok.ru) / Commiter: Limych (andrey@khrolenok.ru)
Pre v.3.0