web/admin: fix user sorting by active field (#6485)
* web/admin: fix user sorting by active field Signed-off-by: Jens Langhammer <jens@goauthentik.io> * web/admin: fix hide service account toggle Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
be8b0feaab
commit
287cf6f0c7
|
@ -15,7 +15,13 @@ from django.utils.http import urlencode
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django_filters.filters import BooleanFilter, CharFilter, ModelMultipleChoiceFilter, UUIDFilter
|
from django_filters.filters import (
|
||||||
|
BooleanFilter,
|
||||||
|
CharFilter,
|
||||||
|
ModelMultipleChoiceFilter,
|
||||||
|
MultipleChoiceFilter,
|
||||||
|
UUIDFilter,
|
||||||
|
)
|
||||||
from django_filters.filterset import FilterSet
|
from django_filters.filterset import FilterSet
|
||||||
from drf_spectacular.types import OpenApiTypes
|
from drf_spectacular.types import OpenApiTypes
|
||||||
from drf_spectacular.utils import (
|
from drf_spectacular.utils import (
|
||||||
|
@ -300,11 +306,11 @@ class UsersFilter(FilterSet):
|
||||||
is_superuser = BooleanFilter(field_name="ak_groups", lookup_expr="is_superuser")
|
is_superuser = BooleanFilter(field_name="ak_groups", lookup_expr="is_superuser")
|
||||||
uuid = UUIDFilter(field_name="uuid")
|
uuid = UUIDFilter(field_name="uuid")
|
||||||
|
|
||||||
path = CharFilter(
|
path = CharFilter(field_name="path")
|
||||||
field_name="path",
|
|
||||||
)
|
|
||||||
path_startswith = CharFilter(field_name="path", lookup_expr="startswith")
|
path_startswith = CharFilter(field_name="path", lookup_expr="startswith")
|
||||||
|
|
||||||
|
type = MultipleChoiceFilter(field_name="type")
|
||||||
|
|
||||||
groups_by_name = ModelMultipleChoiceFilter(
|
groups_by_name = ModelMultipleChoiceFilter(
|
||||||
field_name="ak_groups__name",
|
field_name="ak_groups__name",
|
||||||
to_field_name="name",
|
to_field_name="name",
|
||||||
|
|
|
@ -4587,6 +4587,8 @@ paths:
|
||||||
- in: query
|
- in: query
|
||||||
name: type
|
name: type
|
||||||
schema:
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
type: string
|
type: string
|
||||||
enum:
|
enum:
|
||||||
- external
|
- external
|
||||||
|
@ -4598,6 +4600,8 @@ paths:
|
||||||
* `external` - External
|
* `external` - External
|
||||||
* `service_account` - Service Account
|
* `service_account` - Service Account
|
||||||
* `internal_service_account` - Internal Service Account
|
* `internal_service_account` - Internal Service Account
|
||||||
|
explode: true
|
||||||
|
style: form
|
||||||
- in: query
|
- in: query
|
||||||
name: username
|
name: username
|
||||||
schema:
|
schema:
|
||||||
|
|
|
@ -39,7 +39,7 @@ export class MemberSelectTable extends TableModal<User> {
|
||||||
columns(): TableColumn[] {
|
columns(): TableColumn[] {
|
||||||
return [
|
return [
|
||||||
new TableColumn(msg("Name"), "username"),
|
new TableColumn(msg("Name"), "username"),
|
||||||
new TableColumn(msg("Active"), "active"),
|
new TableColumn(msg("Active"), "is_active"),
|
||||||
new TableColumn(msg("Last login"), "last_login"),
|
new TableColumn(msg("Last login"), "last_login"),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,14 @@ import PFAlert from "@patternfly/patternfly/components/Alert/alert.css";
|
||||||
import PFBanner from "@patternfly/patternfly/components/Banner/banner.css";
|
import PFBanner from "@patternfly/patternfly/components/Banner/banner.css";
|
||||||
import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList/description-list.css";
|
import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList/description-list.css";
|
||||||
|
|
||||||
import { CapabilitiesEnum, CoreApi, Group, ResponseError, User } from "@goauthentik/api";
|
import {
|
||||||
|
CapabilitiesEnum,
|
||||||
|
CoreApi,
|
||||||
|
CoreUsersListTypeEnum,
|
||||||
|
Group,
|
||||||
|
ResponseError,
|
||||||
|
User,
|
||||||
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-user-related-add")
|
@customElement("ak-user-related-add")
|
||||||
export class RelatedUserAdd extends Form<{ users: number[] }> {
|
export class RelatedUserAdd extends Form<{ users: number[] }> {
|
||||||
|
@ -127,10 +134,8 @@ export class RelatedUserList extends Table<User> {
|
||||||
pageSize: (await uiConfig()).pagination.perPage,
|
pageSize: (await uiConfig()).pagination.perPage,
|
||||||
search: this.search || "",
|
search: this.search || "",
|
||||||
groupsByPk: this.targetGroup ? [this.targetGroup.pk] : [],
|
groupsByPk: this.targetGroup ? [this.targetGroup.pk] : [],
|
||||||
attributes: this.hideServiceAccounts
|
type: this.hideServiceAccounts
|
||||||
? JSON.stringify({
|
? [CoreUsersListTypeEnum.External, CoreUsersListTypeEnum.Internal]
|
||||||
"goauthentik.io/user/service-account__isnull": true,
|
|
||||||
})
|
|
||||||
: undefined,
|
: undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -138,7 +143,7 @@ export class RelatedUserList extends Table<User> {
|
||||||
columns(): TableColumn[] {
|
columns(): TableColumn[] {
|
||||||
return [
|
return [
|
||||||
new TableColumn(msg("Name"), "username"),
|
new TableColumn(msg("Name"), "username"),
|
||||||
new TableColumn(msg("Active"), "active"),
|
new TableColumn(msg("Active"), "is_active"),
|
||||||
new TableColumn(msg("Last login"), "last_login"),
|
new TableColumn(msg("Last login"), "last_login"),
|
||||||
new TableColumn(msg("Actions")),
|
new TableColumn(msg("Actions")),
|
||||||
];
|
];
|
||||||
|
|
|
@ -94,7 +94,7 @@ export class UserListPage extends TablePage<User> {
|
||||||
columns(): TableColumn[] {
|
columns(): TableColumn[] {
|
||||||
return [
|
return [
|
||||||
new TableColumn(msg("Name"), "username"),
|
new TableColumn(msg("Name"), "username"),
|
||||||
new TableColumn(msg("Active"), "active"),
|
new TableColumn(msg("Active"), "is_active"),
|
||||||
new TableColumn(msg("Last login"), "last_login"),
|
new TableColumn(msg("Last login"), "last_login"),
|
||||||
new TableColumn(msg("Actions")),
|
new TableColumn(msg("Actions")),
|
||||||
];
|
];
|
||||||
|
|
Reference in New Issue