Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <[email protected]>
  • Loading branch information
BeryJu committed Oct 22, 2024
1 parent 47866de commit f20f060
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 116 deletions.
5 changes: 4 additions & 1 deletion authentik/blueprints/v1/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
MicrosoftEntraProviderUser,
)
from authentik.enterprise.providers.rac.models import ConnectionToken
from authentik.enterprise.stages.authenticator_endpoint_gdtc.models import EndpointDevice, EndpointDeviceConnection
from authentik.enterprise.stages.authenticator_endpoint_gdtc.models import (
EndpointDevice,
EndpointDeviceConnection,
)
from authentik.events.logs import LogEvent, capture_logs
from authentik.events.models import SystemTask
from authentik.events.utils import cleanse_dict
Expand Down
3 changes: 3 additions & 0 deletions authentik/core/api/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from rest_framework.viewsets import ViewSet

from authentik.core.api.utils import MetaNameSerializer
from authentik.enterprise.stages.authenticator_endpoint_gdtc.models import EndpointDevice
from authentik.rbac.decorators import permission_required
from authentik.stages.authenticator import device_classes, devices_for_user
from authentik.stages.authenticator.models import Device
Expand All @@ -40,6 +41,8 @@ def get_extra_description(self, instance: Device) -> str:
"""Get extra description"""
if isinstance(instance, WebAuthnDevice):
return instance.device_type.description
if isinstance(instance, EndpointDevice):
return instance.data.get("deviceSignals", {}).get("deviceModel")

Check warning on line 45 in authentik/core/api/devices.py

View check run for this annotation

Codecov / codecov/patch

authentik/core/api/devices.py#L44-L45

Added lines #L44 - L45 were not covered by tests
return ""


Expand Down
5 changes: 4 additions & 1 deletion authentik/core/management/commands/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import platform
import sys
import traceback
from pprint import pprint

from django.apps import apps
from django.core.management.base import BaseCommand
Expand Down Expand Up @@ -34,7 +35,9 @@ def add_arguments(self, parser):

def get_namespace(self):
"""Prepare namespace with all models"""
namespace = {}
namespace = {
"pprint": pprint,
}

# Gather Django models and constants from each app
for app in apps.get_app_configs():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ class Meta:

class EndpointDeviceViewSet(
mixins.RetrieveModelMixin,
mixins.UpdateModelMixin,
mixins.DestroyModelMixin,
UsedByMixin,
mixins.ListModelMixin,
UsedByMixin,
GenericViewSet,
):
"""Viewset for Endpoint authenticator devices"""
Expand Down
2 changes: 1 addition & 1 deletion authentik/flows/challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.http import JsonResponse
from rest_framework.fields import CharField, ChoiceField, DictField, BooleanField
from rest_framework.fields import BooleanField, CharField, ChoiceField, DictField
from rest_framework.request import Request

from authentik.core.api.utils import PassiveSerializer
Expand Down
109 changes: 0 additions & 109 deletions schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2132,115 +2132,6 @@ paths:
schema:
$ref: '#/components/schemas/GenericError'
description: ''
put:
operationId: authenticators_endpoint_update
description: Viewset for Endpoint authenticator devices
parameters:
- in: path
name: uuid
schema:
type: string
format: uuid
description: A UUID string identifying this Endpoint Device.
required: true
tags:
- authenticators
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EndpointDeviceRequest'
required: true
security:
- authentik: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/EndpointDevice'
description: ''
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
description: ''
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
description: ''
patch:
operationId: authenticators_endpoint_partial_update
description: Viewset for Endpoint authenticator devices
parameters:
- in: path
name: uuid
schema:
type: string
format: uuid
description: A UUID string identifying this Endpoint Device.
required: true
tags:
- authenticators
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PatchedEndpointDeviceRequest'
security:
- authentik: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/EndpointDevice'
description: ''
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
description: ''
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
description: ''
delete:
operationId: authenticators_endpoint_destroy
description: Viewset for Endpoint authenticator devices
parameters:
- in: path
name: uuid
schema:
type: string
format: uuid
description: A UUID string identifying this Endpoint Device.
required: true
tags:
- authenticators
security:
- authentik: []
responses:
'204':
description: No response body
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationError'
description: ''
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
description: ''
/authenticators/endpoint/{uuid}/used_by/:
get:
operationId: authenticators_endpoint_used_by_list
Expand Down
2 changes: 1 addition & 1 deletion web/src/user/user-settings/mfa/MFADeviceForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class MFADeviceForm extends ModelForm<Device, string> {
break;
default:
throw new SentryIgnoredError(
msg(str`Device type ${device.verboseName} cannot be eddited`),
msg(str`Device type ${device.verboseName} cannot be edited`),
);
}
return device;
Expand Down

0 comments on commit f20f060

Please sign in to comment.