root: fix API schema for kotlin (#7601)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L 2023-11-17 00:07:21 +01:00 committed by GitHub
parent 60af4a2e37
commit b5e059dfd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 60 additions and 39 deletions

View file

@ -30,7 +30,7 @@ class RuntimeDict(TypedDict):
uname: str uname: str
class SystemSerializer(PassiveSerializer): class SystemInfoSerializer(PassiveSerializer):
"""Get system information.""" """Get system information."""
http_headers = SerializerMethodField() http_headers = SerializerMethodField()
@ -91,14 +91,14 @@ class SystemView(APIView):
permission_classes = [HasPermission("authentik_rbac.view_system_info")] permission_classes = [HasPermission("authentik_rbac.view_system_info")]
pagination_class = None pagination_class = None
filter_backends = [] 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: def get(self, request: Request) -> Response:
"""Get system information.""" """Get system information."""
return Response(SystemSerializer(request).data) return Response(SystemInfoSerializer(request).data)
@extend_schema(responses={200: SystemSerializer(many=False)}) @extend_schema(responses={200: SystemInfoSerializer(many=False)})
def post(self, request: Request) -> Response: def post(self, request: Request) -> Response:
"""Get system information.""" """Get system information."""
return Response(SystemSerializer(request).data) return Response(SystemInfoSerializer(request).data)

View file

@ -19,7 +19,7 @@ from authentik.stages.authenticator.oath import TOTP
from authentik.stages.authenticator.util import hex_validator, random_hex from authentik.stages.authenticator.util import hex_validator, random_hex
class TOTPDigits(models.IntegerChoices): class TOTPDigits(models.TextChoices):
"""OTP Time Digits""" """OTP Time Digits"""
SIX = 6, _("6 digits, widely compatible") SIX = 6, _("6 digits, widely compatible")

View file

@ -6241,10 +6241,10 @@
"title": "Friendly name" "title": "Friendly name"
}, },
"digits": { "digits": {
"type": "integer", "type": "string",
"enum": [ "enum": [
6, "6",
8 "8"
], ],
"title": "Digits" "title": "Digits"
} }

View file

@ -107,7 +107,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/System' $ref: '#/components/schemas/SystemInfo'
description: '' description: ''
'400': '400':
content: content:
@ -133,7 +133,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/System' $ref: '#/components/schemas/SystemInfo'
description: '' description: ''
'400': '400':
content: content:
@ -22451,10 +22451,10 @@ paths:
- in: query - in: query
name: digits name: digits
schema: schema:
type: integer type: string
enum: enum:
- 6 - '6'
- 8 - '8'
description: |- description: |-
* `6` - 6 digits, widely compatible * `6` - 6 digits, widely compatible
* `8` - 8 digits, not compatible with apps like Google Authenticator * `8` - 8 digits, not compatible with apps like Google Authenticator
@ -28794,10 +28794,7 @@ components:
type: string type: string
nullable: true nullable: true
digits: digits:
allOf: $ref: '#/components/schemas/DigitsEnum'
- $ref: '#/components/schemas/DigitsEnum'
minimum: -2147483648
maximum: 2147483647
required: required:
- component - component
- digits - digits
@ -28828,10 +28825,7 @@ components:
nullable: true nullable: true
minLength: 1 minLength: 1
digits: digits:
allOf: $ref: '#/components/schemas/DigitsEnum'
- $ref: '#/components/schemas/DigitsEnum'
minimum: -2147483648
maximum: 2147483647
required: required:
- digits - digits
- name - name
@ -29920,9 +29914,9 @@ components:
* `http://www.w3.org/2001/04/xmlenc#sha512` - SHA512 * `http://www.w3.org/2001/04/xmlenc#sha512` - SHA512
DigitsEnum: DigitsEnum:
enum: enum:
- 6 - '6'
- 8 - '8'
type: integer type: string
description: |- description: |-
* `6` - 6 digits, widely compatible * `6` - 6 digits, widely compatible
* `8` - 8 digits, not compatible with apps like Google Authenticator * `8` - 8 digits, not compatible with apps like Google Authenticator
@ -35909,10 +35903,7 @@ components:
nullable: true nullable: true
minLength: 1 minLength: 1
digits: digits:
allOf: $ref: '#/components/schemas/DigitsEnum'
- $ref: '#/components/schemas/DigitsEnum'
minimum: -2147483648
maximum: 2147483647
PatchedAuthenticatorValidateStageRequest: PatchedAuthenticatorValidateStageRequest:
type: object type: object
description: AuthenticatorValidateStage Serializer description: AuthenticatorValidateStage Serializer
@ -41152,7 +41143,7 @@ components:
* `user_username` - Based on the username * `user_username` - Based on the username
* `user_email` - Based on the User's Email. This is recommended over the UPN method. * `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. * `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 type: object
description: Get system information. description: Get system information.
properties: properties:

View file

@ -8,10 +8,10 @@ import { msg } from "@lit/localize";
import { TemplateResult, html } from "lit"; import { TemplateResult, html } from "lit";
import { customElement, state } from "lit/decorators.js"; 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") @customElement("ak-admin-status-system")
export class SystemStatusCard extends AdminStatusCard<System> { export class SystemStatusCard extends AdminStatusCard<SystemInfo> {
now?: Date; now?: Date;
icon = "pf-icon pf-icon-server"; icon = "pf-icon pf-icon-server";
@ -19,7 +19,7 @@ export class SystemStatusCard extends AdminStatusCard<System> {
@state() @state()
statusSummary?: string; statusSummary?: string;
async getPrimaryValue(): Promise<System> { async getPrimaryValue(): Promise<SystemInfo> {
this.now = new Date(); this.now = new Date();
let status = await new AdminApi(DEFAULT_CONFIG).adminSystemRetrieve(); let status = await new AdminApi(DEFAULT_CONFIG).adminSystemRetrieve();
if (status.embeddedOutpostHost === "" || !status.embeddedOutpostHost.includes("http")) { if (status.embeddedOutpostHost === "" || !status.embeddedOutpostHost.includes("http")) {
@ -50,7 +50,7 @@ export class SystemStatusCard extends AdminStatusCard<System> {
}); });
} }
getStatus(value: System): Promise<AdminStatus> { getStatus(value: SystemInfo): Promise<AdminStatus> {
if (value.embeddedOutpostHost === "") { if (value.embeddedOutpostHost === "") {
this.statusSummary = msg("Warning"); this.statusSummary = msg("Warning");
return Promise.resolve<AdminStatus>({ return Promise.resolve<AdminStatus>({

View file

@ -89,14 +89,14 @@ export class AuthenticatorTOTPStageForm extends ModelForm<AuthenticatorTOTPStage
> >
<select name="users" class="pf-c-form-control"> <select name="users" class="pf-c-form-control">
<option <option
value="${DigitsEnum.NUMBER_6}" value="${DigitsEnum._6}"
?selected=${this.instance?.digits === DigitsEnum.NUMBER_6} ?selected=${this.instance?.digits === DigitsEnum._6}
> >
${msg("6 digits, widely compatible")} ${msg("6 digits, widely compatible")}
</option> </option>
<option <option
value="${DigitsEnum.NUMBER_8}" value="${DigitsEnum._8}"
?selected=${this.instance?.digits === DigitsEnum.NUMBER_8} ?selected=${this.instance?.digits === DigitsEnum._8}
> >
${msg( ${msg(
"8 digits, not compatible with apps like Google Authenticator", "8 digits, not compatible with apps like Google Authenticator",

View file

@ -6066,6 +6066,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit> </trans-unit>
<trans-unit id="s3d2a8b86a4f5a810"> <trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source> <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> </trans-unit>
</body> </body>
</file> </file>

View file

@ -6343,6 +6343,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit> </trans-unit>
<trans-unit id="s3d2a8b86a4f5a810"> <trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source> <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> </trans-unit>
</body> </body>
</file> </file>

View file

@ -5982,6 +5982,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit> </trans-unit>
<trans-unit id="s3d2a8b86a4f5a810"> <trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source> <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> </trans-unit>
</body> </body>
</file> </file>

View file

@ -7968,6 +7968,9 @@ Les liaisons avec les groupes/utilisateurs sont vérifiées par rapport à l'uti
</trans-unit> </trans-unit>
<trans-unit id="s3d2a8b86a4f5a810"> <trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source> <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> </trans-unit>
</body> </body>
</file> </file>

View file

@ -6190,6 +6190,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit> </trans-unit>
<trans-unit id="s3d2a8b86a4f5a810"> <trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source> <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> </trans-unit>
</body> </body>
</file> </file>

View file

@ -7868,4 +7868,7 @@ Bindings to groups/users are checked against the user of the event.</source>
<trans-unit id="s3d2a8b86a4f5a810"> <trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source> <source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source>
</trans-unit> </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> </body></file></xliff>

View file

@ -5975,6 +5975,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit> </trans-unit>
<trans-unit id="s3d2a8b86a4f5a810"> <trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source> <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> </trans-unit>
</body> </body>
</file> </file>

View file

@ -7970,6 +7970,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit> </trans-unit>
<trans-unit id="s3d2a8b86a4f5a810"> <trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source> <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> </trans-unit>
</body> </body>
</file> </file>

View file

@ -6023,6 +6023,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit> </trans-unit>
<trans-unit id="s3d2a8b86a4f5a810"> <trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source> <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> </trans-unit>
</body> </body>
</file> </file>

View file

@ -6022,6 +6022,9 @@ Bindings to groups/users are checked against the user of the event.</source>
</trans-unit> </trans-unit>
<trans-unit id="s3d2a8b86a4f5a810"> <trans-unit id="s3d2a8b86a4f5a810">
<source>Successfully created user and added to group <x id="0" equiv-text="${this.group.name}"/></source> <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> </trans-unit>
</body> </body>
</file> </file>