-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
RBAC: role assignment creation #553
Conversation
|
||
return client.users.list(filter=(' and ').join(sub_filters)) | ||
|
||
def create_user(user_principal_name, display_name, password, mail_nick_name=None, #pylint: disable=too-many-arguments |
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.
mail_nick_name [](start = 61, length = 14)
minor naming: should be mail_nickname
|
elif len(role_defs) > 1: | ||
raise CLIError('More than one roles match the given name {}'.format(role)) | ||
ids = [r.id for r in role_defs] | ||
err = "More than one roles match the given name '{}'. Please pick a value from '{}'" |
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.
More than one roles match the given name [](start = 19, length = 40)
Think this should be "More than one role matches the given name" for grammar
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.
"More than one roles match the given name '{}'. Please pick a value from '{}'" [](start = 18, length = 78)
If I fall into this case, how would I resolve it with the error message that's provided?
Do I have to provide resource-id, set a different role, etc.?
If it would be clear for the context of the user of this command the action they need to take, it's fine. I was asking for clarification as I'm not sure the error message is the clearest.
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 name conflicts should be very rare. If it happens, you use az role list
to see the role details, pick the one, and still use --role
parameter but use the role id for value, which should be a unique guid
🕐 |
uuid.UUID(role) | ||
role_id = role | ||
except ValueError: | ||
pass |
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.
The preferred place to put argument validation is either in a validator (for validation that needs all parsed argument values) or in a type parameter (for individual argument values). This way, you get a consistent error message and usage statement instead of a single line of error text.
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.
This is the only place we need to sniff the role-id at this moment, once i have more than 1, i will maintain the consistency by sharing the code, and i will consider validators.
423e738
to
b86bef9
Compare
|
Notes:
user create
so that i can test end to endxplat's
cli's