Skip to content

Safeguard remove cap from collisions with roles#530

Merged
schlessera merged 6 commits intowp-cli:mainfrom
BhargavBhandari90:issue-98-remove-cap-improvement
May 6, 2025
Merged

Safeguard remove cap from collisions with roles#530
schlessera merged 6 commits intowp-cli:mainfrom
BhargavBhandari90:issue-98-remove-cap-improvement

Conversation

@BhargavBhandari90
Copy link
Copy Markdown
Contributor

@BhargavBhandari90 BhargavBhandari90 commented Apr 5, 2025

Fixes #98


Let's start with this:


  • Added Role ExMember and capability exmember
  • Now when we try to run comman: wp user remove-cap 1 exmember
  • It will have error ( see the screenshot below ): There is a role similar to 'exmember' capability. Use wp user remove-role instead.
image
@BhargavBhandari90 BhargavBhandari90 requested a review from a team as a code owner April 5, 2025 22:03
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@swissspidy
Copy link
Copy Markdown
Member

Thanks for starting this!

The example you mentioned would make for a good Behat test :-) Would you be up for adding one?

@BhargavBhandari90
Copy link
Copy Markdown
Contributor Author

Sure @swissspidy I'll add the Behat test. Thank you.

@BhargavBhandari90 BhargavBhandari90 changed the title WIP: Improve wp remove-cap command Apr 9, 2025
@BhargavBhandari90
Copy link
Copy Markdown
Contributor Author

@swissspidy added behat test. Let me know if this works.

@swissspidy
Copy link
Copy Markdown
Member

The original suggestion in #98 (comment) was to add a --force flag to ignore the error and still remove the cap, maintaining existing behavior

@BhargavBhandari90
Copy link
Copy Markdown
Contributor Author

@swissspidy I've added force flag. Let me know if that works. Thanks

@swissspidy swissspidy added this to the 2.8.4 milestone May 1, 2025
@schlessera schlessera force-pushed the issue-98-remove-cap-improvement branch from 2f02b38 to 19aa208 Compare May 6, 2025 14:52
@schlessera schlessera merged commit 213611f into wp-cli:main May 6, 2025
43 checks passed
@schlessera schlessera changed the title Improve wp remove-cap command May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants