feat: table level privilege syntax
This commit is contained in:
parent
2fd10c2aa0
commit
6265251a03
|
@ -679,15 +679,16 @@ int32_t tSerializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq
|
||||||
int32_t tDeserializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq);
|
int32_t tDeserializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int8_t alterType;
|
int8_t alterType;
|
||||||
int8_t superUser;
|
int8_t superUser;
|
||||||
int8_t sysInfo;
|
int8_t sysInfo;
|
||||||
int8_t enable;
|
int8_t enable;
|
||||||
char user[TSDB_USER_LEN];
|
char user[TSDB_USER_LEN];
|
||||||
char pass[TSDB_USET_PASSWORD_LEN];
|
char pass[TSDB_USET_PASSWORD_LEN];
|
||||||
char objname[TSDB_DB_FNAME_LEN]; // db or topic
|
char objname[TSDB_DB_FNAME_LEN]; // db or topic
|
||||||
char tabName[TSDB_TABLE_NAME_LEN];
|
char tabName[TSDB_TABLE_NAME_LEN];
|
||||||
char* tagCond;
|
char* tagCond;
|
||||||
|
int32_t tagCondLen;
|
||||||
} SAlterUserReq;
|
} SAlterUserReq;
|
||||||
|
|
||||||
int32_t tSerializeSAlterUserReq(void* buf, int32_t bufLen, SAlterUserReq* pReq);
|
int32_t tSerializeSAlterUserReq(void* buf, int32_t bufLen, SAlterUserReq* pReq);
|
||||||
|
|
|
@ -1373,11 +1373,7 @@ int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq)
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
if (tEncodeCStr(&encoder, pReq->tabName) < 0) return -1;
|
if (tEncodeCStr(&encoder, pReq->tabName) < 0) return -1;
|
||||||
}
|
}
|
||||||
len = (NULL == pReq->tagCond ? 0 : strlen(pReq->tagCond));
|
if (tEncodeBinary(&encoder, pReq->tagCond, pReq->tagCondLen) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, len) < 0) return -1;
|
|
||||||
if (len > 0) {
|
|
||||||
if (tEncodeCStr(&encoder, pReq->tagCond) < 0) return -1;
|
|
||||||
}
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -1403,10 +1399,9 @@ int32_t tDeserializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
if (tDecodeCStrTo(&decoder, pReq->tabName) < 0) return -1;
|
if (tDecodeCStrTo(&decoder, pReq->tabName) < 0) return -1;
|
||||||
}
|
}
|
||||||
if (tDecodeI32(&decoder, &len) < 0) return -1;
|
uint64_t tagCondLen = 0;
|
||||||
if (len > 0) {
|
if (tDecodeBinaryAlloc(&decoder, (void **)&pReq->tagCond, &tagCondLen) < 0) return -1;
|
||||||
if (tDecodeCStrAlloc(&decoder, &pReq->tagCond) < 0) return -1;
|
pReq->tagCondLen = tagCondLen;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
|
|
@ -6467,7 +6467,7 @@ static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) {
|
||||||
sprintf(req.tabName, "%s", pStmt->tabName);
|
sprintf(req.tabName, "%s", pStmt->tabName);
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if (NULL != pStmt->pTagCond) {
|
if (NULL != pStmt->pTagCond) {
|
||||||
code = nodesNodeToString(pStmt->pTagCond, false, &req.tagCond, NULL);
|
code = nodesNodeToString(pStmt->pTagCond, false, &req.tagCond, &req.tagCondLen);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &req);
|
code = buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &req);
|
||||||
|
|
Loading…
Reference in New Issue