Problem/Motivation
Workbench Access provides a "Workbench Section: {access scheme name}" views field plugin (also a filter plugin) for each access scheme configured at /admin/config/workflow/workbench_access
.
Let's assume that we have an access scheme named "Division" that is configured to use the vocabulary named "Business Group" (which has terms "Sales" and "Manufacturing"). In this example, there would be a views field plugin named "Workbench Section: Division" available for us to add to a view. Let's suppose we have added this views field to a view.
Suppose we have a user named "Sara" whose user account has a role that does not have the "Bypass Workbench Access permissions" permission, and who's workbench access section is "Manufacturing". In the view, the "Workbench Section: Division" field for the "Sara" role would display "Manufacturing", as expected.
Suppose we have another user named "Jane" whose user account has a role that does have the "Bypass Workbench Access permissions" permission, and who's workbench access section is "Sales". In the view, the "Workbench Section: Division" field would display "Business Group" instead of "Sales", because Jane has the "Bypass Workbench Access permissions" permission, and therefore has access to all content controlled by that workbench section. (in a sense, the view field shows the "effective" workbench section, as opposed to the "assigned" workbench section)
I'd like to propose that we add a "Workbench Assigned Section: {access scheme name}" views field plugin, which would always display the assigned workbench access section, i.e.: "Manufacturing" for Sara, and "Sales" for Jane.
Steps to reproduce
- Download Drupal 9.3.15, install using the Standard install profile, and log in as an administrator.
composer require 'drupal/workbench_access:1.x-dev@dev'
. Go to /admin/modules
and enable the "Workbench access" module.
- Go to
/admin/people/permissions/content_editor
, check "Allow all members of this role to be assigned to Workbench Access sections", check "View Workbench Access information", and click "Save permissions".
- Go to
/admin/structure/taxonomy/add
and add a vocabulary named "Business Group". Add terms "Sales" and "Manufacturing".
- Go to
/admin/config/workflow/workbench_access/access_scheme/add
and add an access scheme:
- Label = "Division"
- Plural Label = "Divisions"
- Access scheme = "Taxonomy"
- Click "Save"
- Vocabularies = "Business Group"
- Click "Save" again
- Go to
/admin/people/create
, add a user named "Sara", with the roles "Authenticated user" and "Content editor". Click "Create new account". In the "Created a new user account for Sara" message, click "Sara", then the "Workbench Access" tab, check = "- Manufacturing" in the Assigned sections control, and click "Save".
- Go to
/admin/people/create
, add a user named "Jane", with the roles "Authenticated user" and "Administrator". Click "Create new account". In the "Created a new user account for Jane" message, click "Jane", then the "Workbench Access" tab, check "- Sales" in the Assigned sections control, and click "Save".
- Go to
/admin/config/development/performance
and click "Clear all caches"
- Go to
/admin/structure/views/view/user_admin_people/edit/page_1
. Next to "Fields", click "Add". Check "Workbench Section: Division", and click "Add and configure fields". Click "Apply" to use the default settings. Click "Save" to save the view.
- Go to
/admin/people
. Note there is a "Workbench Section: Division" column. Note that "Sara" shows "Manufacturing" in that column. Note that "Jane" (and your administrator user, if applicable) both show "Business Group".
- This ticket proposes adding a new field that would show "Sales" for Jane instead of "Business Group" (and an empty cell for users who do not have an explicit workbench section, e.g.: your administrator user)
Proposed resolution
Add views field to display a user's *assigned* Workbench Section.
Remaining tasks
- Review and feedback
- RTBC and feedback
- Commit and release
User interface changes
Adds a views field plugin, "Workbench Assigned Section", which shows the assigned workbench section, rather than the effective workbench section.
API changes
None.
Data model changes
None.