Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
42a5a87e
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看板
提交
42a5a87e
编写于
4月 11, 2023
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: table level privilege
上级
416af9a5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
5 deletion
+31
-5
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+28
-3
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+2
-1
source/libs/parser/src/parInsertSql.c
source/libs/parser/src/parInsertSql.c
+1
-1
未找到文件。
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
42a5a87e
...
...
@@ -156,7 +156,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
size_t
valueLen
=
0
;
valueLen
=
strlen
(
stb
);
size
+=
sizeof
(
int32_t
);
size
+=
key
Len
;
size
+=
value
Len
;
stb
=
taosHashIterate
(
pUser
->
writeTbs
,
stb
);
}
...
...
@@ -369,7 +369,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
int32_t
valuelen
=
0
;
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
valuelen
,
_OVER
);
char
*
value
=
taosMemoryCalloc
(
valuelen
,
sizeof
(
char
));
memset
(
value
,
0
,
keyL
en
);
memset
(
value
,
0
,
valuel
en
);
SDB_GET_BINARY
(
pRaw
,
dataPos
,
value
,
valuelen
,
_OVER
)
taosHashPut
(
pUser
->
writeTbs
,
key
,
keyLen
,
value
,
valuelen
);
...
...
@@ -458,6 +458,31 @@ SHashObj *mndDupTableHash(SHashObj *pOld) {
return
pNew
;
}
SHashObj
*
mndDupUseDbHash
(
SHashObj
*
pOld
)
{
SHashObj
*
pNew
=
taosHashInit
(
taosHashGetSize
(
pOld
),
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_ENTRY_LOCK
);
if
(
pNew
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
int32_t
*
db
=
taosHashIterate
(
pOld
,
NULL
);
while
(
db
!=
NULL
)
{
size_t
keyLen
=
0
;
char
*
key
=
taosHashGetKey
(
db
,
&
keyLen
);
if
(
taosHashPut
(
pNew
,
key
,
keyLen
,
db
,
sizeof
(
*
db
))
!=
0
)
{
taosHashCancelIterate
(
pOld
,
db
);
taosHashCleanup
(
pNew
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
db
=
taosHashIterate
(
pOld
,
db
);
}
return
pNew
;
}
static
int32_t
mndUserDupObj
(
SUserObj
*
pUser
,
SUserObj
*
pNew
)
{
memcpy
(
pNew
,
pUser
,
sizeof
(
SUserObj
));
pNew
->
authVersion
++
;
...
...
@@ -469,7 +494,7 @@ static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) {
pNew
->
readTbs
=
mndDupTableHash
(
pUser
->
readTbs
);
pNew
->
writeTbs
=
mndDupTableHash
(
pUser
->
writeTbs
);
pNew
->
topics
=
mndDupTopicHash
(
pUser
->
topics
);
pNew
->
useDbs
=
mndDupDbHash
(
pUser
->
useDbs
);
pNew
->
useDbs
=
mndDup
Use
DbHash
(
pUser
->
useDbs
);
taosRUnLockLatch
(
&
pUser
->
lock
);
if
(
pNew
->
readDbs
==
NULL
||
pNew
->
writeDbs
==
NULL
||
pNew
->
topics
==
NULL
)
{
...
...
source/libs/catalog/src/ctgUtil.c
浏览文件 @
42a5a87e
...
...
@@ -1457,7 +1457,8 @@ int32_t ctgChkSetAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) {
}
case
AUTH_TYPE_READ_OR_WRITE
:
{
if
((
pInfo
->
readDbs
&&
taosHashGet
(
pInfo
->
readDbs
,
dbFName
,
strlen
(
dbFName
)))
||
(
pInfo
->
writeDbs
&&
taosHashGet
(
pInfo
->
writeDbs
,
dbFName
,
strlen
(
dbFName
))))
{
(
pInfo
->
writeDbs
&&
taosHashGet
(
pInfo
->
writeDbs
,
dbFName
,
strlen
(
dbFName
)))
||
(
pInfo
->
useDbs
&&
taosHashGet
(
pInfo
->
useDbs
,
dbFName
,
strlen
(
dbFName
))))
{
pRes
->
pass
=
true
;
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/parser/src/parInsertSql.c
浏览文件 @
42a5a87e
...
...
@@ -2022,7 +2022,7 @@ static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray**
SUserAuthInfo
userAuth
=
{.
type
=
AUTH_TYPE_WRITE
};
snprintf
(
userAuth
.
user
,
sizeof
(
userAuth
.
user
),
"%s"
,
pUser
);
// tNameGetFullDbName(pName, userAuth.dbFName
);
memcpy
(
&
userAuth
.
tbName
,
pName
,
sizeof
(
SName
)
);
taosArrayPush
(
*
pUserAuth
,
&
userAuth
);
return
TSDB_CODE_SUCCESS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录