Add is_active field in UserFilter (#3235)

* Add is_active field in UserFilter

* Update changelog

* Add is_active as a default searchParam to get user list

* Fix url search query

* Update CHANGELOG.md

Co-authored-by: Nikita Manovich <nikita.manovich@intel.com>
main
Jijoong Kim 5 years ago committed by GitHub
parent e0fe9c1580
commit 573bdbe32c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Support of context images for 2D image tasks (<https://github.com/openvinotoolkit/cvat/pull/3122>) - Support of context images for 2D image tasks (<https://github.com/openvinotoolkit/cvat/pull/3122>)
- Filter `is_active` for user list (<https://github.com/openvinotoolkit/cvat/pull/3235>)
### Changed ### Changed

@ -115,6 +115,7 @@
cvat.users.get.implementation = async (filter) => { cvat.users.get.implementation = async (filter) => {
checkFilter(filter, { checkFilter(filter, {
id: isInteger, id: isInteger,
is_active: isBoolean,
self: isBoolean, self: isBoolean,
search: isString, search: isString,
limit: isInteger, limit: isInteger,
@ -125,7 +126,10 @@
users = await serverProxy.users.self(); users = await serverProxy.users.self();
users = [users]; users = [users];
} else { } else {
const searchParams = {}; // get list of active users as default
const searchParams = {
is_active: true,
};
for (const key in filter) { for (const key in filter) {
if (filter[key] && key !== 'self') { if (filter[key] && key !== 'self') {
searchParams[key] = filter[key]; searchParams[key] = filter[key];

@ -921,11 +921,12 @@ class CommentViewSet(viewsets.GenericViewSet,
class UserFilter(filters.FilterSet): class UserFilter(filters.FilterSet):
class Meta: class Meta:
model = User model = User
fields = ("id",) fields = ("id", "is_active")
@method_decorator(name='list', decorator=swagger_auto_schema( @method_decorator(name='list', decorator=swagger_auto_schema(
manual_parameters=[ manual_parameters=[
openapi.Parameter('id',openapi.IN_QUERY,description="A unique number value identifying this user",type=openapi.TYPE_NUMBER), 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')) operation_summary='Method provides a paginated list of users registered on the server'))
@method_decorator(name='retrieve', decorator=swagger_auto_schema( @method_decorator(name='retrieve', decorator=swagger_auto_schema(

@ -157,7 +157,7 @@ Cypress.Commands.add('submitReview', (decision, user) => {
cy.get('.cvat-submit-review-dialog').within(() => { cy.get('.cvat-submit-review-dialog').within(() => {
cy.contains(new RegExp(`^${decision}$`, 'g')).click(); cy.contains(new RegExp(`^${decision}$`, 'g')).click();
if (decision === 'Review next') { 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('.cvat-user-search-field').within(() => {
cy.get('input[type="search"]').clear().type(`${user}`); cy.get('input[type="search"]').clear().type(`${user}`);
cy.wait('@searchUsers').its('response.statusCode').should('equal', 200); cy.wait('@searchUsers').its('response.statusCode').should('equal', 200);

Loading…
Cancel
Save