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): support describe user statement #16579

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

b41sh
Copy link
Member

@b41sh b41sh commented Oct 9, 2024

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

Summary

  • support describe user statement.
  • show users add network_policy, password_policy and must_change_password column.

for example:

root@0.0.0.0:48000/default> CREATE NETWORK POLICY test_network_policy ALLOWED_IP_LIST=('192.168.100.0/24');

root@0.0.0.0:48000/default> CREATE PASSWORD POLICY test_password_policy
    PASSWORD_MIN_LENGTH = 12
    PASSWORD_MAX_LENGTH = 24
    PASSWORD_MIN_UPPER_CASE_CHARS = 2
    PASSWORD_MIN_LOWER_CASE_CHARS = 2
    PASSWORD_MIN_NUMERIC_CHARS = 2
    PASSWORD_MIN_SPECIAL_CHARS = 2
    PASSWORD_MIN_AGE_DAYS = 1
    PASSWORD_MAX_AGE_DAYS = 30
    PASSWORD_MAX_RETRIES = 3
    PASSWORD_LOCKOUT_TIME_MINS = 30
    PASSWORD_HISTORY = 5
    COMMENT = 'test comment';

root@0.0.0.0:48000/default> CREATE USER user10 IDENTIFIED BY '123456abcDE@#' WITH SET PASSWORD POLICY='test_password_policy', SET NETWORK POLICY='test_network_policy';

root@0.0.0.0:48000/default> DESC USER user10;

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│  name  │ hostname │       auth_type      │ default_role │  roles │ disabled │    network_policy   │    password_policy   │ must_change_password │
│ String │  String  │        String        │    String    │ String │  Boolean │   Nullable(String)  │   Nullable(String)   │   Nullable(Boolean)  │
├────────┼──────────┼──────────────────────┼──────────────┼────────┼──────────┼─────────────────────┼──────────────────────┼──────────────────────┤
│ user10 │ %        │ double_sha1_password │              │        │ false    │ test_network_policy │ test_password_policy │ NULL                 │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
1 row read in 0.091 sec. Processed 0 row, 0 B (0 row/s, 0 B/s)


root@0.0.0.0:48000/default> SHOW USERS;

┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│   name  │ hostname │       auth_type      │ is_configured │  default_role │     roles     │ disabled │    network_policy   │    password_policy   │ must_change_password │
│  String │  String  │        String        │     String    │     String    │     String    │  Boolean │   Nullable(String)  │   Nullable(String)   │   Nullable(Boolean)  │
├─────────┼──────────┼──────────────────────┼───────────────┼───────────────┼───────────────┼──────────┼─────────────────────┼──────────────────────┼──────────────────────┤
│ default │ %        │ no_password          │ YES           │ account_admin │ account_admin │ false    │ NULLNULLNULL                 │
│ root    │ %        │ no_password          │ YES           │ account_admin │ account_admin │ false    │ NULLNULLNULL                 │
│ user10  │ %        │ double_sha1_password │ NO            │               │               │ false    │ test_network_policy │ test_password_policy │ NULL                 │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
3 rows read in 0.069 sec. Processed 3 rows, 472 B (43.49 rows/s, 6.68 KiB/s)
  • fixes: #[Link the issue here]

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

@b41sh b41sh requested a review from TCeason October 9, 2024 13:48
@github-actions github-actions bot added the pr-feature this PR introduces a new feature to the codebase label Oct 9, 2024
@b41sh b41sh requested a review from sundy-li October 9, 2024 13:48
@b41sh b41sh added this pull request to the merge queue Oct 10, 2024
@BohuTANG BohuTANG removed this pull request from the merge queue due to a manual request Oct 10, 2024
@BohuTANG BohuTANG merged commit c33c72b into databendlabs:main Oct 10, 2024
74 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.

3 participants