Module cartridge.roles
Role management (internal module).
The module consolidates all the role management functions:
register_role
, some getters, validate_config and apply_config.
The module is almost stateless, it's only state is a collection of registered roles.
(Added in v1.2.0-20)
Local Functions
get_all_roles () | List all registered roles. |
get_known_roles () | List registered roles names. |
get_enabled_roles (roles) | Roles to be enabled on the server. |
get_role_dependencies (role_name) | List role dependencies. |
validate_config (conf_new, conf_old) | Validate configuration by all roles. |
apply_config (conf) | Apply the role configuration. |
Local Functions
- get_all_roles ()
-
List all registered roles.
Hidden and permanent roles are listed too.
Returns:
- get_known_roles ()
-
List registered roles names.
Hidden roles are not listed as well as permanent ones.
Returns:
- get_enabled_roles (roles)
-
Roles to be enabled on the server.
This function returns all roles that will be enabled
including their dependencies (bot hidden and not)
and permanent roles.
Parameters:
- roles {string,...} or {[string]=boolean,...}
Returns:
- get_role_dependencies (role_name)
-
List role dependencies.
Including sub-dependencies.
Parameters:
- role_name string
Returns:
- validate_config (conf_new, conf_old)
-
Validate configuration by all roles.
Parameters:
Returns:
-
boolean
true
Or
- nil
- table Error description
- apply_config (conf)
-
Apply the role configuration.
Parameters:
- conf table
Returns:
-
boolean
true
Or
- nil
- table Error description