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

[core] Add CLI commands for listing and inviting users #1408

Merged
merged 5 commits into from
Jul 3, 2019
Merged

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Jul 1, 2019

Patches one of my long time pet peeves - not being able to invite people from the CLI.

Invite

~/my-studio$ sanity help users invite
usage: sanity users invite [EMAIL]

   Invite a new user to the project

Options
  --role Role to invite the user as

Examples
  # Invite a new user to the project (prompt for details)
  sanity users invite

  # Invite user with email "pippi@sanity.io" to the project, prompt for role
  sanity users invite pippi@sanity.io

  # Invite user with email "pippi@sanity.io" to the project, as adminisistrator
  sanity users invite pippi@sanity.io --role administrator

List

~/my-studio$ sanity help users list
usage: sanity users list

   List all users of the project

Options
  --no-invitations Don't include pending invitations
  --no-robots Don't include robots (token users)
  --sort <field> Sort users by specified column: id, name, role, date
  --order <asc/desc> Sort output ascending/descending

Examples
  # List all users of the project
  sanity users list

  # List all users of the project, but exclude pending invitations and robots
  sanity users list --no-invitations --no-robots

  # List all users, sorted by role
  sanity users list --sort role

@kmelve
Copy link
Member

kmelve commented Jul 1, 2019

You and me both

  1. Should it be sanity users in plural (we have documents, projects, versions in plural already)?
  2. Should we ship this without sanity user(s) list

I also wonder if it's more correct to have it be sanity user(s) invite since that's actually what we do by running this command. add would have been more correct if we were actually making a user account from this command.

@rexxars
Copy link
Member Author

rexxars commented Jul 2, 2019

  1. I wish we picked up on this sooner. We also have dataset, hook in singular. Maybe we can rename/deprecate to one form. Should it be singular or plural? 🤔
  2. MVP. This still provides value without a list command.
  3. Invite works for me 🤷‍♂

@kmelve
Copy link
Member

kmelve commented Jul 2, 2019

  1. I think that plural makes sense in most cases since there's a higher chance that you'll be having more than one user, dataset, hook, token, etc.
  2. Ok then!
  3. I think we should go with invite then

Copy link
Member

@kmelve kmelve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added suggestions for rephrasing etc.

packages/@sanity/core/src/commands/user/addUserCommand.js Outdated Show resolved Hide resolved
packages/@sanity/core/src/commands/user/addUserCommand.js Outdated Show resolved Hide resolved
packages/@sanity/core/src/commands/user/addUserCommand.js Outdated Show resolved Hide resolved
packages/@sanity/core/src/commands/user/addUserCommand.js Outdated Show resolved Hide resolved
packages/@sanity/core/src/commands/user/userGroup.js Outdated Show resolved Hide resolved
@rexxars
Copy link
Member Author

rexxars commented Jul 3, 2019

  • Changed from user to users
  • Changed from add to invite
  • Added users list command

Could use a new review!

@rexxars rexxars requested a review from kmelve July 3, 2019 13:20
@rexxars rexxars changed the title [core] Add CLI command for inviting user to project [core] Add CLI commands for listing and inviting users Jul 3, 2019
Copy link
Member

@kmelve kmelve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and it works like a charm!

@rexxars rexxars merged commit e31055b into next Jul 3, 2019
@rexxars rexxars deleted the cli-invite branch July 3, 2019 21:19
bjoerge pushed a commit that referenced this pull request Aug 13, 2019
* [client] Allow overriding "use global api" setting on per-request basis

* [core] Add CLI command for inviting user to project

* [core] `sanity user add` => `sanity users invite`

* [core] Add `sanity users list` command

* [core] Reword help text
rexxars added a commit that referenced this pull request Jan 26, 2022
* [client] Allow overriding "use global api" setting on per-request basis

* [core] Add CLI command for inviting user to project

* [core] `sanity user add` => `sanity users invite`

* [core] Add `sanity users list` command

* [core] Reword help text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants