Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5441dae3
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看板
未验证
提交
5441dae3
编写于
12月 21, 2022
作者:
D
dapan1121
提交者:
GitHub
12月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19045 from taosdata/enh/authReadOrWrite
enh: support auth read or write
上级
b77a1ed5
65913f6a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
10 addition
and
6 deletion
+10
-6
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+1
-0
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+3
-0
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+2
-2
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+2
-2
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+2
-2
未找到文件。
include/libs/catalog/catalog.h
浏览文件 @
5441dae3
...
...
@@ -44,6 +44,7 @@ typedef enum {
AUTH_TYPE_READ
=
1
,
AUTH_TYPE_WRITE
,
AUTH_TYPE_OTHER
,
AUTH_TYPE_READ_OR_WRITE
,
}
AUTH_TYPE
;
typedef
struct
SUserAuthInfo
{
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
5441dae3
...
...
@@ -485,6 +485,9 @@ typedef struct SCtgOperation {
ctgOpFunc
func
;
}
SCtgOperation
;
#define CTG_AUTH_READ(_t) ((_t) == AUTH_TYPE_READ || (_t) == AUTH_TYPE_READ_OR_WRITE)
#define CTG_AUTH_WRITE(_t) ((_t) == AUTH_TYPE_WRITE || (_t) == AUTH_TYPE_READ_OR_WRITE)
#define CTG_QUEUE_INC() atomic_add_fetch_64(&gCtgMgmt.queue.qRemainNum, 1)
#define CTG_QUEUE_DEC() atomic_sub_fetch_64(&gCtgMgmt.queue.qRemainNum, 1)
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
5441dae3
...
...
@@ -352,9 +352,9 @@ int32_t ctgChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, co
goto
_return
;
}
if
(
type
==
AUTH_TYPE_READ
&&
authRsp
.
readDbs
&&
taosHashGet
(
authRsp
.
readDbs
,
dbFName
,
strlen
(
dbFName
)))
{
if
(
CTG_AUTH_READ
(
type
)
&&
authRsp
.
readDbs
&&
taosHashGet
(
authRsp
.
readDbs
,
dbFName
,
strlen
(
dbFName
)))
{
*
pass
=
true
;
}
else
if
(
type
==
AUTH_TYPE_WRITE
&&
authRsp
.
writeDbs
&&
taosHashGet
(
authRsp
.
writeDbs
,
dbFName
,
strlen
(
dbFName
)))
{
}
else
if
(
CTG_AUTH_WRITE
(
type
)
&&
authRsp
.
writeDbs
&&
taosHashGet
(
authRsp
.
writeDbs
,
dbFName
,
strlen
(
dbFName
)))
{
*
pass
=
true
;
}
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
5441dae3
...
...
@@ -1549,10 +1549,10 @@ int32_t ctgHandleGetUserRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf*
goto
_return
;
}
if
(
ctx
->
user
.
type
==
AUTH_TYPE_READ
&&
pOut
->
readDbs
&&
if
(
CTG_AUTH_READ
(
ctx
->
user
.
type
)
&&
pOut
->
readDbs
&&
taosHashGet
(
pOut
->
readDbs
,
ctx
->
user
.
dbFName
,
strlen
(
ctx
->
user
.
dbFName
)))
{
pass
=
true
;
}
else
if
(
ctx
->
user
.
type
==
AUTH_TYPE_WRITE
&&
pOut
->
writeDbs
&&
}
else
if
(
CTG_AUTH_WRITE
(
ctx
->
user
.
type
)
&&
pOut
->
writeDbs
&&
taosHashGet
(
pOut
->
writeDbs
,
ctx
->
user
.
dbFName
,
strlen
(
ctx
->
user
.
dbFName
)))
{
pass
=
true
;
}
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
5441dae3
...
...
@@ -718,11 +718,11 @@ int32_t ctgChkAuthFromCache(SCatalog *pCtg, char *user, char *dbFName, AUTH_TYPE
return
TSDB_CODE_SUCCESS
;
}
if
(
pUser
->
readDbs
&&
taosHashGet
(
pUser
->
readDbs
,
dbFName
,
strlen
(
dbFName
))
&&
type
==
AUTH_TYPE_READ
)
{
if
(
pUser
->
readDbs
&&
taosHashGet
(
pUser
->
readDbs
,
dbFName
,
strlen
(
dbFName
))
&&
CTG_AUTH_READ
(
type
)
)
{
*
pass
=
true
;
}
if
(
pUser
->
writeDbs
&&
taosHashGet
(
pUser
->
writeDbs
,
dbFName
,
strlen
(
dbFName
))
&&
type
==
AUTH_TYPE_WRITE
)
{
if
(
pUser
->
writeDbs
&&
taosHashGet
(
pUser
->
writeDbs
,
dbFName
,
strlen
(
dbFName
))
&&
CTG_AUTH_WRITE
(
type
)
)
{
*
pass
=
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录