Skip to content

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 added command:user Related to 'user' command command:user-list-caps Related to 'user list-caps' command labels Nov 16, 2023
@danielbachhuber danielbachhuber added this to the 2.5.7 milestone Nov 16, 2023
@danielbachhuber danielbachhuber self-requested a review November 16, 2023 10:21
@danielbachhuber danielbachhuber merged commit 67be24e into wp-cli:main Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:user Related to 'user' command command:user-list-caps Related to 'user list-caps' command

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