Skip to content

Commit

Permalink
root: fix API schema for kotlin
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
  • Loading branch information
BeryJu committed Nov 16, 2023
1 parent 60af4a2 commit aff1fc3
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 39 deletions.
12 changes: 6 additions & 6 deletions authentik/admin/api/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class RuntimeDict(TypedDict):
uname: str


class SystemSerializer(PassiveSerializer):
class SystemInfoSerializer(PassiveSerializer):
"""Get system information."""

http_headers = SerializerMethodField()
Expand Down Expand Up @@ -91,14 +91,14 @@ class SystemView(APIView):
permission_classes = [HasPermission("authentik_rbac.view_system_info")]
pagination_class = None
filter_backends = []
serializer_class = SystemSerializer
serializer_class = SystemInfoSerializer

@extend_schema(responses={200: SystemSerializer(many=False)})
@extend_schema(responses={200: SystemInfoSerializer(many=False)})
def get(self, request: Request) -> Response:
"""Get system information."""
return Response(SystemSerializer(request).data)
return Response(SystemInfoSerializer(request).data)

Check warning on line 99 in authentik/admin/api/system.py

View check run for this annotation

Codecov / codecov/patch

authentik/admin/api/system.py#L99

Added line #L99 was not covered by tests

@extend_schema(responses={200: SystemSerializer(many=False)})
@extend_schema(responses={200: SystemInfoSerializer(many=False)})
def post(self, request: Request) -> Response:
"""Get system information."""
return Response(SystemSerializer(request).data)
return Response(SystemInfoSerializer(request).data)

Check warning on line 104 in authentik/admin/api/system.py

View check run for this annotation

Codecov / codecov/patch

authentik/admin/api/system.py#L104

Added line #L104 was not covered by tests
2 changes: 1 addition & 1 deletion authentik/stages/authenticator_totp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from authentik.stages.authenticator.util import hex_validator, random_hex


class TOTPDigits(models.IntegerChoices):
class TOTPDigits(models.TextChoices):
"""OTP Time Digits"""

SIX = 6, _("6 digits, widely compatible")
Expand Down
6 changes: 3 additions & 3 deletions blueprints/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6241,10 +6241,10 @@
"title": "Friendly name"
},
"digits": {
"type": "integer",
"type": "string",
"enum": [
6,
8
"6",
"8"
],
"title": "Digits"
}
Expand Down
33 changes: 12 additions & 21 deletions schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/System'
$ref: '#/components/schemas/SystemInfo'
description: ''
'400':
content:
Expand All @@ -133,7 +133,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/System'
$ref: '#/components/schemas/SystemInfo'
description: ''
'400':
content:
Expand Down Expand Up @@ -22451,10 +22451,10 @@ paths:
- in: query
name: digits
schema:
type: integer
type: string
enum:
- 6
- 8
- '6'
- '8'
description: |-
* `6` - 6 digits, widely compatible
* `8` - 8 digits, not compatible with apps like Google Authenticator
Expand Down Expand Up @@ -28794,10 +28794,7 @@ components:
type: string
nullable: true
digits:
allOf:
- $ref: '#/components/schemas/DigitsEnum'
minimum: -2147483648
maximum: 2147483647
$ref: '#/components/schemas/DigitsEnum'
required:
- component
- digits
Expand Down Expand Up @@ -28828,10 +28825,7 @@ components:
nullable: true
minLength: 1
digits:
allOf:
- $ref: '#/components/schemas/DigitsEnum'
minimum: -2147483648
maximum: 2147483647
$ref: '#/components/schemas/DigitsEnum'
required:
- digits
- name
Expand Down Expand Up @@ -29920,9 +29914,9 @@ components:
* `http://www.w3.org/2001/04/xmlenc#sha512` - SHA512
DigitsEnum:
enum:
- 6
- 8
type: integer
- '6'
- '8'
type: string
description: |-
* `6` - 6 digits, widely compatible
* `8` - 8 digits, not compatible with apps like Google Authenticator
Expand Down Expand Up @@ -35909,10 +35903,7 @@ components:
nullable: true
minLength: 1
digits:
allOf:
- $ref: '#/components/schemas/DigitsEnum'
minimum: -2147483648
maximum: 2147483647
$ref: '#/components/schemas/DigitsEnum'
PatchedAuthenticatorValidateStageRequest:
type: object
description: AuthenticatorValidateStage Serializer
Expand Down Expand Up @@ -41152,7 +41143,7 @@ components:
* `user_username` - Based on the username
* `user_email` - Based on the User's Email. This is recommended over the UPN method.
* `user_upn` - Based on the User's UPN, only works if user has a 'upn' attribute set. Use this method only if you have different UPN and Mail domains.
System:
SystemInfo:
type: object
description: Get system information.
properties:
Expand Down
8 changes: 4 additions & 4 deletions web/src/admin/admin-overview/cards/SystemStatusCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import { msg } from "@lit/localize";
import { TemplateResult, html } from "lit";
import { customElement, state } from "lit/decorators.js";

import { AdminApi, OutpostsApi, System } from "@goauthentik/api";
import { AdminApi, OutpostsApi, SystemInfo } from "@goauthentik/api";

@customElement("ak-admin-status-system")
export class SystemStatusCard extends AdminStatusCard<System> {
export class SystemStatusCard extends AdminStatusCard<SystemInfo> {
now?: Date;

icon = "pf-icon pf-icon-server";

@state()
statusSummary?: string;

async getPrimaryValue(): Promise<System> {
async getPrimaryValue(): Promise<SystemInfo> {
this.now = new Date();
let status = await new AdminApi(DEFAULT_CONFIG).adminSystemRetrieve();
if (status.embeddedOutpostHost === "" || !status.embeddedOutpostHost.includes("http")) {
Expand Down Expand Up @@ -50,7 +50,7 @@ export class SystemStatusCard extends AdminStatusCard<System> {
});
}

getStatus(value: System): Promise<AdminStatus> {
getStatus(value: SystemInfo): Promise<AdminStatus> {
if (value.embeddedOutpostHost === "") {
this.statusSummary = msg("Warning");
return Promise.resolve<AdminStatus>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ export class AuthenticatorTOTPStageForm extends ModelForm<AuthenticatorTOTPStage
>
<select name="users" class="pf-c-form-control">
<option
value="${DigitsEnum.NUMBER_6}"
?selected=${this.instance?.digits === DigitsEnum.NUMBER_6}
value="${DigitsEnum._6}"
?selected=${this.instance?.digits === DigitsEnum._6}
>
${msg("6 digits, widely compatible")}
</option>
<option
value="${DigitsEnum.NUMBER_8}"
?selected=${this.instance?.digits === DigitsEnum.NUMBER_8}
value="${DigitsEnum._8}"
?selected=${this.instance?.digits === DigitsEnum._8}
>
${msg(
"8 digits, not compatible with apps like Google Authenticator",
Expand Down
3 changes: 3 additions & 0 deletions web/xliff/de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -6066,6 +6066,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit>
<trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source>
</trans-unit>
<trans-unit id="s824e0943a7104668">
<source>This user will be added to the group "<x id="0" equiv-text="${this.targetGroup.name}"/>".</source>
</trans-unit>
</body>
</file>
Expand Down
3 changes: 3 additions & 0 deletions web/xliff/en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -6343,6 +6343,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit>
<trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source>
</trans-unit>
<trans-unit id="s824e0943a7104668">
<source>This user will be added to the group "<x id="0" equiv-text="${this.targetGroup.name}"/>".</source>
</trans-unit>
</body>
</file>
Expand Down
3 changes: 3 additions & 0 deletions web/xliff/es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -5982,6 +5982,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit>
<trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source>
</trans-unit>
<trans-unit id="s824e0943a7104668">
<source>This user will be added to the group "<x id="0" equiv-text="${this.targetGroup.name}"/>".</source>
</trans-unit>
</body>
</file>
Expand Down
3 changes: 3 additions & 0 deletions web/xliff/fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -7968,6 +7968,9 @@ Les liaisons avec les groupes/utilisateurs sont vérifiées par rapport à l'uti
</trans-unit>
<trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source>
</trans-unit>
<trans-unit id="s824e0943a7104668">
<source>This user will be added to the group "<x id="0" equiv-text="${this.targetGroup.name}"/>".</source>
</trans-unit>
</body>
</file>
Expand Down
3 changes: 3 additions & 0 deletions web/xliff/pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -6190,6 +6190,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit>
<trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source>
</trans-unit>
<trans-unit id="s824e0943a7104668">
<source>This user will be added to the group "<x id="0" equiv-text="${this.targetGroup.name}"/>".</source>
</trans-unit>
</body>
</file>
Expand Down
3 changes: 3 additions & 0 deletions web/xliff/pseudo-LOCALE.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -7868,4 +7868,7 @@ Bindings to groups/users are checked against the user of the event.</source>
<trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source>
</trans-unit>
<trans-unit id="s824e0943a7104668">
<source>This user will be added to the group "<x id="0" equiv-text="${this.targetGroup.name}"/>".</source>
</trans-unit>
</body></file></xliff>
3 changes: 3 additions & 0 deletions web/xliff/tr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -5975,6 +5975,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit>
<trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source>
</trans-unit>
<trans-unit id="s824e0943a7104668">
<source>This user will be added to the group "<x id="0" equiv-text="${this.targetGroup.name}"/>".</source>
</trans-unit>
</body>
</file>
Expand Down
3 changes: 3 additions & 0 deletions web/xliff/zh-Hans.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -7970,6 +7970,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit>
<trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source>
</trans-unit>
<trans-unit id="s824e0943a7104668">
<source>This user will be added to the group "<x id="0" equiv-text="${this.targetGroup.name}"/>".</source>
</trans-unit>
</body>
</file>
Expand Down
3 changes: 3 additions & 0 deletions web/xliff/zh-Hant.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -6023,6 +6023,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit>
<trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source>
</trans-unit>
<trans-unit id="s824e0943a7104668">
<source>This user will be added to the group "<x id="0" equiv-text="${this.targetGroup.name}"/>".</source>
</trans-unit>
</body>
</file>
Expand Down
3 changes: 3 additions & 0 deletions web/xliff/zh_TW.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -6022,6 +6022,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit>
<trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source>
</trans-unit>
<trans-unit id="s824e0943a7104668">
<source>This user will be added to the group "<x id="0" equiv-text="${this.targetGroup.name}"/>".</source>
</trans-unit>
</body>
</file>
Expand Down

0 comments on commit aff1fc3

Please sign in to comment.