Skip to content

[CLI-1954] Allow users with no role bindings to log in#1478

Merged
Brian Strauch (brianstrauch) merged 2 commits intomainfrom
CLI-1954
Oct 25, 2022
Merged

[CLI-1954] Allow users with no role bindings to log in#1478
Brian Strauch (brianstrauch) merged 2 commits intomainfrom
CLI-1954

Conversation

@brianstrauch

Checklist

  1. [CRUCIAL] Is the change for CP or CCloud functionalities that are already live in prod?
    • yes: ok

What

When a user is invited to an organization, they initially have 0 role-bindings (no access). They aren't allowed to view the list of environments, so their list of environments is [] on login. Previously the CLI would error with "not logged in", but this PR allows these users to log in, replicating the behavior of the UI. Bonus: Refactored a few lines to prevent nil pointer errors.

References

https://confluentinc.atlassian.net/browse/CLI-1954

Test & Review

Manual verification, all tests still pass.

@brianstrauch Brian Strauch (brianstrauch) requested a review from a team as a code owner October 25, 2022 06:45
Copy link
Member

Choose a reason for hiding this comment

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

👍

switch credType {
case Username:
return c.State != nil && c.State.AuthToken != "" && c.State.Auth != nil && c.State.Auth.Account != nil && c.State.Auth.Account.Id != ""
return c.GetAuthToken() != "" && c.GetEnvironment().GetId() != ""

Choose a reason for hiding this comment

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

Significant readability improvement!

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.

2 participants