web: fix display of scopes

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-20 19:05:10 +01:00
parent fb20ae7e1a
commit 3d45956f15
6 changed files with 16 additions and 46 deletions

View File

@ -13,7 +13,7 @@ from rest_framework.permissions import IsAdminUser
from rest_framework.request import Request
from rest_framework.response import Response
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
@ -81,7 +81,7 @@ class LoginMetricsSerializer(Serializer):
raise NotImplementedError
class AdministrationMetricsViewSet(ReadOnlyModelViewSet):
class AdministrationMetricsViewSet(ViewSet):
"""Login Metrics per 1h"""
permission_classes = [IsAdminUser]

View File

@ -1,5 +1,6 @@
"""OAuth2Provider API Views"""
from rest_framework import mixins
from rest_framework.fields import CharField, ListField
from rest_framework.serializers import ModelSerializer
from rest_framework.viewsets import GenericViewSet
@ -14,6 +15,7 @@ class ExpiringBaseGrantModelSerializer(ModelSerializer, MetaNameSerializer):
user = UserSerializer()
provider = OAuth2ProviderSerializer()
scope = ListField(child=CharField())
class Meta:

View File

@ -24,27 +24,7 @@ paths:
get:
operationId: admin_metrics_list
description: Login Metrics per 1h
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
parameters: []
responses:
'200':
description: Login Metrics per 1h
@ -53,21 +33,6 @@ paths:
tags:
- admin
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/:
get:
operationId: admin_system_tasks_list
@ -11718,6 +11683,7 @@ definitions:
required:
- provider
- user
- scope
type: object
properties:
pk:
@ -11737,9 +11703,11 @@ definitions:
type: string
format: date-time
scope:
title: Scope
type: string
readOnly: true
description: ''
type: array
items:
type: string
minLength: 1
Outpost:
description: Outpost Serializer
required:

View File

@ -8,7 +8,7 @@ import { DEFAULT_CONFIG } from "../../api/Config";
export class AdminLoginsChart extends AKChart<LoginMetrics> {
apiRequest(): Promise<LoginMetrics> {
return new AdminApi(DEFAULT_CONFIG).adminMetricsList({});
return new AdminApi(DEFAULT_CONFIG).adminMetricsList();
}
getDatasets(data: LoginMetrics): Chart.ChartDataSets[] {

View File

@ -35,9 +35,9 @@ export class UserOAuthCodeList extends Table<ExpiringBaseGrantModel> {
row(item: ExpiringBaseGrantModel): TemplateResult[] {
return [
html`${item.provider}`,
html`${item.provider.name}`,
html`${item.expires?.toLocaleString()}`,
html`${item.scope}`,
html`${item.scope.join(", ")}`,
html`
<ak-forms-delete
.obj=${item}

View File

@ -35,9 +35,9 @@ export class UserOAuthRefreshList extends Table<ExpiringBaseGrantModel> {
row(item: ExpiringBaseGrantModel): TemplateResult[] {
return [
html`${item.provider}`,
html`${item.provider.name}`,
html`${item.expires?.toLocaleString()}`,
html`${item.scope}`,
html`${item.scope.join(", ")}`,
html`
<ak-forms-delete
.obj=${item}