-
Notifications
You must be signed in to change notification settings - Fork 56
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
fix(cli): updates 'grants add' command #1474
Conversation
Co-authored-by: Michael Yang <michael.yang@infrahq.com>
internal/cmd/grants_add.go
Outdated
}, | ||
} | ||
cmd.Flags().StringP("destination", "d", "", "[required] Name of destination that identity be given access to") | ||
cmd.Flags().BoolP("group", "g", false, "Marks identity as type 'group'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the -g and -i flags and just look up 1/ identity and 2/ group by name and select the first one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of the ambiguity here, it opens up a lot of possibility for unexpected behavior.
If there is overlap between an identity name and group name you could accidentally grant or revoke access to the wrong subject.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we wanted them to be safely interchangeable we would probably need a unique constraint on the database to prevent adding an identity and a group with the same name.
Co-authored-by: Daniel Nephin <dnephin@gmail.com>
Co-authored-by: Bruce MacDonald <brucewmacdonald@gmail.com>
Co-authored-by: Bruce MacDonald <brucewmacdonald@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking really good, my main concern at the moment is the "group" identity type that opens up the door for adding groups into db tables where they shouldn't be.
internal/cmd/grants_add.go
Outdated
$ infra grants add johndoe@acme.com -d kubernetes.production.default | ||
|
||
# Grant identity access to Infra | ||
$ infra grants add johndoe@acme.com -d infra |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see more examples with roles personally, not something that blocks this change though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
role is optional, it will default to 'connect' so users who don't care about fine-grained roles have to specify them
Summary
user
rather thandestination
as the command argument.2.a)
-i
to be consistent with our termidentity
, as well as theidentity command
b)
-i
can be user, machine, or group. However, if it is a group, you must mark it manually as -g to override detecting the type (user or machine) automaticallyc) flag role is optional
d) flag provider is situationally required: if more than two providers, and identity is a group or user, then it is required. (machines are local only, so no need to provide flag if identity is a machine)
e) you can specify identity as a cmd argument OR flag. same behaviour as login's SERVER
f) removes
machine
anduser
flags.Checklist:
Related Issues
Resolves #1250
Resolves #1393
Resolves #1432