web: fix display of scopes
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
fb20ae7e1a
commit
3d45956f15
|
@ -13,7 +13,7 @@ from rest_framework.permissions import IsAdminUser
|
||||||
from rest_framework.request import Request
|
from rest_framework.request import Request
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.serializers import Serializer
|
from rest_framework.serializers import Serializer
|
||||||
from rest_framework.viewsets import ReadOnlyModelViewSet
|
from rest_framework.viewsets import ViewSet
|
||||||
|
|
||||||
from authentik.events.models import Event, EventAction
|
from authentik.events.models import Event, EventAction
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ class LoginMetricsSerializer(Serializer):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
class AdministrationMetricsViewSet(ReadOnlyModelViewSet):
|
class AdministrationMetricsViewSet(ViewSet):
|
||||||
"""Login Metrics per 1h"""
|
"""Login Metrics per 1h"""
|
||||||
|
|
||||||
permission_classes = [IsAdminUser]
|
permission_classes = [IsAdminUser]
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
"""OAuth2Provider API Views"""
|
"""OAuth2Provider API Views"""
|
||||||
from rest_framework import mixins
|
from rest_framework import mixins
|
||||||
|
from rest_framework.fields import CharField, ListField
|
||||||
from rest_framework.serializers import ModelSerializer
|
from rest_framework.serializers import ModelSerializer
|
||||||
from rest_framework.viewsets import GenericViewSet
|
from rest_framework.viewsets import GenericViewSet
|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@ class ExpiringBaseGrantModelSerializer(ModelSerializer, MetaNameSerializer):
|
||||||
|
|
||||||
user = UserSerializer()
|
user = UserSerializer()
|
||||||
provider = OAuth2ProviderSerializer()
|
provider = OAuth2ProviderSerializer()
|
||||||
|
scope = ListField(child=CharField())
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
|
|
46
swagger.yaml
46
swagger.yaml
|
@ -24,27 +24,7 @@ paths:
|
||||||
get:
|
get:
|
||||||
operationId: admin_metrics_list
|
operationId: admin_metrics_list
|
||||||
description: Login Metrics per 1h
|
description: Login Metrics per 1h
|
||||||
parameters:
|
parameters: []
|
||||||
- name: ordering
|
|
||||||
in: query
|
|
||||||
description: Which field to use when ordering the results.
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
- name: search
|
|
||||||
in: query
|
|
||||||
description: A search term.
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
- name: page
|
|
||||||
in: query
|
|
||||||
description: Page Index
|
|
||||||
required: false
|
|
||||||
type: integer
|
|
||||||
- name: page_size
|
|
||||||
in: query
|
|
||||||
description: Page Size
|
|
||||||
required: false
|
|
||||||
type: integer
|
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Login Metrics per 1h
|
description: Login Metrics per 1h
|
||||||
|
@ -53,21 +33,6 @@ paths:
|
||||||
tags:
|
tags:
|
||||||
- admin
|
- admin
|
||||||
parameters: []
|
parameters: []
|
||||||
/admin/metrics/{id}/:
|
|
||||||
get:
|
|
||||||
operationId: admin_metrics_read
|
|
||||||
description: Login Metrics per 1h
|
|
||||||
parameters: []
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: ''
|
|
||||||
tags:
|
|
||||||
- admin
|
|
||||||
parameters:
|
|
||||||
- name: id
|
|
||||||
in: path
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
/admin/system_tasks/:
|
/admin/system_tasks/:
|
||||||
get:
|
get:
|
||||||
operationId: admin_system_tasks_list
|
operationId: admin_system_tasks_list
|
||||||
|
@ -11718,6 +11683,7 @@ definitions:
|
||||||
required:
|
required:
|
||||||
- provider
|
- provider
|
||||||
- user
|
- user
|
||||||
|
- scope
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
pk:
|
pk:
|
||||||
|
@ -11737,9 +11703,11 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
scope:
|
scope:
|
||||||
title: Scope
|
description: ''
|
||||||
type: string
|
type: array
|
||||||
readOnly: true
|
items:
|
||||||
|
type: string
|
||||||
|
minLength: 1
|
||||||
Outpost:
|
Outpost:
|
||||||
description: Outpost Serializer
|
description: Outpost Serializer
|
||||||
required:
|
required:
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { DEFAULT_CONFIG } from "../../api/Config";
|
||||||
export class AdminLoginsChart extends AKChart<LoginMetrics> {
|
export class AdminLoginsChart extends AKChart<LoginMetrics> {
|
||||||
|
|
||||||
apiRequest(): Promise<LoginMetrics> {
|
apiRequest(): Promise<LoginMetrics> {
|
||||||
return new AdminApi(DEFAULT_CONFIG).adminMetricsList({});
|
return new AdminApi(DEFAULT_CONFIG).adminMetricsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
getDatasets(data: LoginMetrics): Chart.ChartDataSets[] {
|
getDatasets(data: LoginMetrics): Chart.ChartDataSets[] {
|
||||||
|
|
|
@ -35,9 +35,9 @@ export class UserOAuthCodeList extends Table<ExpiringBaseGrantModel> {
|
||||||
|
|
||||||
row(item: ExpiringBaseGrantModel): TemplateResult[] {
|
row(item: ExpiringBaseGrantModel): TemplateResult[] {
|
||||||
return [
|
return [
|
||||||
html`${item.provider}`,
|
html`${item.provider.name}`,
|
||||||
html`${item.expires?.toLocaleString()}`,
|
html`${item.expires?.toLocaleString()}`,
|
||||||
html`${item.scope}`,
|
html`${item.scope.join(", ")}`,
|
||||||
html`
|
html`
|
||||||
<ak-forms-delete
|
<ak-forms-delete
|
||||||
.obj=${item}
|
.obj=${item}
|
||||||
|
|
|
@ -35,9 +35,9 @@ export class UserOAuthRefreshList extends Table<ExpiringBaseGrantModel> {
|
||||||
|
|
||||||
row(item: ExpiringBaseGrantModel): TemplateResult[] {
|
row(item: ExpiringBaseGrantModel): TemplateResult[] {
|
||||||
return [
|
return [
|
||||||
html`${item.provider}`,
|
html`${item.provider.name}`,
|
||||||
html`${item.expires?.toLocaleString()}`,
|
html`${item.expires?.toLocaleString()}`,
|
||||||
html`${item.scope}`,
|
html`${item.scope.join(", ")}`,
|
||||||
html`
|
html`
|
||||||
<ak-forms-delete
|
<ak-forms-delete
|
||||||
.obj=${item}
|
.obj=${item}
|
||||||
|
|
Reference in New Issue