-
Notifications
You must be signed in to change notification settings - Fork 186
PHPCS: Allowlist custom capabilities instead of disabling the sniff #583
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
base: trunk
Are you sure you want to change the base?
Changes from 5 commits
e7b6f47
0502eec
61daa28
97d0f6a
c12f07c
6ee71cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -291,7 +291,7 @@ public static function disable_own_post_editing( $caps, $cap, $args, $user ) { | |
| } | ||
|
|
||
| // Bail if user isn't a moderator. | ||
| if ( ! user_can( $user->ID, 'photos_moderator' ) ) { | ||
| if ( empty( $caps['edit_photos'] ) ) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this needs a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm.. actually... this is a I think the proper check here would be to be either requiring a cap by appending to $caps, or appending
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose it depends on how we want this to behave. It sets If we want super admins to be able to edit their own submissions we'd append a |
||
| return $caps; | ||
| } | ||
|
|
||
|
|
||
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 not really a fan of this style of nitty-gritty capability listing.. but I'm not veto'ing this.
Perhaps we can do a middle-ground of warning severity or notice severity, and not error?
Let's also document it here that PRs can update the list as needed, and this isn't a strict requirement, rather just to catch those typos.