@@ -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
CREATEUSERuse_namePASS'password';
CREATEUSERuser_namePASS'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.
- 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>alterusertestenable0;
QueryOK,0of0rowsaffected(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.