"View published content" permission listed in different section in views.

Created on 20 March 2023, almost 2 years ago
Updated 9 April 2023, over 1 year ago

Problem/Motivation

When viewing permissions at /admin/people/permissions, the "View published content" permission is under Node. But when selecting a permission access restriction for a view display, the "View published content" permission is listed under System.

Steps to reproduce

  1. Go to /admin/people/permissions,
  2. Press Ctrl+F
  3. Search for "View published content"
  4. See it's under Node
  5. Enable Views UI
  6. Go to /admin/structure/views/view/content
  7. Click to change the "Access the Content overview page" permission for a display
  8. The "View published content" permission is under System, not Node.

Proposed resolution

Find if there are any other permissions listed differently, then make them consistent.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

10.1 ✨

Component
Views UIΒ  β†’

Last updated 17 days ago

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @solideogloria
  • πŸ‡»πŸ‡³Vietnam tra.duong

    The permission for "View published content" is belong to "system" module (yes, the "system" is also a module).

    1. Go to /admin/people/permissions,

    The permission in this page is changed on purposed
    When access:
    "core/modules/user/src/Form/UserPermissionsForm.php::permissionsByProvider()"
    You will see

        // Move the access content permission to the Node module if it is installed.
        // @todo Add an alter so that this section can be moved to the Node module.
        if ($this->moduleHandler->moduleExists('node')) {
          // Insert 'access content' before the 'view own unpublished content' key
    

    After have a check, there is a glitch of "core/modules/views/src/Plugin/views/display/DisplayPluginBase.php::buildOptionsForm()"
    It does not replace/move the 'access content' permission from "system" to "node" like it does on permission page.

    That's my checks.

  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    Nice digging @tra.duong , thanks!

    To me this isn't a bug in Views. Views is displaying the correct information. As pointed out by the comment on UserPermissionsForm.php::permissionsByProvider(), the altering should be done by the node module and then it would be the same everywhere. But currently we lack the correct alters to be able to to that, see #763074: Add hook_permission_alter() so that permission descriptions and other properties can be altered β†’

    So if we care about getting this consistent between Views and the permissions matrix (but still inconsistent should this be listed anywhere else) we would need to duplicate the logic from UserPermissionsForm.php::permissionsByProvider to \Drupal\user\Plugin\views\access\Permission::buildOptionsForm. Since the logic is contained in a protected function on that form, we can't reuse it either Β―\_(ツ)_/Β―

Production build 0.71.5 2024