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

Support multiple roles in user add-role and user remove-role #423

Closed
1 task done
mbucurcf opened this issue Apr 19, 2021 · 4 comments · Fixed by #437
Closed
1 task done

Support multiple roles in user add-role and user remove-role #423

mbucurcf opened this issue Apr 19, 2021 · 4 comments · Fixed by #437

Comments

@mbucurcf
Copy link

Feature Request

Describe your use case and the problem you are facing

A new cli command for toggling user roles.

Describe the solution you'd like

It might be beneficial to add a command to toggle user roles. It could look like:
wp user toggle-role user role1 role2 role3 ... rolen

  • Notice that it could accept more than 1 role
  • If a role is active, it will deactivated it
  • If a role is inactive, it will activate it
@danielbachhuber
Copy link
Member

@mbucurcf Can you share a bit more detail about how you've wanted to use this in the real world?

@mbucurcf
Copy link
Author

mbucurcf commented Sep 8, 2023

@danielbachhuber Hi! The use case was that I needed to add and remove multiple user roles. I.e.:
For a single user, I would need to remove the a, b & c roles, and then add the x, y, z user roles, which would require running the wp user add-role & wp user remove-role a total of 6 time (3 times each).
The number of removed & added roles would differ, but the idea is that you would need to run wp user add-role & wp user remove-role multiple times. On a local machine, it might not be that bad, but sending each command to a remote host, could add quite a bit of overhead (time to write & execute the commands).

@danielbachhuber
Copy link
Member

@mbucurcf What if we updated wp user add-role and wp user remove-role to support multiple roles?

@mbucurcf
Copy link
Author

mbucurcf commented Sep 8, 2023

@danielbachhuber That sounds good as well!

@danielbachhuber danielbachhuber transferred this issue from wp-cli/ideas Sep 8, 2023
@danielbachhuber danielbachhuber transferred this issue from wp-cli/role-command Sep 8, 2023
@danielbachhuber danielbachhuber changed the title New command proposal to toggle user roles : wp user toggle user role1 role2 role3 Support multiple roles in user add-role and user remove-role Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants