enh: support createdb permission for user

This commit is contained in:
kailixu 2024-05-31 17:50:57 +08:00
parent 4ae8aeb909
commit 767934ad4a
3 changed files with 5 additions and 4 deletions

View File

@ -289,7 +289,6 @@ int32_t tdGetBitmapValType(const void *pBitmap, int16_t colIdx, TDRowValT *pValT
*/ */
static FORCE_INLINE void tdSRowInit(SRowBuilder *pBuilder, int16_t sver) { static FORCE_INLINE void tdSRowInit(SRowBuilder *pBuilder, int16_t sver) {
pBuilder->rowType = pBuilder->rowType;
pBuilder->sver = sver; pBuilder->sver = sver;
} }
int32_t tdSRowSetInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBoundCols, int32_t flen); int32_t tdSRowSetInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBoundCols, int32_t flen);

View File

@ -330,6 +330,7 @@ void *createRequest(uint64_t connId, int32_t type, int64_t reqid) {
} }
SSyncQueryParam *interParam = taosMemoryCalloc(1, sizeof(SSyncQueryParam)); SSyncQueryParam *interParam = taosMemoryCalloc(1, sizeof(SSyncQueryParam));
if (interParam == NULL) { if (interParam == NULL) {
releaseTscObj(connId);
doDestroyRequest(pRequest); doDestroyRequest(pRequest);
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL; return NULL;

View File

@ -874,9 +874,6 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
} }
#endif #endif
mInfo("db:%s, start to create, vgroups:%d", createReq.db, createReq.numOfVgroups); mInfo("db:%s, start to create, vgroups:%d", createReq.db, createReq.numOfVgroups);
if (mndCheckDbPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_DB, NULL) != 0) {
goto _OVER;
}
pDb = mndAcquireDb(pMnode, createReq.db); pDb = mndAcquireDb(pMnode, createReq.db);
if (pDb != NULL) { if (pDb != NULL) {
@ -901,6 +898,10 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
} }
} }
if (mndCheckDbPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_DB, NULL) != 0) {
goto _OVER;
}
if ((terrno = grantCheck(TSDB_GRANT_DB)) != 0) { if ((terrno = grantCheck(TSDB_GRANT_DB)) != 0) {
code = terrno; code = terrno;
goto _OVER; goto _OVER;