diff --git a/src/mnode/src/mnodeUser.c b/src/mnode/src/mnodeUser.c index e2fda182d7287f61311f658b83134132a4e8d9a1..b3e3ba6cd9698b08aceb86841bd858a7c6f05220 100644 --- a/src/mnode/src/mnodeUser.c +++ b/src/mnode/src/mnodeUser.c @@ -355,13 +355,41 @@ static int32_t mnodeGetUserMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo static int32_t mnodeRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void *pConn) { int32_t numOfRows = 0; SUserObj *pUser = NULL; + SUserObj *userObj = NULL; + char *user = NULL; int32_t cols = 0; + size_t len1 = 0; + size_t len2; + int32_t acctId = -1; char *pWrite; + if (pConn) { + userObj = mnodeGetUserFromConn(pConn); + if (userObj && userObj->pAcct) { + user = userObj->pAcct->user; + if (user) { + len1 = strlen(user); + if (len1 == 0) { + user = NULL; + } + } + + acctId = userObj->pAcct->acctId; + } + } + while (numOfRows < rows) { pShow->pIter = mnodeGetNextUser(pShow->pIter, &pUser); if (pUser == NULL) break; - + + if (user && pUser->pAcct) { + len2 = strlen(pUser->pAcct->user); + + if ((len1 != len2 || strncmp(user, pUser->pAcct->user, len1)) && acctId != pUser->pAcct->acctId) { + continue; + } + } + cols = 0; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -643,4 +671,4 @@ int32_t mnodeCompactUsers() { mInfo("end to compact users table..."); return 0; -} \ No newline at end of file +}