diff --git a/console/src/app/modules/filter-org/filter-org.component.html b/console/src/app/modules/filter-org/filter-org.component.html
index a915672b6b..510ca0fcd1 100644
--- a/console/src/app/modules/filter-org/filter-org.component.html
+++ b/console/src/app/modules/filter-org/filter-org.component.html
@@ -22,5 +22,28 @@
+
+
+
{{ 'FILTER.STATE' | translate }}
+
+
+
+ {{ 'FILTER.METHODS.1' | translate }}
+
+
+
+
+
+ {{ 'USER.STATE.' + state | translate }}
+
+
+
+
+
diff --git a/console/src/app/modules/filter-org/filter-org.component.ts b/console/src/app/modules/filter-org/filter-org.component.ts
index 0f1a33e76d..a4592bdf7e 100644
--- a/console/src/app/modules/filter-org/filter-org.component.ts
+++ b/console/src/app/modules/filter-org/filter-org.component.ts
@@ -3,13 +3,14 @@ import { MatLegacyCheckboxChange as MatCheckboxChange } from '@angular/material/
import { ActivatedRoute, Router } from '@angular/router';
import { take } from 'rxjs';
import { TextQueryMethod } from 'src/app/proto/generated/zitadel/object_pb';
-import { OrgNameQuery, OrgQuery, OrgState } from 'src/app/proto/generated/zitadel/org_pb';
+import { OrgNameQuery, OrgQuery, OrgState, OrgStateQuery } from 'src/app/proto/generated/zitadel/org_pb';
import { UserNameQuery } from 'src/app/proto/generated/zitadel/user_pb';
import { FilterComponent } from '../filter/filter.component';
enum SubQuery {
NAME,
+ STATE,
}
@Component({
@@ -21,7 +22,7 @@ export class FilterOrgComponent extends FilterComponent implements OnInit {
public SubQuery: any = SubQuery;
public searchQueries: OrgQuery[] = [];
- public states: OrgState[] = [OrgState.ORG_STATE_ACTIVE, OrgState.ORG_STATE_INACTIVE];
+ public states: OrgState[] = [OrgState.ORG_STATE_ACTIVE, OrgState.ORG_STATE_INACTIVE, OrgState.ORG_STATE_REMOVED];
constructor(router: Router, protected route: ActivatedRoute) {
super(router, route);
@@ -37,13 +38,17 @@ export class FilterOrgComponent extends FilterComponent implements OnInit {
const orgQueries = filters.map((filter) => {
if (filter.nameQuery) {
const orgQuery = new OrgQuery();
-
const orgNameQuery = new OrgNameQuery();
orgNameQuery.setName(filter.nameQuery.name);
orgNameQuery.setMethod(filter.nameQuery.method);
-
orgQuery.setNameQuery(orgNameQuery);
return orgQuery;
+ } else if (filter.stateQuery) {
+ const orgQuery = new OrgQuery();
+ const orgStateQuery = new OrgStateQuery();
+ orgStateQuery.setState(filter.stateQuery.state);
+ orgQuery.setStateQuery(orgStateQuery);
+ return orgQuery;
} else {
return undefined;
}
@@ -64,12 +69,17 @@ export class FilterOrgComponent extends FilterComponent implements OnInit {
const nq = new OrgNameQuery();
nq.setMethod(TextQueryMethod.TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE);
nq.setName('');
-
const oq = new OrgQuery();
oq.setNameQuery(nq);
-
this.searchQueries.push(oq);
break;
+ case SubQuery.STATE:
+ const sq = new OrgStateQuery();
+ sq.setState(OrgState.ORG_STATE_ACTIVE);
+ const osq = new OrgQuery();
+ osq.setStateQuery(sq);
+ this.searchQueries.push(osq);
+ break;
}
} else {
switch (subquery) {
@@ -79,6 +89,12 @@ export class FilterOrgComponent extends FilterComponent implements OnInit {
this.searchQueries.splice(index_dn, 1);
}
break;
+ case SubQuery.STATE:
+ const index_sn = this.searchQueries.findIndex((q) => (q as OrgQuery).toObject().stateQuery !== undefined);
+ if (index_sn > -1) {
+ this.searchQueries.splice(index_sn, 1);
+ }
+ break;
}
}
}
@@ -90,6 +106,10 @@ export class FilterOrgComponent extends FilterComponent implements OnInit {
(query as OrgNameQuery).setName(value);
this.filterChanged.emit(this.searchQueries ? this.searchQueries : []);
break;
+ case SubQuery.STATE:
+ (query as OrgStateQuery).setState(value);
+ this.filterChanged.emit(this.searchQueries ? this.searchQueries : []);
+ break;
}
}
@@ -102,6 +122,13 @@ export class FilterOrgComponent extends FilterComponent implements OnInit {
} else {
return undefined;
}
+ case SubQuery.STATE:
+ const sn = this.searchQueries.find((q) => (q as OrgQuery).toObject().stateQuery !== undefined);
+ if (sn) {
+ return (sn as OrgQuery).getStateQuery();
+ } else {
+ return undefined;
+ }
}
}
diff --git a/console/src/app/modules/org-context/org-context.component.ts b/console/src/app/modules/org-context/org-context.component.ts
index 2c78846948..c5ad2dbe9b 100644
--- a/console/src/app/modules/org-context/org-context.component.ts
+++ b/console/src/app/modules/org-context/org-context.component.ts
@@ -3,7 +3,7 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild }
import { UntypedFormControl } from '@angular/forms';
import { BehaviorSubject, catchError, debounceTime, finalize, from, map, Observable, of, pipe, tap } from 'rxjs';
import { TextQueryMethod } from 'src/app/proto/generated/zitadel/object_pb';
-import { Org, OrgNameQuery, OrgQuery } from 'src/app/proto/generated/zitadel/org_pb';
+import { Org, OrgNameQuery, OrgQuery, OrgState, OrgStateQuery } from 'src/app/proto/generated/zitadel/org_pb';
import { AuthenticationService } from 'src/app/services/authentication.service';
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
@@ -47,9 +47,12 @@ export class OrgContextComponent implements OnInit {
}
}
- let query;
+ let query = new OrgQuery();
+ const orgStateQuery = new OrgStateQuery();
+ orgStateQuery.setState(OrgState.ORG_STATE_ACTIVE);
+ query.setStateQuery(orgStateQuery);
+
if (filter) {
- query = new OrgQuery();
const orgNameQuery = new OrgNameQuery();
orgNameQuery.setName(filter);
orgNameQuery.setMethod(TextQueryMethod.TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE);
diff --git a/console/src/app/pages/users/user-list/user-table/user-table.component.ts b/console/src/app/pages/users/user-list/user-table/user-table.component.ts
index 948eee8022..777fa5ad81 100644
--- a/console/src/app/pages/users/user-list/user-table/user-table.component.ts
+++ b/console/src/app/pages/users/user-list/user-table/user-table.component.ts
@@ -204,6 +204,7 @@ export class UserTableComponent implements OnInit {
sortingField = UserFieldName.USER_FIELD_NAME_CREATION_DATE;
break;
}
+
this.userService
.listUsers(
limit,
diff --git a/internal/api/grpc/org/converter.go b/internal/api/grpc/org/converter.go
index f98c97e4ff..a73d77a279 100644
--- a/internal/api/grpc/org/converter.go
+++ b/internal/api/grpc/org/converter.go
@@ -26,7 +26,7 @@ func OrgQueryToModel(apiQuery *org_pb.OrgQuery) (query.SearchQuery, error) {
case *org_pb.OrgQuery_NameQuery:
return query.NewOrgNameSearchQuery(object.TextMethodToQuery(q.NameQuery.Method), q.NameQuery.Name)
case *org_pb.OrgQuery_StateQuery:
- return query.NewOrgStateSearchQuery(int32(q.StateQuery.State))
+ return query.NewOrgStateSearchQuery(OrgStateToDomain(q.StateQuery.State))
default:
return nil, errors.ThrowInvalidArgument(nil, "ORG-vR9nC", "List.Query.Invalid")
}
@@ -49,6 +49,8 @@ func OrgQueryToQuery(search *org_pb.OrgQuery) (query.SearchQuery, error) {
return query.NewOrgDomainSearchQuery(object.TextMethodToQuery(q.DomainQuery.Method), q.DomainQuery.Domain)
case *org_pb.OrgQuery_NameQuery:
return query.NewOrgNameSearchQuery(object.TextMethodToQuery(q.NameQuery.Method), q.NameQuery.Name)
+ case *org_pb.OrgQuery_StateQuery:
+ return query.NewOrgStateSearchQuery(OrgStateToDomain(q.StateQuery.State))
default:
return nil, errors.ThrowInvalidArgument(nil, "ADMIN-ADvsd", "List.Query.Invalid")
}
@@ -108,6 +110,21 @@ func OrgStateToPb(state domain.OrgState) org_pb.OrgState {
}
}
+func OrgStateToDomain(state org_pb.OrgState) domain.OrgState {
+ switch state {
+ case org_pb.OrgState_ORG_STATE_ACTIVE:
+ return domain.OrgStateActive
+ case org_pb.OrgState_ORG_STATE_INACTIVE:
+ return domain.OrgStateInactive
+ case org_pb.OrgState_ORG_STATE_REMOVED:
+ return domain.OrgStateRemoved
+ case org_pb.OrgState_ORG_STATE_UNSPECIFIED:
+ fallthrough
+ default:
+ return domain.OrgStateUnspecified
+ }
+}
+
func DomainQueriesToModel(queries []*org_pb.DomainSearchQuery) (_ []query.SearchQuery, err error) {
q := make([]query.SearchQuery, len(queries))
for i, query := range queries {
diff --git a/internal/query/org.go b/internal/query/org.go
index b3dc88b9dc..26bd3cd670 100644
--- a/internal/query/org.go
+++ b/internal/query/org.go
@@ -221,7 +221,7 @@ func NewOrgNameSearchQuery(method TextComparison, value string) (SearchQuery, er
return NewTextQuery(OrgColumnName, value, method)
}
-func NewOrgStateSearchQuery(value int32) (SearchQuery, error) {
+func NewOrgStateSearchQuery(value domain_pkg.OrgState) (SearchQuery, error) {
return NewNumberQuery(OrgColumnState, value, NumberEquals)
}