Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
306fde55
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
306fde55
编写于
3月 29, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-63] [TD-61] change the interface of acct and grant
上级
63f825a7
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
114 addition
and
104 deletion
+114
-104
src/mnode/CMakeLists.txt
src/mnode/CMakeLists.txt
+4
-1
src/mnode/inc/mgmtAcct.h
src/mnode/inc/mgmtAcct.h
+13
-10
src/mnode/inc/mgmtGrant.h
src/mnode/inc/mgmtGrant.h
+22
-12
src/mnode/src/mgmtAcct.c
src/mnode/src/mgmtAcct.c
+8
-17
src/mnode/src/mgmtChildTable.c
src/mnode/src/mgmtChildTable.c
+15
-11
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+9
-9
src/mnode/src/mgmtGrant.c
src/mnode/src/mgmtGrant.c
+8
-11
src/mnode/src/mgmtMain.c
src/mnode/src/mgmtMain.c
+9
-2
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+3
-3
src/mnode/src/mgmtSuperTable.c
src/mnode/src/mgmtSuperTable.c
+4
-4
src/mnode/src/mgmtUser.c
src/mnode/src/mgmtUser.c
+8
-8
src/util/CMakeLists.txt
src/util/CMakeLists.txt
+11
-16
未找到文件。
src/mnode/CMakeLists.txt
浏览文件 @
306fde55
...
...
@@ -14,10 +14,13 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
ADD_LIBRARY
(
mnode
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
mnode trpc tutil pthread
)
IF
(
TD_ACCOUNT
)
TARGET_LINK_LIBRARIES
(
account
)
ENDIF
()
IF
(
TD_GRANT
)
TARGET_LINK_LIBRARIES
(
grant
)
ENDIF
()
ENDIF
()
src/mnode/inc/mgmtAcct.h
浏览文件 @
306fde55
...
...
@@ -21,18 +21,21 @@ extern "C" {
#endif
#include "mnode.h"
int32_t
mgmtInitAccts
();
void
mgmtCleanUpAccts
();
SAcctObj
*
mgmtGetAcct
(
char
*
acctName
);
typedef
enum
{
TSDB_ACCT_USER
,
TSDB_ACCT_DB
,
TSDB_ACCT_TABLE
}
EAcctGrantType
;
int32_t
mgmtCheckUserLimit
(
SAcctObj
*
pAcct
);
int32_t
mgmtCheckDbLimit
(
SAcctObj
*
pAcct
);
int32_t
mgmtCheckTableLimit
(
SAcctObj
*
pAcct
);
int32_t
acctInit
();
void
acctCleanUp
();
SAcctObj
*
acctGetAcct
(
char
*
acctName
);
int32_t
acctCheck
(
SAcctObj
*
pAcct
,
EAcctGrantType
type
);
int32_t
mgmtAddDbIntoAcct
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
);
int32_t
mgmtRemoveDbFromAcct
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
);
int32_t
mgmtAddUserIntoAcct
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
);
int32_t
mgmtRemoveUserFromAcct
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
);
int32_t
acctAddDb
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
);
int32_t
acctRemoveDb
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
);
int32_t
acctAddUser
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
);
int32_t
acctRemoveUser
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
);
#ifdef __cplusplus
}
...
...
src/mnode/inc/mgmtGrant.h
浏览文件 @
306fde55
...
...
@@ -19,20 +19,30 @@
#ifdef __cplusplus
"C"
{
#endif
#include "mnode.h"
bool
mgmtCheckExpired
();
void
mgmtParseParameterKFp
();
void
mgmtSendMsgToMaster
();
void
mgmtSetCurStorage
(
uint64_t
storage
);
void
mgmtAddTimeSeries
(
SAcctObj
*
pAcct
,
uint32_t
timeSeriesNum
);
void
mgmtRestoreTimeSeries
(
SAcctObj
*
pAcct
,
uint32_t
timeseries
);
typedef
enum
{
TSDB_GRANT_ALL
,
TSDB_GRANT_TIME
,
TSDB_GRANT_USER
,
TSDB_GRANT_DB
,
TSDB_GRANT_TIMESERIES
,
TSDB_GRANT_DNODE
,
TSDB_GRANT_ACCT
,
TSDB_GRANT_STORAGE
,
TSDB_GRANT_SPEED
,
TSDB_GRANT_QUERY_TIME
,
TSDB_GRANT_CONNS
,
TSDB_GRANT_STREAMS
,
TSDB_GRANT_CPU_CORES
,
}
EGrantType
;
int32_t
mgmtCheckTimeSeries
(
uint32_t
timeseries
);
int32_t
mgmtCheckUserGrant
();
int32_t
mgmtCheckDbGrant
();
int32_t
mgmtCheckDnodeGrant
();
int32_t
mgmtCheckAccts
();
int32_t
grantInit
();
void
grantCleanUp
();
void
grantParseParameter
();
int32_t
grantCheck
(
EGrantType
grant
);
void
grantReset
(
EGrantType
grant
,
uint64_t
value
);
void
grantAdd
(
EGrantType
grant
,
uint64_t
value
);
void
grantRestore
(
EGrantType
grant
,
uint64_t
value
);
#ifdef __cplusplus
}
...
...
src/mnode/src/mgmtAcct.c
浏览文件 @
306fde55
...
...
@@ -21,28 +21,19 @@
static
SAcctObj
tsAcctObj
=
{
0
};
int32_t
mgmtInitAccts
()
{
int32_t
acctInit
()
{
tsAcctObj
.
acctId
=
0
;
strcpy
(
tsAcctObj
.
user
,
"root"
);
return
TSDB_CODE_SUCCESS
;
}
SAcctObj
*
mgmtGetAcct
(
char
*
acctName
)
{
return
&
tsAcctObj
;
}
void
acctCleanUp
()
{}
SAcctObj
*
acctGetAcct
(
char
*
acctName
)
{
return
&
tsAcctObj
;
}
int32_t
acctCheck
(
SAcctObj
*
pAcct
,
EAcctGrantType
type
)
{
return
TSDB_CODE_SUCCESS
;
}
void
mgmtCleanUpAccts
()
{}
int32_t
mgmtAddDbIntoAcct
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
mgmtRemoveDbFromAcct
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
mgmtAddUserIntoAcct
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
mgmtRemoveUserFromAcct
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
mgmtCheckUserLimit
(
SAcctObj
*
pAcct
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
mgmtCheckDbLimit
(
SAcctObj
*
pAcct
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
mgmtCheckTableLimit
(
SAcctObj
*
pAcct
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
acctAddDb
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
acctRemoveDb
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
acctAddUser
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
acctRemoveUser
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
)
{
return
TSDB_CODE_SUCCESS
;
}
#endif
\ No newline at end of file
src/mnode/src/mgmtChildTable.c
浏览文件 @
306fde55
...
...
@@ -48,7 +48,7 @@
#include "mgmtVgroup.h"
#include "mgmtUser.h"
static
void
*
tsChildTableSdb
;
void
*
tsChildTableSdb
;
static
int32_t
tsChildTableUpdateSize
;
static
void
mgmtProcessMultiTableMetaMsg
(
SQueuedMsg
*
queueMsg
);
static
void
mgmtProcessCreateTableRsp
(
SRpcMsg
*
rpcMsg
);
...
...
@@ -84,7 +84,7 @@ static int32_t mgmtChildTableActionInsert(SSdbOperDesc *pOper) {
return
TSDB_CODE_INVALID_DB
;
}
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pDb
->
cfg
.
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pDb
->
cfg
.
acct
);
if
(
pAcct
==
NULL
)
{
mError
(
"ctable:%s, account:%s not exists"
,
pTable
->
info
.
tableId
,
pDb
->
cfg
.
acct
);
return
TSDB_CODE_INVALID_ACCT
;
...
...
@@ -93,9 +93,11 @@ static int32_t mgmtChildTableActionInsert(SSdbOperDesc *pOper) {
if
(
pTable
->
info
.
type
==
TSDB_CHILD_TABLE
)
{
pTable
->
superTable
=
mgmtGetSuperTable
(
pTable
->
superTableId
);
pTable
->
superTable
->
numOfTables
++
;
mgmtAddTimeSeries
(
pAcct
,
pTable
->
superTable
->
numOfColumns
-
1
);
grantAdd
(
TSDB_GRANT_TIMESERIES
,
pTable
->
superTable
->
numOfColumns
-
1
);
pAcct
->
acctInfo
.
numOfTimeSeries
+=
(
pTable
->
superTable
->
numOfColumns
-
1
);
}
else
{
mgmtAddTimeSeries
(
pAcct
,
pTable
->
numOfColumns
-
1
);
grantAdd
(
TSDB_GRANT_TIMESERIES
,
pTable
->
numOfColumns
-
1
);
pAcct
->
acctInfo
.
numOfTimeSeries
+=
(
pTable
->
numOfColumns
-
1
);
}
mgmtAddTableIntoDb
(
pDb
);
mgmtAddTableIntoVgroup
(
pVgroup
,
pTable
);
...
...
@@ -120,17 +122,19 @@ static int32_t mgmtChildTableActionDelete(SSdbOperDesc *pOper) {
return
TSDB_CODE_INVALID_DB
;
}
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pDb
->
cfg
.
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pDb
->
cfg
.
acct
);
if
(
pAcct
==
NULL
)
{
mError
(
"ctable:%s, account:%s not exists"
,
pTable
->
info
.
tableId
,
pDb
->
cfg
.
acct
);
return
TSDB_CODE_INVALID_ACCT
;
}
if
(
pTable
->
info
.
type
==
TSDB_CHILD_TABLE
)
{
mgmtRestoreTimeSeries
(
pAcct
,
pTable
->
superTable
->
numOfColumns
-
1
);
grantRestore
(
TSDB_GRANT_TIMESERIES
,
pTable
->
superTable
->
numOfColumns
-
1
);
pAcct
->
acctInfo
.
numOfTimeSeries
-=
(
pTable
->
superTable
->
numOfColumns
-
1
);
pTable
->
superTable
->
numOfTables
--
;
}
else
{
mgmtRestoreTimeSeries
(
pAcct
,
pTable
->
numOfColumns
-
1
);
grantRestore
(
TSDB_GRANT_TIMESERIES
,
pTable
->
numOfColumns
-
1
);
pAcct
->
acctInfo
.
numOfTimeSeries
-=
(
pTable
->
numOfColumns
-
1
);
}
mgmtRemoveTableFromDb
(
pDb
);
mgmtRemoveTableFromVgroup
(
pVgroup
,
pTable
);
...
...
@@ -464,9 +468,9 @@ static SChildTableObj* mgmtDoCreateChildTable(SCMCreateTableMsg *pCreate, SVgObj
void
mgmtCreateChildTable
(
SQueuedMsg
*
pMsg
)
{
SCMCreateTableMsg
*
pCreate
=
pMsg
->
pCont
;
int32_t
code
=
mgmtCheckTimeSeries
(
htons
(
pCreate
->
numOfColumns
)
);
int32_t
code
=
grantCheck
(
TSDB_GRANT_TIMESERIES
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"table:%s, failed to create,
timeseries exceed the limi
t"
,
pCreate
->
tableId
);
mError
(
"table:%s, failed to create,
grant no
t"
,
pCreate
->
tableId
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
code
);
return
;
}
...
...
@@ -634,7 +638,7 @@ static int32_t mgmtAddNormalTableColumn(SChildTableObj *pTable, SSchema schema[]
return
TSDB_CODE_APP_ERROR
;
}
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pDb
->
cfg
.
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pDb
->
cfg
.
acct
);
if
(
pAcct
==
NULL
)
{
mError
(
"DB: %s not belongs to andy account"
,
pDb
->
name
);
return
TSDB_CODE_APP_ERROR
;
...
...
@@ -677,7 +681,7 @@ static int32_t mgmtDropNormalTableColumnByName(SChildTableObj *pTable, char *col
return
TSDB_CODE_APP_ERROR
;
}
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pDb
->
cfg
.
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pDb
->
cfg
.
acct
);
if
(
pAcct
==
NULL
)
{
mError
(
"DB: %s not belongs to any account"
,
pDb
->
name
);
return
TSDB_CODE_APP_ERROR
;
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
306fde55
...
...
@@ -54,7 +54,7 @@ static int32_t mgmtDbActionDestroy(SSdbOperDesc *pOper) {
static
int32_t
mgmtDbActionInsert
(
SSdbOperDesc
*
pOper
)
{
SDbObj
*
pDb
=
pOper
->
pObj
;
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pDb
->
cfg
.
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pDb
->
cfg
.
acct
);
pDb
->
pHead
=
NULL
;
pDb
->
pTail
=
NULL
;
...
...
@@ -65,7 +65,7 @@ static int32_t mgmtDbActionInsert(SSdbOperDesc *pOper) {
pDb
->
numOfSuperTables
=
0
;
if
(
pAcct
!=
NULL
)
{
mgmtAddDbIntoAcct
(
pAcct
,
pDb
);
acctAddDb
(
pAcct
,
pDb
);
}
else
{
mError
(
"db:%s, acct:%s info not exist in sdb"
,
pDb
->
name
,
pDb
->
cfg
.
acct
);
...
...
@@ -77,9 +77,9 @@ static int32_t mgmtDbActionInsert(SSdbOperDesc *pOper) {
static
int32_t
mgmtDbActionDelete
(
SSdbOperDesc
*
pOper
)
{
SDbObj
*
pDb
=
pOper
->
pObj
;
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pDb
->
cfg
.
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pDb
->
cfg
.
acct
);
mgmtRemoveDbFromAcct
(
pAcct
,
pDb
);
acctRemoveDb
(
pAcct
,
pDb
);
mgmtDropAllChildTables
(
pDb
);
mgmtDropAllSuperTables
(
pDb
);
mgmtDropAllVgroups
(
pDb
);
...
...
@@ -277,7 +277,7 @@ static int32_t mgmtCheckDbParams(SCMCreateDbMsg *pCreate) {
}
static
int32_t
mgmtCreateDb
(
SAcctObj
*
pAcct
,
SCMCreateDbMsg
*
pCreate
)
{
int32_t
code
=
mgmtCheckDbLimit
(
pAcct
);
int32_t
code
=
acctCheck
(
pAcct
,
TSDB_ACCT_DB
);
if
(
code
!=
0
)
{
return
code
;
}
...
...
@@ -292,7 +292,7 @@ static int32_t mgmtCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate) {
assert
(
pCreate
->
daysToKeep1
<=
pCreate
->
daysToKeep2
&&
pCreate
->
daysToKeep2
<=
pCreate
->
daysToKeep
);
code
=
mgmtCheckDbGrant
(
);
code
=
grantCheck
(
TSDB_GRANT_DB
);
if
(
code
!=
0
)
{
return
code
;
}
...
...
@@ -692,7 +692,7 @@ static void mgmtProcessCreateDbMsg(SQueuedMsg *pMsg) {
pCreate
->
rowsInFileBlock
=
htonl
(
pCreate
->
rowsInFileBlock
);
int32_t
code
;
if
(
mgmtCheckExpired
()
)
{
if
(
grantCheck
(
TSDB_GRANT_TIME
)
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_GRANT_EXPIRED
;
}
else
if
(
!
pMsg
->
pUser
->
writeAuth
)
{
code
=
TSDB_CODE_NO_RIGHTS
;
...
...
@@ -771,7 +771,7 @@ static void mgmtProcessAlterDbMsg(SQueuedMsg *pMsg) {
SCMAlterDbMsg
*
pAlter
=
pMsg
->
pCont
;
mTrace
(
"db:%s, alter db msg is received from thandle:%p"
,
pAlter
->
db
,
pMsg
->
thandle
);
if
(
mgmtCheckExpired
()
)
{
if
(
grantCheck
(
TSDB_GRANT_TIME
)
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"db:%s, failed to alter, grant expired"
,
pAlter
->
db
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_GRANT_EXPIRED
);
return
;
...
...
@@ -842,7 +842,7 @@ static void mgmtProcessDropDbMsg(SQueuedMsg *pMsg) {
SCMDropDbMsg
*
pDrop
=
pMsg
->
pCont
;
mTrace
(
"db:%s, drop db msg is received from thandle:%p"
,
pDrop
->
db
,
pMsg
->
thandle
);
if
(
mgmtCheckExpired
()
)
{
if
(
grantCheck
(
TSDB_GRANT_TIME
)
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"db:%s, failed to drop, grant expired"
,
pDrop
->
db
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_GRANT_EXPIRED
);
return
;
...
...
src/mnode/src/mgmtGrant.c
浏览文件 @
306fde55
...
...
@@ -16,18 +16,15 @@
#define _DEFAULT_SOURCE
#ifndef _GRANT
#include "os.h"
#include "tlog.h"
#include "mgmtGrant.h"
bool
mgmtCheckExpired
()
{
return
false
;
}
void
mgmtParseParameterKFp
()
{}
void
mgmtSendMsgToMaster
()
{}
void
mgmtSetCurStorage
(
uint64_t
storage
)
{}
void
mgmtAddTimeSeries
(
SAcctObj
*
pAcct
,
uint32_t
timeSeriesNum
)
{}
void
mgmtRestoreTimeSeries
(
SAcctObj
*
pAcct
,
uint32_t
timeseries
)
{}
int32_t
mgmtCheckTimeSeries
(
uint32_t
timeseries
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
mgmtCheckUserGrant
()
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
mgmtCheckDbGrant
()
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
mgmtCheckDnodeGrant
()
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
mgmtCheckAccts
()
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
grantInit
()
{
return
TSDB_CODE_SUCCESS
;
}
void
grantCleanUp
()
{}
void
grantParseParameter
()
{
mError
(
"can't parsed parameter k"
);
}
int32_t
grantCheck
(
EGrantType
grant
)
{
return
true
;
}
void
grantReset
(
EGrantType
grant
,
uint64_t
value
)
{}
void
grantAdd
(
EGrantType
grant
,
uint64_t
value
)
{}
void
grantRestore
(
EGrantType
grant
,
uint64_t
value
)
{}
#endif
\ No newline at end of file
src/mnode/src/mgmtMain.c
浏览文件 @
306fde55
...
...
@@ -25,6 +25,7 @@
#include "mgmtDClient.h"
#include "mgmtDnode.h"
#include "mgmtDServer.h"
#include "mgmtGrant.h"
#include "mgmtMnode.h"
#include "mgmtSdb.h"
#include "mgmtVgroup.h"
...
...
@@ -73,11 +74,16 @@ int32_t mgmtStartSystem() {
return
-
1
;
}
if
(
mgmtInitAccts
()
<
0
)
{
if
(
acctInit
()
<
0
)
{
mError
(
"failed to init accts"
);
return
-
1
;
}
if
(
grantInit
()
<
0
)
{
mError
(
"failed to init grants"
);
return
-
1
;
}
if
(
mgmtInitUsers
()
<
0
)
{
mError
(
"failed to init users"
);
return
-
1
;
...
...
@@ -138,6 +144,7 @@ void mgmtStopSystem() {
void
mgmtCleanUpSystem
()
{
mPrint
(
"starting to clean up mgmt"
);
grantCleanUp
();
mgmtCleanupMnodes
();
mgmtCleanupBalance
();
mgmtCleanUpShell
();
...
...
@@ -148,7 +155,7 @@ void mgmtCleanUpSystem() {
mgmtCleanUpDbs
();
mgmtCleanUpDnodes
();
mgmtCleanUpUsers
();
mgmtCleanUpAccts
();
acctCleanUp
();
taosTmrCleanUp
(
tsMgmtTmr
);
mPrint
(
"mgmt is cleaned up"
);
}
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
306fde55
...
...
@@ -137,7 +137,7 @@ static void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg) {
return
;
}
if
(
mgmtCheckExpired
()
)
{
if
(
grantCheck
(
TSDB_GRANT_TIME
)
!=
TSDB_CODE_SUCCESS
)
{
mgmtSendSimpleResp
(
rpcMsg
->
handle
,
TSDB_CODE_GRANT_EXPIRED
);
return
;
}
...
...
@@ -373,12 +373,12 @@ static void mgmtProcessConnectMsg(SQueuedMsg *pMsg) {
goto
connect_over
;
}
if
(
mgmtCheckExpired
()
)
{
if
(
grantCheck
(
TSDB_GRANT_TIME
)
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_GRANT_EXPIRED
;
goto
connect_over
;
}
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pUser
->
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pUser
->
acct
);
if
(
pAcct
==
NULL
)
{
code
=
TSDB_CODE_INVALID_ACCT
;
goto
connect_over
;
...
...
src/mnode/src/mgmtSuperTable.c
浏览文件 @
306fde55
...
...
@@ -253,7 +253,7 @@ static int32_t mgmtAddSuperTableTag(SSuperTableObj *pStable, SSchema schema[], i
return
TSDB_CODE_APP_ERROR
;
}
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pDb
->
cfg
.
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pDb
->
cfg
.
acct
);
if
(
pAcct
==
NULL
)
{
mError
(
"DB: %s not belongs to andy account"
,
pDb
->
name
);
return
TSDB_CODE_APP_ERROR
;
...
...
@@ -293,7 +293,7 @@ static int32_t mgmtDropSuperTableTag(SSuperTableObj *pStable, char *tagName) {
return
TSDB_CODE_APP_ERROR
;
}
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pDb
->
cfg
.
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pDb
->
cfg
.
acct
);
if
(
pAcct
==
NULL
)
{
mError
(
"DB: %s not belongs to any account"
,
pDb
->
name
);
return
TSDB_CODE_APP_ERROR
;
...
...
@@ -381,7 +381,7 @@ static int32_t mgmtAddSuperTableColumn(SSuperTableObj *pStable, SSchema schema[]
return
TSDB_CODE_APP_ERROR
;
}
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pDb
->
cfg
.
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pDb
->
cfg
.
acct
);
if
(
pAcct
==
NULL
)
{
mError
(
"DB: %s not belongs to andy account"
,
pDb
->
name
);
return
TSDB_CODE_APP_ERROR
;
...
...
@@ -420,7 +420,7 @@ static int32_t mgmtDropSuperTableColumnByName(SSuperTableObj *pStable, char *col
return
TSDB_CODE_APP_ERROR
;
}
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pDb
->
cfg
.
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pDb
->
cfg
.
acct
);
if
(
pAcct
==
NULL
)
{
mError
(
"DB: %s not belongs to any account"
,
pDb
->
name
);
return
TSDB_CODE_APP_ERROR
;
...
...
src/mnode/src/mgmtUser.c
浏览文件 @
306fde55
...
...
@@ -44,10 +44,10 @@ static int32_t mgmtUserActionDestroy(SSdbOperDesc *pOper) {
static
int32_t
mgmtUserActionInsert
(
SSdbOperDesc
*
pOper
)
{
SUserObj
*
pUser
=
pOper
->
pObj
;
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pUser
->
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pUser
->
acct
);
if
(
pAcct
!=
NULL
)
{
mgmtAddUserIntoAcct
(
pAcct
,
pUser
);
acctAddUser
(
pAcct
,
pUser
);
}
else
{
mError
(
"user:%s, acct:%s info not exist in sdb"
,
pUser
->
user
,
pUser
->
acct
);
...
...
@@ -59,9 +59,9 @@ static int32_t mgmtUserActionInsert(SSdbOperDesc *pOper) {
static
int32_t
mgmtUserActionDelete
(
SSdbOperDesc
*
pOper
)
{
SUserObj
*
pUser
=
pOper
->
pObj
;
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
pUser
->
acct
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
pUser
->
acct
);
mgmtRemoveUserFromAcct
(
pAcct
,
pUser
);
acctRemoveUser
(
pAcct
,
pUser
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -114,7 +114,7 @@ int32_t mgmtInitUsers() {
return
-
1
;
}
SAcctObj
*
pAcct
=
mgm
tGetAcct
(
"root"
);
SAcctObj
*
pAcct
=
acc
tGetAcct
(
"root"
);
mgmtCreateUser
(
pAcct
,
"root"
,
"taosdata"
);
mgmtCreateUser
(
pAcct
,
"monitor"
,
tsInternalPass
);
mgmtCreateUser
(
pAcct
,
"_root"
,
tsInternalPass
);
...
...
@@ -155,7 +155,7 @@ static int32_t mgmtUpdateUser(SUserObj *pUser) {
}
int32_t
mgmtCreateUser
(
SAcctObj
*
pAcct
,
char
*
name
,
char
*
pass
)
{
int32_t
code
=
mgmtCheckUserLimit
(
pAcct
);
int32_t
code
=
acctCheck
(
pAcct
,
TSDB_ACCT_USER
);
if
(
code
!=
0
)
{
return
code
;
}
...
...
@@ -170,8 +170,8 @@ int32_t mgmtCreateUser(SAcctObj *pAcct, char *name, char *pass) {
return
TSDB_CODE_USER_ALREADY_EXIST
;
}
code
=
mgmtCheckUserGrant
(
);
if
(
code
!=
0
)
{
code
=
grantCheck
(
TSDB_GRANT_USER
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
src/util/CMakeLists.txt
浏览文件 @
306fde55
...
...
@@ -9,25 +9,20 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
AUX_SOURCE_DIRECTORY
(
src SRC
)
ADD_LIBRARY
(
tutil
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
tutil thirdparty pthread os m rt
)
IF
(
TD_CLUSTER
)
FIND_PATH
(
ICONV_INCLUDE_EXIST iconv.h /usr/include/ /usr/local/include/
)
IF
(
ICONV_INCLUDE_EXIST
)
ADD_DEFINITIONS
(
-DUSE_LIBICONV
)
TARGET_LINK_LIBRARIES
(
tutil iconv
)
ELSE
()
FIND_PATH
(
ICONV_INCLUDE_EXIST iconv.h /usr/include/ /usr/local/include/
)
IF
(
ICONV_INCLUDE_EXIST
)
ADD_DEFINITIONS
(
-DUSE_LIBICONV
)
FIND_PATH
(
ICONV_LIBRARY_A_EXIST libiconv.a /usr/lib/ /usr/local/lib/ /lib64
)
FIND_PATH
(
ICONV_LIBRARY_SO_EXIST libiconv.so /usr/lib/ /usr/local/lib/ /lib64
)
IF
(
ICONV_LIBRARY_A_EXIST OR ICONV_LIBRARY_SO_EXIST
)
MESSAGE
(
STATUS
"Use the installed libiconv library"
)
TARGET_LINK_LIBRARIES
(
tutil iconv
)
ELSE
()
# libiconv library is already included in GLIBC,
MESSAGE
(
STATUS
"Use the iconv functions in GLIBC"
)
ENDIF
()
FIND_PATH
(
ICONV_LIBRARY_A_EXIST libiconv.a /usr/lib/ /usr/local/lib/ /lib64
)
FIND_PATH
(
ICONV_LIBRARY_SO_EXIST libiconv.so /usr/lib/ /usr/local/lib/ /lib64
)
IF
(
ICONV_LIBRARY_A_EXIST OR ICONV_LIBRARY_SO_EXIST
)
MESSAGE
(
STATUS
"Use the installed libiconv library"
)
TARGET_LINK_LIBRARIES
(
tutil iconv
)
ELSE
()
MESSAGE
(
STATUS
"Failed to find iconv, use default encoding method"
)
# libiconv library is already included in GLIBC,
MESSAGE
(
STATUS
"Use the iconv functions in GLIBC"
)
ENDIF
()
ELSE
()
MESSAGE
(
STATUS
"Failed to find iconv, use default encoding method"
)
ENDIF
()
ELSEIF
(
TD_WINDOWS_64
)
ADD_DEFINITIONS
(
-DUSE_LIBICONV
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录