diff --git a/CHANGELOG.md b/CHANGELOG.md index cdd0c1accbe..ecdd741763c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Support of context images for 2D image tasks () +- Filter `is_active` for user list () ### Changed diff --git a/cvat-core/src/api-implementation.js b/cvat-core/src/api-implementation.js index 04c982631c9..f4549b9f6bd 100644 --- a/cvat-core/src/api-implementation.js +++ b/cvat-core/src/api-implementation.js @@ -115,6 +115,7 @@ cvat.users.get.implementation = async (filter) => { checkFilter(filter, { id: isInteger, + is_active: isBoolean, self: isBoolean, search: isString, limit: isInteger, @@ -125,7 +126,10 @@ users = await serverProxy.users.self(); users = [users]; } else { - const searchParams = {}; + // get list of active users as default + const searchParams = { + is_active: true, + }; for (const key in filter) { if (filter[key] && key !== 'self') { searchParams[key] = filter[key]; diff --git a/cvat/apps/engine/views.py b/cvat/apps/engine/views.py index db79c232444..b1815d7d1e9 100644 --- a/cvat/apps/engine/views.py +++ b/cvat/apps/engine/views.py @@ -921,11 +921,12 @@ def get_permissions(self): class UserFilter(filters.FilterSet): class Meta: model = User - fields = ("id",) + fields = ("id", "is_active") @method_decorator(name='list', decorator=swagger_auto_schema( manual_parameters=[ openapi.Parameter('id',openapi.IN_QUERY,description="A unique number value identifying this user",type=openapi.TYPE_NUMBER), + openapi.Parameter('is_active',openapi.IN_QUERY,description="Returns only active users",type=openapi.TYPE_BOOLEAN), ], operation_summary='Method provides a paginated list of users registered on the server')) @method_decorator(name='retrieve', decorator=swagger_auto_schema( diff --git a/tests/cypress/support/commands_review_pipeline.js b/tests/cypress/support/commands_review_pipeline.js index 18d0ed5263c..3454dce1d7c 100644 --- a/tests/cypress/support/commands_review_pipeline.js +++ b/tests/cypress/support/commands_review_pipeline.js @@ -157,7 +157,7 @@ Cypress.Commands.add('submitReview', (decision, user) => { cy.get('.cvat-submit-review-dialog').within(() => { cy.contains(new RegExp(`^${decision}$`, 'g')).click(); if (decision === 'Review next') { - cy.intercept('GET', `/api/v1/users?search=${user}&limit=10`).as('searchUsers'); + cy.intercept('GET', `/api/v1/users?is_active=true&search=${user}&limit=10`).as('searchUsers'); cy.get('.cvat-user-search-field').within(() => { cy.get('input[type="search"]').clear().type(`${user}`); cy.wait('@searchUsers').its('response.statusCode').should('equal', 200);