提交 bc49ecc3 编写于 作者: G gccgdb1234

doc: Grant of English version

上级 e8b123b8
...@@ -9,15 +9,54 @@ This document describes how to manage permissions in TDengine. ...@@ -9,15 +9,54 @@ This document describes how to manage permissions in TDengine.
## Create a User ## Create a User
```sql ```sql
CREATE USER use_name PASS 'password'; CREATE USER user_name PASS 'password' [SYSINFO {1|0}];
``` ```
This statement creates a user account. This statement creates a user account.
The maximum length of use_name is 23 bytes. The maximum length of user_name is 23 bytes.
The maximum length of password is 128 bytes. The password can include leters, digits, and special characters excluding single quotation marks, double quotation marks, backticks, backslashes, and spaces. The password cannot be empty. The maximum length of password is 128 bytes. The password can include leters, digits, and special characters excluding single quotation marks, double quotation marks, backticks, backslashes, and spaces. The password cannot be empty.
`SYSINFO` indicates whether the user is allowed to view system information. `1` means allowed, `0` means not allowed. System information includes server configuration, dnode, vnode, storage. The default value is `1`.
For example, we can create a user whose password is `123456` and is able to view system information.
```sql
taos> create user test pass '123456' sysinfo 1;
Query OK, 0 of 0 rows affected (0.001254s)
```
## View Users
To show the users in the system, please use
```sql
SHOW USERS;
```
This is an example:
```sql
taos> show users;
name | super | enable | sysinfo | create_time |
================================================================================
test | 0 | 1 | 1 | 2022-08-29 15:10:27.315 |
root | 1 | 1 | 1 | 2022-08-29 15:03:34.710 |
Query OK, 2 rows in database (0.001657s)
```
Alternatively, you can get the user information by querying a built-in table, INFORMATION_SCHEMA.INS_USERS. For example:
```sql
taos> select * from information_schema.ins_users;
name | super | enable | sysinfo | create_time |
================================================================================
test | 0 | 1 | 1 | 2022-08-29 15:10:27.315 |
root | 1 | 1 | 1 | 2022-08-29 15:03:34.710 |
Query OK, 2 rows in database (0.001953s)
```
## Delete a User ## Delete a User
```sql ```sql
...@@ -40,6 +79,13 @@ alter_user_clause: { ...@@ -40,6 +79,13 @@ alter_user_clause: {
- ENABLE: Specify whether the user is enabled or disabled. 1 indicates enabled and 0 indicates disabled. - ENABLE: Specify whether the user is enabled or disabled. 1 indicates enabled and 0 indicates disabled.
- SYSINFO: Specify whether the user can query system information. 1 indicates that the user can query system information and 0 indicates that the user cannot query system information. - SYSINFO: Specify whether the user can query system information. 1 indicates that the user can query system information and 0 indicates that the user cannot query system information.
For example, you can use below command to disable user `test`:
```sql
taos> alter user test enable 0;
Query OK, 0 of 0 rows affected (0.001160s)
```
## Grant Permissions ## Grant Permissions
...@@ -62,7 +108,7 @@ priv_level : { ...@@ -62,7 +108,7 @@ priv_level : {
} }
``` ```
Grant permissions to a user. Grant permissions to a user, this feature is only available in enterprise edition.
Permissions are granted on the database level. You can grant read or write permissions. Permissions are granted on the database level. You can grant read or write permissions.
...@@ -92,4 +138,4 @@ priv_level : { ...@@ -92,4 +138,4 @@ priv_level : {
``` ```
Revoke permissions from a user. Revoke permissions from a user, this feature is only available in enterprise edition.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册