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

Feature Request: Add "user role" to the query API #1129

Closed
bacoords opened this issue Mar 22, 2024 · 2 comments
Closed

Feature Request: Add "user role" to the query API #1129

bacoords opened this issue Mar 22, 2024 · 2 comments
Labels
[Type] Enhancement New feature or request

Comments

@bacoords
Copy link
Contributor

Feature request idea, though not sure how feasible it actually is. Add a "user role" parameter to the query API and blueprints API. As of now, the only Playground experience as an admin.

Use cases:
A WordPress demo or teaching experience where you want to launch Playground as an editor or author.
Testing PRs (especially from Guteberg) where the role of the user effects their ability to perform tasks.
Demoing plugins with a custom role type that is specific to that plugin (SEO or Store Owner for example)

@adamziel adamziel added [Type] Enhancement New feature or request Query API labels Mar 22, 2024
@adamziel adamziel added this to the Innovative Developer Tools milestone Mar 22, 2024
@adamziel
Copy link
Collaborator

adamziel commented Mar 23, 2024

That indeed sounds useful @bacoords! I know this isn't as handy as a query API parameter, but perhaps a custom blueprint would be helpful? For example:

{
  "landingPage": "/wp-admin/",
  "steps": [
    {
      "step": "runPHP",
      "code": "<?php require '/wordpress/wp-load.php'; $user_id = wp_create_user('myuser', 'mypass', 'myuser@localhost'); (new WP_User($user_id))->set_role('editor');"
    },
    {
      "step": "login",
      "username": "myuser",
      "password": "mypass"
    }
  ]
}

Preview

@bacoords
Copy link
Contributor Author

Thanks @adamziel I completely forgot that you could pass the Blueprint API via the URL - that's basically what I was wanting.

I think if this were to remain an open issue, the feature request would maybe be something like changing the login step to allowing a user role or other user info than username/password?

But since it can be done via runPHP, you could definitely close the issue (and if anyone comes looking for how to do it, at least this will be here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement New feature or request
2 participants