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

feat(query): add user option: disabled #15249

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

TCeason
Copy link
Collaborator

@TCeason TCeason commented Apr 17, 2024

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

If specify DISABLED = TRUE for a user:

The user cannot log in again.

-- root user: u1 can not login
create user u1 identified by '123' with disabled=true;
-- root user: u2 can not login
alter user u2 with disabled=true;
$ bendsql -uu2 -pabc123;
Welcome to BendSQL 0.12.4-unknown.
Connecting to localhost:8000 as user u2.
Error: APIError: RequestError: Start Query failed with status 401 Unauthorized: {"error":{"code":"401","message":"AuthenticateFailure: user u2 is disabled. Not allowed to login"}}

Note

If a period of time passes, need to re-enable the user:

-- root user
ALTER USER u2 with DISABLED = FALSE;

$ bendsql -uu2 -pabc123 --query="select 'Enabled'"
Enabled
  • Fixes #[Link the issue here]

Tests

  • Logic Test

Type of change

  • New Feature (non-breaking change which adds functionality)

This change is Reviewable

If you specify DISABLED = TRUE for a user:

The user cannot log in again.

```sql
-- u1 can not login
create user u1 identified by '123' with disabled=true;
-- u2 can not login
alter user u2 with disabled=true;
$ bendsql -uu2 -pabc123;
Welcome to BendSQL 0.12.4-unknown.
Connecting to localhost:8000 as user u2.
Error: APIError: RequestError: Start Query failed with status 401 Unauthorized: {"error":{"code":"401","message":"AuthenticateFailure: user u2 is disabled. Not allowed to login"}}

```
@TCeason TCeason requested a review from drmingdrmer as a code owner April 17, 2024 03:09
@TCeason TCeason requested review from flaneur2020 and b41sh April 17, 2024 03:09
@github-actions github-actions bot added the pr-feature this PR introduces a new feature to the codebase label Apr 17, 2024
Copy link
Member

@drmingdrmer drmingdrmer left a comment

Choose a reason for hiding this comment

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

Reviewed 17 of 19 files at r1, all commit messages.
Reviewable status: 17 of 19 files reviewed, all discussions resolved (waiting on @b41sh and @flaneur2020)

@TCeason TCeason requested review from b41sh and drmingdrmer April 17, 2024 03:45
Copy link
Member

@drmingdrmer drmingdrmer left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 19 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @flaneur2020 and @TCeason)

@drmingdrmer
Copy link
Member

This is not a big deal but in general, I'd suggest to use enabled in place of disabled, because a double negative user.disabled being false make it more difficult to read.

@TCeason
Copy link
Collaborator Author

TCeason commented Apr 17, 2024

This is not a big deal but in general, I'd suggest to use enabled in place of disabled, because a double negative user.disabled being false make it more difficult to read.

I got you. But this option mainly used to disable user login. So disable is directly.

If use enable, user wants to disable will write enable=false.

@BohuTANG BohuTANG merged commit d3a89f7 into databendlabs:main Apr 17, 2024
72 of 73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants