diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/16.show-users.md b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/16.show-users.md index 1dabf447d9d..7b99e71c11a 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/16.show-users.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/16.show-users.md @@ -16,10 +16,11 @@ SHOW USERS; ```ngql nebula> SHOW USERS; -+---------+ -| Account | -+---------+ -| "root" | -| "user1" | -+---------+ ++---------+-----------------+ +| Account | IP Whitelist | ++---------+-----------------+ +| "root" | "" | +| "user1" | "" | +| "user2" | "192.168.10.10" | ++---------+-----------------+ ``` diff --git a/docs-2.0/7.data-security/1.authentication/2.management-user.md b/docs-2.0/7.data-security/1.authentication/2.management-user.md index 6fa604b321c..5a4e9b53f1f 100644 --- a/docs-2.0/7.data-security/1.authentication/2.management-user.md +++ b/docs-2.0/7.data-security/1.authentication/2.management-user.md @@ -16,13 +16,27 @@ - 语法 ```ngql - CREATE USER [IF NOT EXISTS] [WITH PASSWORD '']; + CREATE USER [IF NOT EXISTS] [WITH PASSWORD ''] [WITH IP WHITELIST ]; ``` + - `IF NOT EXISTS`:检测待创建的用户名是否存在,只有不存在时,才会创建新用户。 + - `user_name`:待创建的用户名。 + - `password`:用户名对应的密码。 + - `ip_list`(企业版):IP 白名单列表。该用户只有通过列表内的 IP 才能连接 Nebula Graph。多个 IP 之间用英文逗号(,)分隔。 + - 示例 ```ngql nebula> CREATE USER user1 WITH PASSWORD 'nebula'; + nebula> CREATE USER user2 WITH PASSWORD 'nebula' WITH IP WHITELIST 192.168.10.10,192.168.10.12; + nebula> SHOW USERS; + +---------+-------------------------------+ + | Account | IP Whitelist | + +---------+-------------------------------+ + | "root" | "" | + | "user1" | "" | + | "user2" | "192.168.10.10,192.168.10.12" | + +---------+-------------------------------+ ``` ## 授权用户(`GRANT ROLE`) @@ -116,20 +130,34 @@ nebula> CHANGE PASSWORD user1 FROM 'nebula' TO 'nebula123'; ``` -## 修改用户密码(`ALTER USER`) +## 修改用户密码和 IP 白名单(`ALTER USER`) -执行`ALTER USER`语句可以修改用户密码,修改时不需要提供旧密码。当前仅** God **角色用户(即`root`用户)能够执行`ALTER USER`语句。 +执行`ALTER USER`语句可以修改用户密码和 IP 白名单,修改时不需要提供旧密码。当前仅** God **角色用户(即`root`用户)能够执行`ALTER USER`语句。 - 语法 ```ngql - ALTER USER WITH PASSWORD ''; + ALTER USER WITH PASSWORD '' [WITH IP WHITELIST ]; ``` - 示例 + !!! enterpriseonly + + 没有使用`WITH IP WHITELIST`时,表示取消 IP 白名单,用户使用任何 IP 都可以连接 Nebula Graph。 + ```ngql - nebula> ALTER USER user1 WITH PASSWORD 'nebula'; + nebula> ALTER USER user2 WITH PASSWORD 'nebula'; + nebula> SHOW USERS; + +---------+--------------+ + | Account | IP Whitelist | + +---------+--------------+ + | "root" | "" | + | "user1" | "" | + | "user2" | "" | + +---------+--------------+ + + nebula> ALTER USER user2 WITH PASSWORD 'nebula' WITH IP WHITELIST 192.168.10.10; ``` ## 删除用户(`DROP USER`) @@ -166,11 +194,11 @@ ```ngql nebula> SHOW USERS; - +-----------+ - | Account | - +-----------+ - | "test1" | - | "test2" | - | "test3" | - +-----------+ + +---------+-----------------+ + | Account | IP Whitelist | + +---------+-----------------+ + | "root" | "" | + | "user1" | "" | + | "user2" | "192.168.10.10" | + +---------+-----------------+ ```