use only one altertype for both table and cond

This commit is contained in:
cademfly 2023-03-31 11:03:33 +08:00
parent d85d1bf58e
commit b24cf98ef3
1 changed files with 16 additions and 2 deletions

View File

@ -685,8 +685,22 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq
snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName);
int32_t len = strlen(tbFName) + 1;
if (taosHashPut(hash, tbFName, len, "t", 2) != 0) {
return -1;
if(alterReq->tagCond != NULL && alterReq->tagCondLen != 0){
char *value = taosHashGet(hash, tbFName, len);
if(value != NULL){
terrno = TSDB_CODE_MND_PRIVILEDGE_EXIST;
return -1;
}
int32_t condLen = alterReq->tagCondLen + 1;
if (taosHashPut(hash, tbFName, len, alterReq->tagCond, condLen) != 0) {
return -1;
}
}
else{
if (taosHashPut(hash, tbFName, len, "t", 2) != 0) {
return -1;
}
}
return 0;