Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
53b031f2
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
53b031f2
编写于
5月 13, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into feature/dnode
上级
8ca1420f
76584010
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
26 deletion
+49
-26
tests/system-test/0-others/user_control.py
tests/system-test/0-others/user_control.py
+47
-24
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+2
-2
未找到文件。
tests/system-test/0-others/user_control.py
浏览文件 @
53b031f2
...
...
@@ -6,6 +6,7 @@ import traceback
from
util.log
import
*
from
util.sql
import
*
from
util.cases
import
*
from
util.dnodes
import
*
PRIVILEGES_ALL
=
"ALL"
...
...
@@ -161,6 +162,8 @@ class TDTestCase:
for
sql
in
sqls
:
tdSql
.
error
(
sql
)
tdSql
.
execute
(
"DROP USER u1"
)
def
__alter_pass_sql
(
self
,
user
,
passwd
):
return
f
'''ALTER USER
{
user
}
PASS '
{
passwd
}
' '''
...
...
@@ -237,7 +240,7 @@ class TDTestCase:
f
"DROP user
{
self
.
__user_list
[
0
]
}
,
{
self
.
__user_list
[
1
]
}
"
,
f
"DROP users
{
self
.
__user_list
[
0
]
}
{
self
.
__user_list
[
1
]
}
"
,
f
"DROP users
{
self
.
__user_list
[
0
]
}
,
{
self
.
__user_list
[
1
]
}
"
,
"DROP user root"
,
#
"DROP user root",
"DROP user abcde"
,
"DROP user ALL"
,
]
...
...
@@ -267,7 +270,7 @@ class TDTestCase:
# 查看用户
tdLog
.
printNoPrefix
(
"==========step2: show user test"
)
tdSql
.
query
(
"show users"
)
tdSql
.
checkRows
(
self
.
users_count
+
2
)
tdSql
.
checkRows
(
self
.
users_count
+
1
)
# 密码登录认证
self
.
login_currrent
(
self
.
__user_list
[
0
],
self
.
__passwd_list
[
0
])
...
...
@@ -282,30 +285,36 @@ class TDTestCase:
self
.
login_err
(
self
.
__user_list
[
0
],
self
.
__passwd_list
[
0
])
self
.
login_currrent
(
self
.
__user_list
[
0
],
f
"new
{
self
.
__passwd_list
[
0
]
}
"
)
tdDnodes
.
stop
(
1
)
tdDnodes
.
start
(
1
)
tdSql
.
query
(
"show users"
)
tdSql
.
checkRows
(
self
.
users_count
+
1
)
# 普通用户权限
# 密码登录
_
,
user
=
self
.
user_login
(
self
.
__user_list
[
0
],
f
"new
{
self
.
__passwd_list
[
0
]
}
"
)
with
taos_connect
(
user
=
self
.
__user_list
[
0
],
passwd
=
f
"new
{
self
.
__passwd_list
[
0
]
}
"
)
as
conn
:
user
=
conn
# 不能创建用户
tdLog
.
printNoPrefix
(
"==========step5: normal user can not create user"
)
user
.
error
(
"create use utest1 pass 'utest1pass'"
)
# 可以查看用户
tdLog
.
printNoPrefix
(
"==========step6: normal user can show user"
)
user
.
query
(
"show users"
)
assert
user
.
queryRows
==
self
.
users_count
+
2
# 不可以修改其他用户的密码
tdLog
.
printNoPrefix
(
"==========step7: normal user can not alter other user pass"
)
user
.
error
(
self
.
__alter_pass_sql
(
self
.
__user_list
[
1
],
self
.
__passwd_list
[
1
]
))
user
.
error
(
"root"
,
"taosdata_root"
)
# 可以修改自己的密码
tdLog
.
printNoPrefix
(
"==========step8: normal user can alter owner pass"
)
user
.
query
(
self
.
__alter_pass_sql
(
self
.
__user_list
[
0
],
self
.
__passwd_list
[
0
]))
# 不可以删除用户,包括自己
tdLog
.
printNoPrefix
(
"==========step9: normal user can not drop any user "
)
user
.
error
(
f
"drop user
{
self
.
__user_list
[
0
]
}
"
)
user
.
error
(
f
"drop user
{
self
.
__user_list
[
1
]
}
"
)
user
.
error
(
"drop user root"
)
#
_, user = self.user_login(self.__user_list[0], f"new{self.__passwd_list[0]}")
with
taos_connect
(
user
=
self
.
__user_list
[
0
],
passwd
=
f
"new
{
self
.
__passwd_list
[
0
]
}
"
)
as
user
:
#
user = conn
# 不能创建用户
tdLog
.
printNoPrefix
(
"==========step5: normal user can not create user"
)
user
.
error
(
"create use utest1 pass 'utest1pass'"
)
# 可以查看用户
tdLog
.
printNoPrefix
(
"==========step6: normal user can show user"
)
user
.
query
(
"show users"
)
assert
user
.
queryRows
==
self
.
users_count
+
1
# 不可以修改其他用户的密码
tdLog
.
printNoPrefix
(
"==========step7: normal user can not alter other user pass"
)
user
.
error
(
self
.
__alter_pass_sql
(
self
.
__user_list
[
1
],
self
.
__passwd_list
[
1
]
))
user
.
error
(
self
.
__alter_pass_sql
(
"root"
,
"taosdata_root"
)
)
# 可以修改自己的密码
tdLog
.
printNoPrefix
(
"==========step8: normal user can alter owner pass"
)
user
.
query
(
self
.
__alter_pass_sql
(
self
.
__user_list
[
0
],
self
.
__passwd_list
[
0
]))
# 不可以删除用户,包括自己
tdLog
.
printNoPrefix
(
"==========step9: normal user can not drop any user "
)
user
.
error
(
f
"drop user
{
self
.
__user_list
[
0
]
}
"
)
user
.
error
(
f
"drop user
{
self
.
__user_list
[
1
]
}
"
)
user
.
error
(
"drop user root"
)
# root删除用户测试
tdLog
.
printNoPrefix
(
"==========step10: super user drop normal user"
)
...
...
@@ -316,6 +325,20 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
"root"
)
tdSql
.
checkData
(
0
,
1
,
"super"
)
tdDnodes
.
stop
(
1
)
tdDnodes
.
start
(
1
)
# 删除后无法登录
self
.
login_err
(
self
.
__user_list
[
0
],
self
.
__passwd_list
[
0
])
self
.
login_err
(
self
.
__user_list
[
0
],
f
"new
{
self
.
__passwd_list
[
0
]
}
"
)
self
.
login_err
(
self
.
__user_list
[
1
],
self
.
__passwd_list
[
1
])
self
.
login_err
(
self
.
__user_list
[
1
],
f
"new
{
self
.
__passwd_list
[
1
]
}
"
)
tdSql
.
query
(
"show users"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
"root"
)
tdSql
.
checkData
(
0
,
1
,
"super"
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/system-test/fulltest.sh
浏览文件 @
53b031f2
...
...
@@ -8,6 +8,8 @@ python3 ./test.py -f 0-others/taosShellNetChk.py
python3 ./test.py
-f
0-others/telemetry.py
python3 ./test.py
-f
0-others/taosdMonitor.py
python3 ./test.py
-f
0-others/user_control.py
#python3 ./test.py -f 2-query/between.py
python3 ./test.py
-f
2-query/distinct.py
python3 ./test.py
-f
2-query/varchar.py
...
...
@@ -53,5 +55,3 @@ python3 ./test.py -f 2-query/arctan.py
# python3 ./test.py -f 2-query/query_cols_tags_and_or.py
python3 ./test.py
-f
7-tmq/basic5.py
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录