role
Creates, updates, ensures or deletes a role with its policies and limitations, or assigns it to users and user groups or takes it from them.
A step of a YAML migration with type: role. The class expMigrationStepRole (kernel/classes/migration/steps/expmigrationsteprole.php) is registered in settings/migration.ini [StepSettings] StepTypeList[role].
Modes
mode: is one of create, update, ensure, delete, assign, unassign; every step names one.
Keys
| Key | Type | Modes | Default | What it is |
|---|---|---|---|---|
role | identifier (role) | update, delete, assign, unassign | the role: its name or id | |
name | string | create, update, ensure | the name of the role; ensure finds the role by it (update: a new name) | |
policies | list | create, ensure | the policies, each a map: module, function (* for all) and limitations (identifier => list of values); ensure adds those the role does not have | |
add_policies | list | update | policies to add, as in policies: | |
remove_policies | list | update | policies to remove, each a map: module and function (without function: every policy of the module) | |
users | list | assign, unassign | the users: logins, ids or remote:<remote id> | |
groups | list | assign, unassign | the user groups (or other objects): object identifiers | |
subtree | identifier (node) | assign, unassign | the assignment is limited to the subtree of this node | |
section | identifier (section) | assign, unassign | the assignment is limited to this section | |
missing | string: fail, skip | update, delete, assign, unassign | "fail" | what happens when the role is not there: fail (the default) or skip |
Besides these, every step takes the keys of the engine: type, mode, if, references, environments, engines and comment (the file format). A key of type identifier names a node, an object or another part of the installation by id, remote id, path or name (identifiers).
Values for references
references: { <name>: <value> } keeps a value of the step's result as ${ref.<name>} for the steps and migrations after it:
| Value | What it is |
|---|---|
role_id | the id of the role |
name | its name |
created | true when the step created the role |
changed | true when the step changed it (created, updated, deleted, assigned or unassigned) |
Undoing
Some steps of this type undo themselves when their migration is rolled back without down: (the class says which); a migration with any other step of it needs down: or a rollback to its caption.
Caches it touches (cleared after the run): user_info_cache, content.
Example
- type: role
mode: ensure
name: News editor
policies:
- { module: content, function: read }
- { module: content, function: edit, limitations: { Class: [ news_article ], Subtree: [ "path:news" ] } }
- type: role
mode: assign
role: News editor
groups: [ "remote:news-editors" ]
subtree: "path:news"Related
Generated by ./console exp:help:examples from settings/migration.ini, kernel/classes/migration/steps/expmigrationsteprole.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.