fix: table level privilege
This commit is contained in:
parent
0f2c753103
commit
d1decca07e
|
@ -1524,6 +1524,8 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
|
||||||
pRsp->createdDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
pRsp->createdDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||||
pRsp->readDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
pRsp->readDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||||
pRsp->writeDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
pRsp->writeDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||||
|
pRsp->readTbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||||
|
pRsp->writeTbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||||
if (pRsp->readDbs == NULL || pRsp->writeDbs == NULL) {
|
if (pRsp->readDbs == NULL || pRsp->writeDbs == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1579,7 +1581,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
|
||||||
char *value = taosMemoryCalloc(valuelen + 1, sizeof(char));
|
char *value = taosMemoryCalloc(valuelen + 1, sizeof(char));
|
||||||
if (tDecodeCStrTo(pDecoder, value) < 0) return -1;
|
if (tDecodeCStrTo(pDecoder, value) < 0) return -1;
|
||||||
|
|
||||||
taosHashPut(pRsp->readTbs, key, keyLen, value, valuelen);
|
taosHashPut(pRsp->readTbs, key, strlen(key), value, valuelen);
|
||||||
|
|
||||||
taosMemoryFree(key);
|
taosMemoryFree(key);
|
||||||
taosMemoryFree(value);
|
taosMemoryFree(value);
|
||||||
|
@ -1597,7 +1599,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
|
||||||
char *value = taosMemoryCalloc(valuelen + 1, sizeof(char));
|
char *value = taosMemoryCalloc(valuelen + 1, sizeof(char));
|
||||||
if (tDecodeCStrTo(pDecoder, value) < 0) return -1;
|
if (tDecodeCStrTo(pDecoder, value) < 0) return -1;
|
||||||
|
|
||||||
taosHashPut(pRsp->writeTbs, key, keyLen, value, valuelen);
|
taosHashPut(pRsp->writeTbs, key, strlen(key), value, valuelen);
|
||||||
|
|
||||||
taosMemoryFree(key);
|
taosMemoryFree(key);
|
||||||
taosMemoryFree(value);
|
taosMemoryFree(value);
|
||||||
|
|
|
@ -1337,11 +1337,13 @@ int32_t ctgChkSetTbAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) {
|
||||||
STableMeta *pMeta = NULL;
|
STableMeta *pMeta = NULL;
|
||||||
SGetUserAuthRsp *pInfo = &req->authInfo;
|
SGetUserAuthRsp *pInfo = &req->authInfo;
|
||||||
SHashObj *pTbs = (AUTH_TYPE_READ == req->singleType) ? pInfo->readTbs : pInfo->writeTbs;
|
SHashObj *pTbs = (AUTH_TYPE_READ == req->singleType) ? pInfo->readTbs : pInfo->writeTbs;
|
||||||
|
|
||||||
char *pCond = taosHashGet(pTbs, req->pRawReq->tbName.tname, strlen(req->pRawReq->tbName.tname));
|
char tbFullName[TSDB_TABLE_FNAME_LEN];
|
||||||
|
tNameExtractFullName(&req->pRawReq->tbName, tbFullName);
|
||||||
|
char *pCond = taosHashGet(pTbs, tbFullName, strlen(tbFullName));
|
||||||
if (pCond) {
|
if (pCond) {
|
||||||
if (strlen(pCond) > 1) {
|
if (strlen(pCond) > 1) {
|
||||||
CTG_RET(nodesStringToNode(pCond, &res->pRawRes->pCond));
|
CTG_ERR_RET(nodesStringToNode(pCond, &res->pRawRes->pCond));
|
||||||
}
|
}
|
||||||
|
|
||||||
res->pRawRes->pass = true;
|
res->pRawRes->pass = true;
|
||||||
|
|
Loading…
Reference in New Issue