Postponed
According to #2350615: [policy, no patch] What changes can be accepted during the Drupal 8 beta phase?, this should be postponed to Drupal 9.
Changing the permission's machine name may require changes across many patches in order to make them consistent and it affects all contrib modules. It is essentially aesthetic.
Problem/Motivation
Drupal currently uses permission with machine names like access all views
, and this is inconsistent with machine names found elsewhere in Drupal (where the convention is snake_case_with_underscores
. To add to the confusion, some permissions have a mixture of spaces and underscores (such as permissions for particular node types, etc.).
Finally, as permissions are now defined in YAML (see #2295469: Add support for static permission definitions with *.permissions.yml), then permissions keys will need to be quoted, and will not match most other YAML keys as seen in Drupal configuration. #2328411: Convert all permissions to yml files and permission callbacks is going to do the full conversion from hook_permission() to YAML, so once that's complete, this issue can be opened.
Proposed resolution
Enforce proper machine names like access_all_views
instead of the machine names with spaces for all permissions.
Remaining tasks
Convert all permission names to machine names. While doing a find-and-replace, pay special attention to comments. Be sure to rename direct references to the permission machine name only, not references to the permission. An imaginary example of the correct way: "Be sure the user can access nodes by granting the access_nodes permission.":
action.permissions.ymlaggregator.permissions.ymlban.permissions.ymlblock.permissions.ymlbook.permissions.ymlcomment.permissions.ymlconfig.permissions.ymlconfig_translation.permissions.ymlcontact.permissions.ymlcontent_translation.permissions.ymlcontextual.permissions.yml- field_test.permissions.yml
- field_ui.permissions.yml
- file.permissions.yml
- filter.permissions.yml
- forum.permissions.yml
- image.permissions.yml
- language.permissions.yml
- locale.permissions.yml
- menu_ui.permissions.yml
- node.permissions.yml
- node_access_test.permissions.yml
- path.permissions.yml
- quickedit.permissions.yml
- responsive_image.permissions.yml
- rest.permissions.yml
- search.permissions.yml
- shortcut.permissions.yml
- simpletest.permissions.yml
- statistics.permissions.yml
- system.permissions.yml
- entity_test.permissions.yml
- form_test.permissions.yml
- module_test.permissions.yml
- router_test.permissions.yml
- taxonomy.permissions.yml
- toolbar.permissions.yml
- tour.permissions.yml
- user.permissions.yml
- views_test_data.permissions.yml
- views.permissions.yml
- views_ui.permissions.yml
Create a custom exception for non-compliant permission names.
Document the requirements for machine names.
User interface changes
None.
API changes
Permissions should only use machine names.