-
Notifications
You must be signed in to change notification settings - Fork 4
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
Event capabilities #215
Event capabilities #215
Conversation
9342e5f
to
c66c38a
Compare
4464bcb
to
2a8a778
Compare
7447138
to
aa0cd44
Compare
aa0cd44
to
813c5e4
Compare
1551e30
to
196745c
Compare
We were checking for manage_options to know whether the user can view the edit page, and for delete_post when handling form submission. We will now standardise on checking for delete_post in all places.
8f2004c
to
0a551ea
Compare
We already checke it above, and the start of the attendees section.
2246235
to
3d2bab7
Compare
3d5116c
to
a9fced4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job, this vastly improves the readability and ensures consistency. Also thanks for the tests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have found one thing that no longer works: When an event doesn't have a host, the creator should be able to edit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to re-approve this. I think this might not change the current behavior but we might need to discuss it wrt when editing an event should remain possible.
if ( $this->stats_calculator->event_has_stats( $event->id() ) ) { | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is too early and/or we need more fine grained controls (which is easy now!) But I think it should be possible to change at least the event description (and maybe the event end, if it should be extended) even when there are stats.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, more fine grained capabilities could make sense, e.g. edit_translation_event_with_stats
. Also agree that it it should be possible to edit certain fields of a past event. I opened #227 to track that.
I'm working on a fix for this |
@psrpinto I'm no longer sure this is true. I think I had tested with an event that already had contributions. |
There was indeed an issue when the event_id is a |
Merging since @akirk had approved, and after his approval there was only the bug fix in the last commit. |
Sorry for missing the re-review, thanks! |
No worries! |
This PR introduces the following custom capabilities, and changes the whole codebase so that these capabilities are used, through calls to
current_user_can()
:create_translation_event
view_translation_event
edit_translation_event
delete_translation_event
There should be no changes to how things work, everything should work the same as before.
References
current_user_can()
map_meta_cap()
friends/includes/class-access-control.php#L52
friends/includes/class-access-control.php#L302
global.wordpress.org/public_html/wp-content/mu-plugins/roles/cross-locale-pte.php#L386