-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure users with the perm "CiviEvent: access CiviEvent " can edit events they have created. #12424
Conversation
(Standard links)
|
@alifrumin Are you able to add a test? |
absolutely |
@alifrumin I've checked the code over and your logic looks sound. I see that the function |
this may relate #11716 |
@alifrumin failing test is related |
Yeah I know, I got distracted by some other work but I hope to work on this test this week |
When I ran just this test locally, it passed but when I ran all the tests in the tests/phpunit/CRM/Event/BAO folder this test failed because the static $permissions in the CRM_Event_BAO_Event:CheckPermissions function was throwing things off. We changed the static $permissions to use the Civi::$statics[CLASS]['permissions'] as documented by Tim here and unset it in the test here and now the test is passing. @colemanw could you take a look at this again? It is ready to be merged from our perspective. |
@eileenmcnaughton thank you for your diligence. |
Hi @alifrumin I've just had a look at this - agree that it is an improvement. However with the introduction of this there are a couple of other issues that come up:
|
On second thoughts, I think we should merge this now. I'm working on an extension that enhances events functionality and this
@eileenmcnaughton @colemanw Are one of you happy to merge this? |
Ok merged - any tickets to update? |
Thank you @mattwire and @eileenmcnaughton! No tickets to update that I know of. @mattwire 1 and 2 are very good points. If you start pr's for them let me know and I am happy to test them/ If I come into some extra time I will give it a go. |
Overview
Users with the permission "CiviEvent: access CiviEvent " should be able to edit events they create (regardless of whether they have the permission "CiviEvent: edit all events").
Before
Users with the permission "CiviEvent: access CiviEvent" could create but not edit their events.
After
Users with the permission "CiviEvent: access CiviEvent" can create AND edit their events.
Technical Details
It looks like this commit 5836c35#diff-57f730edc03717d188e539c92cd1a3d9L2047 changed the way that the $createdEvents array was formatted so that the key was the event id and the value was the title of the event while this line https://github.com/civicrm/civicrm-core/blob/5.2.1/CRM/Event/BAO/Event.php#L2126 expects the value to be the event id.