Skip to content
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

Add origin and exclude-role-names filters to list-caps command #445

Merged
merged 1 commit into from Nov 16, 2023

Conversation

shawnhooper
Copy link
Contributor

@shawnhooper shawnhooper commented Nov 15, 2023

This PR adds two new arguments to the list-caps command.

Capability Origin

Fixes: #99

The first is the --origin= attribute which allows you to specify:

  • all (default) Returns all capabilities
  • role returns only the capabilities inherited because a user has a role
  • user returns only the capabilities directly assigned to a user (ex: `wp user add-cap bob newcap)

Exclude Role Names

The second is a flag --exclude-role-names that removes a capability from the returned list if it matches the name of a role. For example, if a user has the contributor role, the value 'contributor' would not be returned if --exclude-role-names was specified, but the individual capabilities that role included, like read would be.

@shawnhooper shawnhooper requested a review from a team as a code owner November 15, 2023 21:09
@danielbachhuber danielbachhuber merged commit 67be24e into wp-cli:main Nov 16, 2023
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need a way to distinguish between a user's direct capabilities and those inherited from their role
3 participants