[TD-63] [TD-61] change the interface of acct and grant
This commit is contained in:
parent
63f825a7e6
commit
306fde55fd
|
@ -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 ()
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -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 = mgmtGetAcct(pDb->cfg.acct);
|
||||
SAcctObj *pAcct = acctGetAcct(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 = mgmtGetAcct(pDb->cfg.acct);
|
||||
SAcctObj *pAcct = acctGetAcct(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 limit", pCreate->tableId);
|
||||
mError("table:%s, failed to create, grant not", 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 = mgmtGetAcct(pDb->cfg.acct);
|
||||
SAcctObj *pAcct = acctGetAcct(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 = mgmtGetAcct(pDb->cfg.acct);
|
||||
SAcctObj *pAcct = acctGetAcct(pDb->cfg.acct);
|
||||
if (pAcct == NULL) {
|
||||
mError("DB: %s not belongs to any account", pDb->name);
|
||||
return TSDB_CODE_APP_ERROR;
|
||||
|
|
|
@ -54,7 +54,7 @@ static int32_t mgmtDbActionDestroy(SSdbOperDesc *pOper) {
|
|||
|
||||
static int32_t mgmtDbActionInsert(SSdbOperDesc *pOper) {
|
||||
SDbObj *pDb = pOper->pObj;
|
||||
SAcctObj *pAcct = mgmtGetAcct(pDb->cfg.acct);
|
||||
SAcctObj *pAcct = acctGetAcct(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 = mgmtGetAcct(pDb->cfg.acct);
|
||||
SAcctObj *pAcct = acctGetAcct(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;
|
||||
|
|
|
@ -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
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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 = mgmtGetAcct(pUser->acct);
|
||||
SAcctObj *pAcct = acctGetAcct(pUser->acct);
|
||||
if (pAcct == NULL) {
|
||||
code = TSDB_CODE_INVALID_ACCT;
|
||||
goto connect_over;
|
||||
|
|
|
@ -253,7 +253,7 @@ static int32_t mgmtAddSuperTableTag(SSuperTableObj *pStable, SSchema schema[], i
|
|||
return TSDB_CODE_APP_ERROR;
|
||||
}
|
||||
|
||||
SAcctObj *pAcct = mgmtGetAcct(pDb->cfg.acct);
|
||||
SAcctObj *pAcct = acctGetAcct(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 = mgmtGetAcct(pDb->cfg.acct);
|
||||
SAcctObj *pAcct = acctGetAcct(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 = mgmtGetAcct(pDb->cfg.acct);
|
||||
SAcctObj *pAcct = acctGetAcct(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 = mgmtGetAcct(pDb->cfg.acct);
|
||||
SAcctObj *pAcct = acctGetAcct(pDb->cfg.acct);
|
||||
if (pAcct == NULL) {
|
||||
mError("DB: %s not belongs to any account", pDb->name);
|
||||
return TSDB_CODE_APP_ERROR;
|
||||
|
|
|
@ -44,10 +44,10 @@ static int32_t mgmtUserActionDestroy(SSdbOperDesc *pOper) {
|
|||
|
||||
static int32_t mgmtUserActionInsert(SSdbOperDesc *pOper) {
|
||||
SUserObj *pUser = pOper->pObj;
|
||||
SAcctObj *pAcct = mgmtGetAcct(pUser->acct);
|
||||
SAcctObj *pAcct = acctGetAcct(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 = mgmtGetAcct(pUser->acct);
|
||||
SAcctObj *pAcct = acctGetAcct(pUser->acct);
|
||||
|
||||
mgmtRemoveUserFromAcct(pAcct, pUser);
|
||||
acctRemoveUser(pAcct, pUser);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ int32_t mgmtInitUsers() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
SAcctObj *pAcct = mgmtGetAcct("root");
|
||||
SAcctObj *pAcct = acctGetAcct("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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue