Problem/Motivation
Recurring Events provides permissions for cloning/editing events. When viewing a given series or instance, tabs are shown depending on the associated permission; that's working. However, if you navigate to the Event Series or Event Instances listing pages, the Operations pull down button shows some operations regardless of the permission.
Steps to reproduce
- Install and enable the module.
- Add a couple of event series (and thus event instances).
- Create a role that has access to view the event series and instance overview pages, but does NOT have any create/update/delete/clone permissions for events.
- Add a user with that role and log in as that user.
- Navigate to the Event Series listing page (/admin/events/series). Observe that the "Clone" and "Add instance" operations are incorrectly shown.
- Navigate to the Event Instances listing page (/admin/events/instances). Observe that the "Clone" and "Edit" operations are incorrectly shown.
Proposed resolution
Add permission checks to recurring_events_entity_operation() in recurring_events.module.
Use the 'update' operation instead of the 'edit' operation for checks in EventSeriesAccessControlHandler::checkAccess and EventInstanceAccessControlHandler::checkAccess.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | recurring_events-clone_operations_permissions-3328907-2.patch | 901 bytes | greggmarshall |
Issue fork recurring_events-3328907
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
greggmarshallPatch to implement proposed resolution.
Comment #5
muriqui commentedSetting to "needs work" because the other operations links seem to have similar issues. Testing on a clean install, "Add instance" is shown for series and "Edit" is shown for instances regardless of permission. Also noticed that the entity access control handlers are using the 'edit' operation (it's 'update' for entities), and are allowing access for any unknown operation (should be neutral, I believe). I'm updating the issue description and will continue work on the MR to resolve these.
Comment #6
muriqui commentedComment #7
muriqui commentedComment #8
muriqui commentedI think that should do it.
Comment #9
muriqui commentedGroupEventSeriesPermissionProvider::getPermission()'s only function was to change the $operation from 'edit' to 'update', which is unnecessary now because this MR changes recurring_events to use 'update' as expected.
Comment #10
owenbush commentedThanks for the work on this all. The MR looks good to me and I'll get around to testing it when I have my local dev back up and running.
Comment #13
owenbush commentedThis has been merged into the latest dev branches, thank you for all the help on this.