Added Tag filter in User list
MODIFY
src/server/rest/service/UserService.ts
src/server/rest/service/UserService.ts
@@ -682,7 +682,8 @@ export default class UserService {
excludeSiteID: filteredRequest.ExcludeSiteID,
excludeUserIDs: (filteredRequest.ExcludeUserIDs ? filteredRequest.ExcludeUserIDs.split('|') : null),
includeCarUserIDs: (filteredRequest.IncludeCarUserIDs ? filteredRequest.IncludeCarUserIDs.split('|') : null),
- notAssignedToCarID: filteredRequest.NotAssignedToCarID
+ notAssignedToCarID: filteredRequest.NotAssignedToCarID,
+ tagIDs: (filteredRequest.TagID ? filteredRequest.TagID.split('|') : null),
},
{
limit: filteredRequest.Limit,

MODIFY
src/server/rest/service/security/UserSecurity.ts
src/server/rest/service/security/UserSecurity.ts
@@ -47,6 +47,9 @@ export default class UserSecurity {
if (request.ExcludeSiteID) {
request.ExcludeSiteID = sanitize(request.ExcludeSiteID);
}
+ if (request.TagID) {
+ request.TagID = sanitize(request.TagID);
+ }
if (request.ExcludeUserIDs) {
request.ExcludeUserIDs = sanitize(request.ExcludeUserIDs);
}

MODIFY
src/storage/mongodb/UserStorage.ts
src/storage/mongodb/UserStorage.ts
@@ -541,7 +541,7 @@ export default class UserStorage {
// Create Aggregation
const aggregation = [];
// Tags
- if (params.withTag) {
+ if (params.withTag || !Utils.isEmptyArray(params.tagIDs)) {
DatabaseUtils.pushTagLookupInAggregation({
tenantID, aggregation, localField: '_id', foreignField: 'userID', asField: 'tags'
});

MODIFY
src/types/requests/HttpUserRequest.ts
src/types/requests/HttpUserRequest.ts
@@ -36,6 +36,7 @@ export interface HttpUsersRequest extends HttpDatabaseRequest {
Role: string;
Status: string;
ErrorType?: string;
+ TagID?: string;
ExcludeSiteID: string;
ExcludeUserIDs: string;
IncludeCarUserIDs: string;

Added Tag filter in User list