From b24cf98ef3dd0823a645aedb5738cefe825fc70d Mon Sep 17 00:00:00 2001 From: cademfly Date: Fri, 31 Mar 2023 11:03:33 +0800 Subject: [PATCH] use only one altertype for both table and cond --- source/dnode/mnode/impl/src/mndUser.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index bebf57a55e..243053751e 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -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; -- GitLab