web: expressing success (#7830)
* web: expressing success Ever see an idiom that just, I dunno, *annoyed* you? Automated tools for the win. * web: repetition, repetition, repetition! [throws chair] * web: giving the de-duplication treatment to policy mappings. * Created a BaseStageForm with success message and canonical primary key type for for Providers, Sources, and Stages.
This commit is contained in:
parent
f1b6793145
commit
b181c551a5
|
@ -75,11 +75,9 @@ export class ApplicationForm extends ModelForm<Application, string> {
|
||||||
clearIcon = false;
|
clearIcon = false;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated application.");
|
? msg("Successfully updated application.")
|
||||||
} else {
|
: msg("Successfully created application.");
|
||||||
return msg("Successfully created application.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: Application): Promise<Application | void> {
|
async send(data: Application): Promise<Application | void> {
|
||||||
|
|
|
@ -44,11 +44,9 @@ export class BlueprintForm extends ModelForm<BlueprintInstance, string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated instance.");
|
? msg("Successfully updated instance.")
|
||||||
} else {
|
: msg("Successfully created instance.");
|
||||||
return msg("Successfully created instance.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResult[] {
|
static get styles(): CSSResult[] {
|
||||||
|
|
|
@ -19,11 +19,9 @@ export class CertificateKeyPairForm extends ModelForm<CertificateKeyPair, string
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated certificate-key pair.");
|
? msg("Successfully updated certificate-key pair.")
|
||||||
} else {
|
: msg("Successfully created certificate-key pair.");
|
||||||
return msg("Successfully created certificate-key pair.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: CertificateKeyPair): Promise<CertificateKeyPair> {
|
async send(data: CertificateKeyPair): Promise<CertificateKeyPair> {
|
||||||
|
|
|
@ -37,11 +37,9 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated rule.");
|
? msg("Successfully updated rule.")
|
||||||
} else {
|
: msg("Successfully created rule.");
|
||||||
return msg("Successfully created rule.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: NotificationRule): Promise<NotificationRule> {
|
async send(data: NotificationRule): Promise<NotificationRule> {
|
||||||
|
|
|
@ -36,11 +36,9 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
|
||||||
showWebhook = false;
|
showWebhook = false;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated transport.");
|
? msg("Successfully updated transport.")
|
||||||
} else {
|
: msg("Successfully created transport.");
|
||||||
return msg("Successfully created transport.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: NotificationTransport): Promise<NotificationTransport> {
|
async send(data: NotificationTransport): Promise<NotificationTransport> {
|
||||||
|
|
|
@ -34,11 +34,9 @@ export class FlowForm extends ModelForm<Flow, string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated flow.");
|
? msg("Successfully updated flow.")
|
||||||
} else {
|
: msg("Successfully created flow.");
|
||||||
return msg("Successfully created flow.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@property({ type: Boolean })
|
@property({ type: Boolean })
|
||||||
|
|
|
@ -46,11 +46,9 @@ export class GroupForm extends ModelForm<Group, string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated group.");
|
? msg("Successfully updated group.")
|
||||||
} else {
|
: msg("Successfully created group.");
|
||||||
return msg("Successfully created group.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async load(): Promise<void> {
|
async load(): Promise<void> {
|
||||||
|
|
|
@ -79,11 +79,9 @@ export class OutpostForm extends ModelForm<Outpost, string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated outpost.");
|
? msg("Successfully updated outpost.")
|
||||||
} else {
|
: msg("Successfully created outpost.");
|
||||||
return msg("Successfully created outpost.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: Outpost): Promise<Outpost> {
|
async send(data: Outpost): Promise<Outpost> {
|
||||||
|
|
|
@ -21,11 +21,9 @@ export class ServiceConnectionDockerForm extends ModelForm<DockerServiceConnecti
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated integration.");
|
? msg("Successfully updated integration.")
|
||||||
} else {
|
: msg("Successfully created integration.");
|
||||||
return msg("Successfully created integration.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: DockerServiceConnection): Promise<DockerServiceConnection> {
|
async send(data: DockerServiceConnection): Promise<DockerServiceConnection> {
|
||||||
|
|
|
@ -25,11 +25,9 @@ export class ServiceConnectionKubernetesForm extends ModelForm<
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated integration.");
|
? msg("Successfully updated integration.")
|
||||||
} else {
|
: msg("Successfully created integration.");
|
||||||
return msg("Successfully created integration.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: KubernetesServiceConnection): Promise<KubernetesServiceConnection> {
|
async send(data: KubernetesServiceConnection): Promise<KubernetesServiceConnection> {
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||||
|
|
||||||
|
import { msg } from "@lit/localize";
|
||||||
|
|
||||||
|
export abstract class BasePolicyForm<T> extends ModelForm<T, string> {
|
||||||
|
getSuccessMessage(): string {
|
||||||
|
return this.instance
|
||||||
|
? msg("Successfully updated policy.")
|
||||||
|
: msg("Successfully created policy.");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { BasePolicyForm } from "@goauthentik/admin/policies/BasePolicyForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -12,21 +12,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { DummyPolicy, PoliciesApi } from "@goauthentik/api";
|
import { DummyPolicy, PoliciesApi } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-policy-dummy-form")
|
@customElement("ak-policy-dummy-form")
|
||||||
export class DummyPolicyForm extends ModelForm<DummyPolicy, string> {
|
export class DummyPolicyForm extends BasePolicyForm<DummyPolicy> {
|
||||||
loadInstance(pk: string): Promise<DummyPolicy> {
|
loadInstance(pk: string): Promise<DummyPolicy> {
|
||||||
return new PoliciesApi(DEFAULT_CONFIG).policiesDummyRetrieve({
|
return new PoliciesApi(DEFAULT_CONFIG).policiesDummyRetrieve({
|
||||||
policyUuid: pk,
|
policyUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated policy.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created policy.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: DummyPolicy): Promise<DummyPolicy> {
|
async send(data: DummyPolicy): Promise<DummyPolicy> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new PoliciesApi(DEFAULT_CONFIG).policiesDummyUpdate({
|
return new PoliciesApi(DEFAULT_CONFIG).policiesDummyUpdate({
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { BasePolicyForm } from "@goauthentik/admin/policies/BasePolicyForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
|
@ -20,21 +20,13 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-policy-event-matcher-form")
|
@customElement("ak-policy-event-matcher-form")
|
||||||
export class EventMatcherPolicyForm extends ModelForm<EventMatcherPolicy, string> {
|
export class EventMatcherPolicyForm extends BasePolicyForm<EventMatcherPolicy> {
|
||||||
loadInstance(pk: string): Promise<EventMatcherPolicy> {
|
loadInstance(pk: string): Promise<EventMatcherPolicy> {
|
||||||
return new PoliciesApi(DEFAULT_CONFIG).policiesEventMatcherRetrieve({
|
return new PoliciesApi(DEFAULT_CONFIG).policiesEventMatcherRetrieve({
|
||||||
policyUuid: pk,
|
policyUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated policy.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created policy.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: EventMatcherPolicy): Promise<EventMatcherPolicy> {
|
async send(data: EventMatcherPolicy): Promise<EventMatcherPolicy> {
|
||||||
if (data.action?.toString() === "") data.action = null;
|
if (data.action?.toString() === "") data.action = null;
|
||||||
if (data.clientIp?.toString() === "") data.clientIp = null;
|
if (data.clientIp?.toString() === "") data.clientIp = null;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { BasePolicyForm } from "@goauthentik/admin/policies/BasePolicyForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -12,21 +12,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { PasswordExpiryPolicy, PoliciesApi } from "@goauthentik/api";
|
import { PasswordExpiryPolicy, PoliciesApi } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-policy-password-expiry-form")
|
@customElement("ak-policy-password-expiry-form")
|
||||||
export class PasswordExpiryPolicyForm extends ModelForm<PasswordExpiryPolicy, string> {
|
export class PasswordExpiryPolicyForm extends BasePolicyForm<PasswordExpiryPolicy> {
|
||||||
loadInstance(pk: string): Promise<PasswordExpiryPolicy> {
|
loadInstance(pk: string): Promise<PasswordExpiryPolicy> {
|
||||||
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordExpiryRetrieve({
|
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordExpiryRetrieve({
|
||||||
policyUuid: pk,
|
policyUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated policy.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created policy.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: PasswordExpiryPolicy): Promise<PasswordExpiryPolicy> {
|
async send(data: PasswordExpiryPolicy): Promise<PasswordExpiryPolicy> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordExpiryUpdate({
|
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordExpiryUpdate({
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { BasePolicyForm } from "@goauthentik/admin/policies/BasePolicyForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { docLink } from "@goauthentik/common/global";
|
import { docLink } from "@goauthentik/common/global";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
|
@ -5,7 +6,6 @@ import "@goauthentik/elements/CodeMirror";
|
||||||
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -15,21 +15,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { ExpressionPolicy, PoliciesApi } from "@goauthentik/api";
|
import { ExpressionPolicy, PoliciesApi } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-policy-expression-form")
|
@customElement("ak-policy-expression-form")
|
||||||
export class ExpressionPolicyForm extends ModelForm<ExpressionPolicy, string> {
|
export class ExpressionPolicyForm extends BasePolicyForm<ExpressionPolicy> {
|
||||||
loadInstance(pk: string): Promise<ExpressionPolicy> {
|
loadInstance(pk: string): Promise<ExpressionPolicy> {
|
||||||
return new PoliciesApi(DEFAULT_CONFIG).policiesExpressionRetrieve({
|
return new PoliciesApi(DEFAULT_CONFIG).policiesExpressionRetrieve({
|
||||||
policyUuid: pk,
|
policyUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated policy.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created policy.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: ExpressionPolicy): Promise<ExpressionPolicy> {
|
async send(data: ExpressionPolicy): Promise<ExpressionPolicy> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new PoliciesApi(DEFAULT_CONFIG).policiesExpressionUpdate({
|
return new PoliciesApi(DEFAULT_CONFIG).policiesExpressionUpdate({
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { BasePolicyForm } from "@goauthentik/admin/policies/BasePolicyForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -12,7 +12,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { PasswordPolicy, PoliciesApi } from "@goauthentik/api";
|
import { PasswordPolicy, PoliciesApi } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-policy-password-form")
|
@customElement("ak-policy-password-form")
|
||||||
export class PasswordPolicyForm extends ModelForm<PasswordPolicy, string> {
|
export class PasswordPolicyForm extends BasePolicyForm<PasswordPolicy> {
|
||||||
@state()
|
@state()
|
||||||
showStatic = true;
|
showStatic = true;
|
||||||
|
|
||||||
|
@ -32,14 +32,6 @@ export class PasswordPolicyForm extends ModelForm<PasswordPolicy, string> {
|
||||||
return policy;
|
return policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated policy.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created policy.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: PasswordPolicy): Promise<PasswordPolicy> {
|
async send(data: PasswordPolicy): Promise<PasswordPolicy> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordUpdate({
|
return new PoliciesApi(DEFAULT_CONFIG).policiesPasswordUpdate({
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { BasePolicyForm } from "@goauthentik/admin/policies/BasePolicyForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -12,21 +12,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { PoliciesApi, ReputationPolicy } from "@goauthentik/api";
|
import { PoliciesApi, ReputationPolicy } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-policy-reputation-form")
|
@customElement("ak-policy-reputation-form")
|
||||||
export class ReputationPolicyForm extends ModelForm<ReputationPolicy, string> {
|
export class ReputationPolicyForm extends BasePolicyForm<ReputationPolicy> {
|
||||||
loadInstance(pk: string): Promise<ReputationPolicy> {
|
loadInstance(pk: string): Promise<ReputationPolicy> {
|
||||||
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationRetrieve({
|
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationRetrieve({
|
||||||
policyUuid: pk,
|
policyUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated policy.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created policy.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: ReputationPolicy): Promise<ReputationPolicy> {
|
async send(data: ReputationPolicy): Promise<ReputationPolicy> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUpdate({
|
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUpdate({
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||||
|
|
||||||
|
import { msg } from "@lit/localize";
|
||||||
|
|
||||||
|
export abstract class BasePropertyMappingForm<T> extends ModelForm<T, string> {
|
||||||
|
getSuccessMessage(): string {
|
||||||
|
return this.instance
|
||||||
|
? msg("Successfully updated mapping.")
|
||||||
|
: msg("Successfully created mapping.");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { BasePropertyMappingForm } from "@goauthentik/admin/property-mappings/BasePropertyMappingForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { docLink } from "@goauthentik/common/global";
|
import { docLink } from "@goauthentik/common/global";
|
||||||
import "@goauthentik/elements/CodeMirror";
|
import "@goauthentik/elements/CodeMirror";
|
||||||
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -13,21 +13,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { LDAPPropertyMapping, PropertymappingsApi } from "@goauthentik/api";
|
import { LDAPPropertyMapping, PropertymappingsApi } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-property-mapping-ldap-form")
|
@customElement("ak-property-mapping-ldap-form")
|
||||||
export class PropertyMappingLDAPForm extends ModelForm<LDAPPropertyMapping, string> {
|
export class PropertyMappingLDAPForm extends BasePropertyMappingForm<LDAPPropertyMapping> {
|
||||||
loadInstance(pk: string): Promise<LDAPPropertyMapping> {
|
loadInstance(pk: string): Promise<LDAPPropertyMapping> {
|
||||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsLdapRetrieve({
|
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsLdapRetrieve({
|
||||||
pmUuid: pk,
|
pmUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated mapping.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created mapping.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: LDAPPropertyMapping): Promise<LDAPPropertyMapping> {
|
async send(data: LDAPPropertyMapping): Promise<LDAPPropertyMapping> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsLdapUpdate({
|
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsLdapUpdate({
|
||||||
|
|
|
@ -21,11 +21,9 @@ export class PropertyMappingNotification extends ModelForm<NotificationWebhookMa
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated mapping.");
|
? msg("Successfully updated mapping.")
|
||||||
} else {
|
: msg("Successfully created mapping.");
|
||||||
return msg("Successfully created mapping.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: NotificationWebhookMapping): Promise<NotificationWebhookMapping> {
|
async send(data: NotificationWebhookMapping): Promise<NotificationWebhookMapping> {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { BasePropertyMappingForm } from "@goauthentik/admin/property-mappings/BasePropertyMappingForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { docLink } from "@goauthentik/common/global";
|
import { docLink } from "@goauthentik/common/global";
|
||||||
import "@goauthentik/elements/CodeMirror";
|
import "@goauthentik/elements/CodeMirror";
|
||||||
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -13,21 +13,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { PropertymappingsApi, SAMLPropertyMapping } from "@goauthentik/api";
|
import { PropertymappingsApi, SAMLPropertyMapping } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-property-mapping-saml-form")
|
@customElement("ak-property-mapping-saml-form")
|
||||||
export class PropertyMappingSAMLForm extends ModelForm<SAMLPropertyMapping, string> {
|
export class PropertyMappingSAMLForm extends BasePropertyMappingForm<SAMLPropertyMapping> {
|
||||||
loadInstance(pk: string): Promise<SAMLPropertyMapping> {
|
loadInstance(pk: string): Promise<SAMLPropertyMapping> {
|
||||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSamlRetrieve({
|
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSamlRetrieve({
|
||||||
pmUuid: pk,
|
pmUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated mapping.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created mapping.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: SAMLPropertyMapping): Promise<SAMLPropertyMapping> {
|
async send(data: SAMLPropertyMapping): Promise<SAMLPropertyMapping> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSamlUpdate({
|
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSamlUpdate({
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { BasePropertyMappingForm } from "@goauthentik/admin/property-mappings/BasePropertyMappingForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { docLink } from "@goauthentik/common/global";
|
import { docLink } from "@goauthentik/common/global";
|
||||||
import "@goauthentik/elements/CodeMirror";
|
import "@goauthentik/elements/CodeMirror";
|
||||||
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -13,21 +13,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { PropertymappingsApi, SCIMMapping } from "@goauthentik/api";
|
import { PropertymappingsApi, SCIMMapping } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-property-mapping-scim-form")
|
@customElement("ak-property-mapping-scim-form")
|
||||||
export class PropertyMappingSCIMForm extends ModelForm<SCIMMapping, string> {
|
export class PropertyMappingSCIMForm extends BasePropertyMappingForm<SCIMMapping> {
|
||||||
loadInstance(pk: string): Promise<SCIMMapping> {
|
loadInstance(pk: string): Promise<SCIMMapping> {
|
||||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScimRetrieve({
|
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScimRetrieve({
|
||||||
pmUuid: pk,
|
pmUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated mapping.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created mapping.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: SCIMMapping): Promise<SCIMMapping> {
|
async send(data: SCIMMapping): Promise<SCIMMapping> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScimUpdate({
|
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScimUpdate({
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { BasePropertyMappingForm } from "@goauthentik/admin/property-mappings/BasePropertyMappingForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { docLink } from "@goauthentik/common/global";
|
import { docLink } from "@goauthentik/common/global";
|
||||||
import "@goauthentik/elements/CodeMirror";
|
import "@goauthentik/elements/CodeMirror";
|
||||||
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -13,21 +13,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { PropertymappingsApi, ScopeMapping } from "@goauthentik/api";
|
import { PropertymappingsApi, ScopeMapping } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-property-mapping-scope-form")
|
@customElement("ak-property-mapping-scope-form")
|
||||||
export class PropertyMappingScopeForm extends ModelForm<ScopeMapping, string> {
|
export class PropertyMappingScopeForm extends BasePropertyMappingForm<ScopeMapping> {
|
||||||
loadInstance(pk: string): Promise<ScopeMapping> {
|
loadInstance(pk: string): Promise<ScopeMapping> {
|
||||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScopeRetrieve({
|
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScopeRetrieve({
|
||||||
pmUuid: pk,
|
pmUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated mapping.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created mapping.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: ScopeMapping): Promise<ScopeMapping> {
|
async send(data: ScopeMapping): Promise<ScopeMapping> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScopeUpdate({
|
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsScopeUpdate({
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||||
|
|
||||||
|
import { msg } from "@lit/localize";
|
||||||
|
|
||||||
|
export abstract class BaseProviderForm<T> extends ModelForm<T, number> {
|
||||||
|
getSuccessMessage(): string {
|
||||||
|
return this.instance
|
||||||
|
? msg("Successfully updated provider.")
|
||||||
|
: msg("Successfully created provider.");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||||
import "@goauthentik/admin/common/ak-flow-search/ak-tenanted-flow-search";
|
import "@goauthentik/admin/common/ak-flow-search/ak-tenanted-flow-search";
|
||||||
|
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import { rootInterface } from "@goauthentik/elements/Base";
|
import { rootInterface } from "@goauthentik/elements/Base";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/Radio";
|
import "@goauthentik/elements/forms/Radio";
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
|
@ -25,21 +25,13 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-provider-ldap-form")
|
@customElement("ak-provider-ldap-form")
|
||||||
export class LDAPProviderFormPage extends ModelForm<LDAPProvider, number> {
|
export class LDAPProviderFormPage extends BaseProviderForm<LDAPProvider> {
|
||||||
async loadInstance(pk: number): Promise<LDAPProvider> {
|
async loadInstance(pk: number): Promise<LDAPProvider> {
|
||||||
return new ProvidersApi(DEFAULT_CONFIG).providersLdapRetrieve({
|
return new ProvidersApi(DEFAULT_CONFIG).providersLdapRetrieve({
|
||||||
id: pk,
|
id: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated provider.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created provider.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: LDAPProvider): Promise<LDAPProvider> {
|
async send(data: LDAPProvider): Promise<LDAPProvider> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new ProvidersApi(DEFAULT_CONFIG).providersLdapUpdate({
|
return new ProvidersApi(DEFAULT_CONFIG).providersLdapUpdate({
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||||
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search";
|
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search";
|
||||||
|
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { ascii_letters, digits, first, randomString } from "@goauthentik/common/utils";
|
import { ascii_letters, digits, first, randomString } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/components/ak-radio-input";
|
import "@goauthentik/components/ak-radio-input";
|
||||||
|
@ -7,7 +8,6 @@ import "@goauthentik/components/ak-text-input";
|
||||||
import "@goauthentik/components/ak-textarea-input";
|
import "@goauthentik/components/ak-textarea-input";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/Radio";
|
import "@goauthentik/elements/forms/Radio";
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||||
|
@ -116,7 +116,7 @@ export const redirectUriHelp = html`${redirectUriHelpMessages.map(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@customElement("ak-provider-oauth2-form")
|
@customElement("ak-provider-oauth2-form")
|
||||||
export class OAuth2ProviderFormPage extends ModelForm<OAuth2Provider, number> {
|
export class OAuth2ProviderFormPage extends BaseProviderForm<OAuth2Provider> {
|
||||||
propertyMappings?: PaginatedScopeMappingList;
|
propertyMappings?: PaginatedScopeMappingList;
|
||||||
oauthSources?: PaginatedOAuthSourceList;
|
oauthSources?: PaginatedOAuthSourceList;
|
||||||
|
|
||||||
|
@ -143,14 +143,6 @@ export class OAuth2ProviderFormPage extends ModelForm<OAuth2Provider, number> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated provider.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created provider.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: OAuth2Provider): Promise<OAuth2Provider> {
|
async send(data: OAuth2Provider): Promise<OAuth2Provider> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new ProvidersApi(DEFAULT_CONFIG).providersOauth2Update({
|
return new ProvidersApi(DEFAULT_CONFIG).providersOauth2Update({
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||||
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search";
|
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search";
|
||||||
|
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/components/ak-toggle-group";
|
import "@goauthentik/components/ak-toggle-group";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-provider-proxy-form")
|
@customElement("ak-provider-proxy-form")
|
||||||
export class ProxyProviderFormPage extends ModelForm<ProxyProvider, number> {
|
export class ProxyProviderFormPage extends BaseProviderForm<ProxyProvider> {
|
||||||
static get styles(): CSSResult[] {
|
static get styles(): CSSResult[] {
|
||||||
return [...super.styles, PFContent, PFList, PFSpacing];
|
return [...super.styles, PFContent, PFList, PFSpacing];
|
||||||
}
|
}
|
||||||
|
@ -65,14 +65,6 @@ export class ProxyProviderFormPage extends ModelForm<ProxyProvider, number> {
|
||||||
@state()
|
@state()
|
||||||
mode: ProxyMode = ProxyMode.Proxy;
|
mode: ProxyMode = ProxyMode.Proxy;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated provider.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created provider.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: ProxyProvider): Promise<ProxyProvider> {
|
async send(data: ProxyProvider): Promise<ProxyProvider> {
|
||||||
data.mode = this.mode;
|
data.mode = this.mode;
|
||||||
if (this.mode !== ProxyMode.ForwardDomain) {
|
if (this.mode !== ProxyMode.ForwardDomain) {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { ascii_letters, digits, first, randomString } from "@goauthentik/common/utils";
|
import { ascii_letters, digits, first, randomString } from "@goauthentik/common/utils";
|
||||||
import { rootInterface } from "@goauthentik/elements/Base";
|
import { rootInterface } from "@goauthentik/elements/Base";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
|
@ -14,21 +14,13 @@ import { customElement } from "lit/decorators.js";
|
||||||
import { FlowsInstancesListDesignationEnum, ProvidersApi, RadiusProvider } from "@goauthentik/api";
|
import { FlowsInstancesListDesignationEnum, ProvidersApi, RadiusProvider } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-provider-radius-form")
|
@customElement("ak-provider-radius-form")
|
||||||
export class RadiusProviderFormPage extends ModelForm<RadiusProvider, number> {
|
export class RadiusProviderFormPage extends BaseProviderForm<RadiusProvider> {
|
||||||
loadInstance(pk: number): Promise<RadiusProvider> {
|
loadInstance(pk: number): Promise<RadiusProvider> {
|
||||||
return new ProvidersApi(DEFAULT_CONFIG).providersRadiusRetrieve({
|
return new ProvidersApi(DEFAULT_CONFIG).providersRadiusRetrieve({
|
||||||
id: pk,
|
id: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated provider.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created provider.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: RadiusProvider): Promise<RadiusProvider> {
|
async send(data: RadiusProvider): Promise<RadiusProvider> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new ProvidersApi(DEFAULT_CONFIG).providersRadiusUpdate({
|
return new ProvidersApi(DEFAULT_CONFIG).providersRadiusUpdate({
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||||
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search";
|
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search";
|
||||||
|
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/Radio";
|
import "@goauthentik/elements/forms/Radio";
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||||
|
@ -27,7 +27,7 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-provider-saml-form")
|
@customElement("ak-provider-saml-form")
|
||||||
export class SAMLProviderFormPage extends ModelForm<SAMLProvider, number> {
|
export class SAMLProviderFormPage extends BaseProviderForm<SAMLProvider> {
|
||||||
loadInstance(pk: number): Promise<SAMLProvider> {
|
loadInstance(pk: number): Promise<SAMLProvider> {
|
||||||
return new ProvidersApi(DEFAULT_CONFIG).providersSamlRetrieve({
|
return new ProvidersApi(DEFAULT_CONFIG).providersSamlRetrieve({
|
||||||
id: pk,
|
id: pk,
|
||||||
|
@ -44,14 +44,6 @@ export class SAMLProviderFormPage extends ModelForm<SAMLProvider, number> {
|
||||||
|
|
||||||
propertyMappings?: PaginatedSAMLPropertyMappingList;
|
propertyMappings?: PaginatedSAMLPropertyMappingList;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated provider.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created provider.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: SAMLProvider): Promise<SAMLProvider> {
|
async send(data: SAMLProvider): Promise<SAMLProvider> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new ProvidersApi(DEFAULT_CONFIG).providersSamlUpdate({
|
return new ProvidersApi(DEFAULT_CONFIG).providersSamlUpdate({
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/Radio";
|
import "@goauthentik/elements/forms/Radio";
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-provider-scim-form")
|
@customElement("ak-provider-scim-form")
|
||||||
export class SCIMProviderFormPage extends ModelForm<SCIMProvider, number> {
|
export class SCIMProviderFormPage extends BaseProviderForm<SCIMProvider> {
|
||||||
loadInstance(pk: number): Promise<SCIMProvider> {
|
loadInstance(pk: number): Promise<SCIMProvider> {
|
||||||
return new ProvidersApi(DEFAULT_CONFIG).providersScimRetrieve({
|
return new ProvidersApi(DEFAULT_CONFIG).providersScimRetrieve({
|
||||||
id: pk,
|
id: pk,
|
||||||
|
@ -39,14 +39,6 @@ export class SCIMProviderFormPage extends ModelForm<SCIMProvider, number> {
|
||||||
|
|
||||||
propertyMappings?: PaginatedSCIMMappingList;
|
propertyMappings?: PaginatedSCIMMappingList;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated provider.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created provider.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: SCIMProvider): Promise<SCIMProvider> {
|
async send(data: SCIMProvider): Promise<SCIMProvider> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new ProvidersApi(DEFAULT_CONFIG).providersScimUpdate({
|
return new ProvidersApi(DEFAULT_CONFIG).providersScimUpdate({
|
||||||
|
|
|
@ -21,11 +21,9 @@ export class RoleForm extends ModelForm<Role, string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated role.");
|
? msg("Successfully updated role.")
|
||||||
} else {
|
: msg("Successfully created role.");
|
||||||
return msg("Successfully created role.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: Role): Promise<Role> {
|
async send(data: Role): Promise<Role> {
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||||
|
|
||||||
|
import { msg } from "@lit/localize";
|
||||||
|
|
||||||
|
export abstract class BaseSourceForm<T> extends ModelForm<T, string> {
|
||||||
|
getSuccessMessage(): string {
|
||||||
|
return this.instance
|
||||||
|
? msg("Successfully updated source.")
|
||||||
|
: msg("Successfully created source.");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||||
import { placeholderHelperText } from "@goauthentik/admin/helperText";
|
import { placeholderHelperText } from "@goauthentik/admin/helperText";
|
||||||
|
import { BaseSourceForm } from "@goauthentik/admin/sources/BaseSourceForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
|
@ -24,7 +24,7 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-source-ldap-form")
|
@customElement("ak-source-ldap-form")
|
||||||
export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
export class LDAPSourceForm extends BaseSourceForm<LDAPSource> {
|
||||||
loadInstance(pk: string): Promise<LDAPSource> {
|
loadInstance(pk: string): Promise<LDAPSource> {
|
||||||
return new SourcesApi(DEFAULT_CONFIG).sourcesLdapRetrieve({
|
return new SourcesApi(DEFAULT_CONFIG).sourcesLdapRetrieve({
|
||||||
slug: pk,
|
slug: pk,
|
||||||
|
@ -41,14 +41,6 @@ export class LDAPSourceForm extends ModelForm<LDAPSource, string> {
|
||||||
|
|
||||||
propertyMappings?: PaginatedLDAPPropertyMappingList;
|
propertyMappings?: PaginatedLDAPPropertyMappingList;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated source.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created source.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: LDAPSource): Promise<LDAPSource> {
|
async send(data: LDAPSource): Promise<LDAPSource> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new SourcesApi(DEFAULT_CONFIG).sourcesLdapPartialUpdate({
|
return new SourcesApi(DEFAULT_CONFIG).sourcesLdapPartialUpdate({
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import "@goauthentik/admin/common/ak-flow-search/ak-source-flow-search";
|
import "@goauthentik/admin/common/ak-flow-search/ak-source-flow-search";
|
||||||
import { iconHelperText, placeholderHelperText } from "@goauthentik/admin/helperText";
|
import { iconHelperText, placeholderHelperText } from "@goauthentik/admin/helperText";
|
||||||
|
import { BaseSourceForm } from "@goauthentik/admin/sources/BaseSourceForm";
|
||||||
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
||||||
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
|
@ -8,7 +9,6 @@ import "@goauthentik/elements/CodeMirror";
|
||||||
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
|
@ -28,7 +28,7 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-source-oauth-form")
|
@customElement("ak-source-oauth-form")
|
||||||
export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
export class OAuthSourceForm extends BaseSourceForm<OAuthSource> {
|
||||||
async loadInstance(pk: string): Promise<OAuthSource> {
|
async loadInstance(pk: string): Promise<OAuthSource> {
|
||||||
const source = await new SourcesApi(DEFAULT_CONFIG).sourcesOauthRetrieve({
|
const source = await new SourcesApi(DEFAULT_CONFIG).sourcesOauthRetrieve({
|
||||||
slug: pk,
|
slug: pk,
|
||||||
|
@ -61,14 +61,6 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||||
@state()
|
@state()
|
||||||
clearIcon = false;
|
clearIcon = false;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated source.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created source.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: OAuthSource): Promise<OAuthSource> {
|
async send(data: OAuthSource): Promise<OAuthSource> {
|
||||||
data.providerType = (this.providerType?.slug || "") as ProviderTypeEnum;
|
data.providerType = (this.providerType?.slug || "") as ProviderTypeEnum;
|
||||||
let source: OAuthSource;
|
let source: OAuthSource;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import "@goauthentik/admin/common/ak-flow-search/ak-source-flow-search";
|
import "@goauthentik/admin/common/ak-flow-search/ak-source-flow-search";
|
||||||
import { iconHelperText, placeholderHelperText } from "@goauthentik/admin/helperText";
|
import { iconHelperText, placeholderHelperText } from "@goauthentik/admin/helperText";
|
||||||
|
import { BaseSourceForm } from "@goauthentik/admin/sources/BaseSourceForm";
|
||||||
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
||||||
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
||||||
import { PlexAPIClient, PlexResource, popupCenterScreen } from "@goauthentik/common/helpers/plex";
|
import { PlexAPIClient, PlexResource, popupCenterScreen } from "@goauthentik/common/helpers/plex";
|
||||||
|
@ -7,7 +8,6 @@ import { ascii_letters, digits, first, randomString } from "@goauthentik/common/
|
||||||
import { rootInterface } from "@goauthentik/elements/Base";
|
import { rootInterface } from "@goauthentik/elements/Base";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
|
@ -24,7 +24,7 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-source-plex-form")
|
@customElement("ak-source-plex-form")
|
||||||
export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
export class PlexSourceForm extends BaseSourceForm<PlexSource> {
|
||||||
async loadInstance(pk: string): Promise<PlexSource> {
|
async loadInstance(pk: string): Promise<PlexSource> {
|
||||||
const source = await new SourcesApi(DEFAULT_CONFIG).sourcesPlexRetrieve({
|
const source = await new SourcesApi(DEFAULT_CONFIG).sourcesPlexRetrieve({
|
||||||
slug: pk,
|
slug: pk,
|
||||||
|
@ -50,14 +50,6 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||||
} as PlexSource;
|
} as PlexSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated source.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created source.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: PlexSource): Promise<PlexSource> {
|
async send(data: PlexSource): Promise<PlexSource> {
|
||||||
data.plexToken = this.plexToken || "";
|
data.plexToken = this.plexToken || "";
|
||||||
let source: PlexSource;
|
let source: PlexSource;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||||
import "@goauthentik/admin/common/ak-flow-search/ak-source-flow-search";
|
import "@goauthentik/admin/common/ak-flow-search/ak-source-flow-search";
|
||||||
import { iconHelperText, placeholderHelperText } from "@goauthentik/admin/helperText";
|
import { iconHelperText, placeholderHelperText } from "@goauthentik/admin/helperText";
|
||||||
|
import { BaseSourceForm } from "@goauthentik/admin/sources/BaseSourceForm";
|
||||||
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils";
|
||||||
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import { rootInterface } from "@goauthentik/elements/Base";
|
import { rootInterface } from "@goauthentik/elements/Base";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/Radio";
|
import "@goauthentik/elements/forms/Radio";
|
||||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-source-saml-form")
|
@customElement("ak-source-saml-form")
|
||||||
export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
export class SAMLSourceForm extends BaseSourceForm<SAMLSource> {
|
||||||
@state()
|
@state()
|
||||||
clearIcon = false;
|
clearIcon = false;
|
||||||
|
|
||||||
|
@ -41,14 +41,6 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated source.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created source.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: SAMLSource): Promise<SAMLSource> {
|
async send(data: SAMLSource): Promise<SAMLSource> {
|
||||||
let source: SAMLSource;
|
let source: SAMLSource;
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||||
|
|
||||||
|
import { msg } from "@lit/localize";
|
||||||
|
|
||||||
|
export abstract class BaseStageForm<T> extends ModelForm<T, string> {
|
||||||
|
getSuccessMessage(): string {
|
||||||
|
return this.instance
|
||||||
|
? msg("Successfully updated stage.")
|
||||||
|
: msg("Successfully created stage.");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
|
@ -21,21 +21,13 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-authenticator-duo-form")
|
@customElement("ak-stage-authenticator-duo-form")
|
||||||
export class AuthenticatorDuoStageForm extends ModelForm<AuthenticatorDuoStage, string> {
|
export class AuthenticatorDuoStageForm extends BaseStageForm<AuthenticatorDuoStage> {
|
||||||
loadInstance(pk: string): Promise<AuthenticatorDuoStage> {
|
loadInstance(pk: string): Promise<AuthenticatorDuoStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorDuoRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorDuoRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: AuthenticatorDuoStage): Promise<AuthenticatorDuoStage> {
|
async send(data: AuthenticatorDuoStage): Promise<AuthenticatorDuoStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorDuoPartialUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorDuoPartialUpdate({
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/Radio";
|
import "@goauthentik/elements/forms/Radio";
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-authenticator-sms-form")
|
@customElement("ak-stage-authenticator-sms-form")
|
||||||
export class AuthenticatorSMSStageForm extends ModelForm<AuthenticatorSMSStage, string> {
|
export class AuthenticatorSMSStageForm extends BaseStageForm<AuthenticatorSMSStage> {
|
||||||
loadInstance(pk: string): Promise<AuthenticatorSMSStage> {
|
loadInstance(pk: string): Promise<AuthenticatorSMSStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG)
|
return new StagesApi(DEFAULT_CONFIG)
|
||||||
.stagesAuthenticatorSmsRetrieve({
|
.stagesAuthenticatorSmsRetrieve({
|
||||||
|
@ -45,14 +45,6 @@ export class AuthenticatorSMSStageForm extends ModelForm<AuthenticatorSMSStage,
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
authType?: AuthTypeEnum;
|
authType?: AuthTypeEnum;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: AuthenticatorSMSStage): Promise<AuthenticatorSMSStage> {
|
async send(data: AuthenticatorSMSStage): Promise<AuthenticatorSMSStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorSmsUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorSmsUpdate({
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
|
@ -19,21 +19,13 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-authenticator-static-form")
|
@customElement("ak-stage-authenticator-static-form")
|
||||||
export class AuthenticatorStaticStageForm extends ModelForm<AuthenticatorStaticStage, string> {
|
export class AuthenticatorStaticStageForm extends BaseStageForm<AuthenticatorStaticStage> {
|
||||||
loadInstance(pk: string): Promise<AuthenticatorStaticStage> {
|
loadInstance(pk: string): Promise<AuthenticatorStaticStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorStaticRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorStaticRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: AuthenticatorStaticStage): Promise<AuthenticatorStaticStage> {
|
async send(data: AuthenticatorStaticStage): Promise<AuthenticatorStaticStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorStaticUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorStaticUpdate({
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
|
@ -21,21 +21,13 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-authenticator-totp-form")
|
@customElement("ak-stage-authenticator-totp-form")
|
||||||
export class AuthenticatorTOTPStageForm extends ModelForm<AuthenticatorTOTPStage, string> {
|
export class AuthenticatorTOTPStageForm extends BaseStageForm<AuthenticatorTOTPStage> {
|
||||||
loadInstance(pk: string): Promise<AuthenticatorTOTPStage> {
|
loadInstance(pk: string): Promise<AuthenticatorTOTPStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorTotpRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorTotpRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: AuthenticatorTOTPStage): Promise<AuthenticatorTOTPStage> {
|
async send(data: AuthenticatorTOTPStage): Promise<AuthenticatorTOTPStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorTotpUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorTotpUpdate({
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/Radio";
|
import "@goauthentik/elements/forms/Radio";
|
||||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-authenticator-validate-form")
|
@customElement("ak-stage-authenticator-validate-form")
|
||||||
export class AuthenticatorValidateStageForm extends ModelForm<AuthenticatorValidateStage, string> {
|
export class AuthenticatorValidateStageForm extends BaseStageForm<AuthenticatorValidateStage> {
|
||||||
async loadInstance(pk: string): Promise<AuthenticatorValidateStage> {
|
async loadInstance(pk: string): Promise<AuthenticatorValidateStage> {
|
||||||
const stage = await new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorValidateRetrieve({
|
const stage = await new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorValidateRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
|
@ -41,14 +41,6 @@ export class AuthenticatorValidateStageForm extends ModelForm<AuthenticatorValid
|
||||||
@property({ type: Boolean })
|
@property({ type: Boolean })
|
||||||
showConfigurationStages = true;
|
showConfigurationStages = true;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: AuthenticatorValidateStage): Promise<AuthenticatorValidateStage> {
|
async send(data: AuthenticatorValidateStage): Promise<AuthenticatorValidateStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorValidateUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorValidateUpdate({
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/Radio";
|
import "@goauthentik/elements/forms/Radio";
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
|
@ -23,21 +23,13 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-authenticator-webauthn-form")
|
@customElement("ak-stage-authenticator-webauthn-form")
|
||||||
export class AuthenticateWebAuthnStageForm extends ModelForm<AuthenticateWebAuthnStage, string> {
|
export class AuthenticateWebAuthnStageForm extends BaseStageForm<AuthenticateWebAuthnStage> {
|
||||||
loadInstance(pk: string): Promise<AuthenticateWebAuthnStage> {
|
loadInstance(pk: string): Promise<AuthenticateWebAuthnStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorWebauthnRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorWebauthnRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: AuthenticateWebAuthnStage): Promise<AuthenticateWebAuthnStage> {
|
async send(data: AuthenticateWebAuthnStage): Promise<AuthenticateWebAuthnStage> {
|
||||||
if (data.authenticatorAttachment?.toString() === "") {
|
if (data.authenticatorAttachment?.toString() === "") {
|
||||||
data.authenticatorAttachment = null;
|
data.authenticatorAttachment = null;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -11,21 +11,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { CaptchaStage, CaptchaStageRequest, StagesApi } from "@goauthentik/api";
|
import { CaptchaStage, CaptchaStageRequest, StagesApi } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-captcha-form")
|
@customElement("ak-stage-captcha-form")
|
||||||
export class CaptchaStageForm extends ModelForm<CaptchaStage, string> {
|
export class CaptchaStageForm extends BaseStageForm<CaptchaStage> {
|
||||||
loadInstance(pk: string): Promise<CaptchaStage> {
|
loadInstance(pk: string): Promise<CaptchaStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesCaptchaRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesCaptchaRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: CaptchaStage): Promise<CaptchaStage> {
|
async send(data: CaptchaStage): Promise<CaptchaStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesCaptchaPartialUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesCaptchaPartialUpdate({
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
|
@ -12,7 +12,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { ConsentStage, ConsentStageModeEnum, StagesApi } from "@goauthentik/api";
|
import { ConsentStage, ConsentStageModeEnum, StagesApi } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-consent-form")
|
@customElement("ak-stage-consent-form")
|
||||||
export class ConsentStageForm extends ModelForm<ConsentStage, string> {
|
export class ConsentStageForm extends BaseStageForm<ConsentStage> {
|
||||||
loadInstance(pk: string): Promise<ConsentStage> {
|
loadInstance(pk: string): Promise<ConsentStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG)
|
return new StagesApi(DEFAULT_CONFIG)
|
||||||
.stagesConsentRetrieve({
|
.stagesConsentRetrieve({
|
||||||
|
@ -27,14 +27,6 @@ export class ConsentStageForm extends ModelForm<ConsentStage, string> {
|
||||||
@property({ type: Boolean })
|
@property({ type: Boolean })
|
||||||
showExpiresIn = false;
|
showExpiresIn = false;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: ConsentStage): Promise<ConsentStage> {
|
async send(data: ConsentStage): Promise<ConsentStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesConsentUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesConsentUpdate({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -10,21 +10,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { DenyStage, StagesApi } from "@goauthentik/api";
|
import { DenyStage, StagesApi } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-deny-form")
|
@customElement("ak-stage-deny-form")
|
||||||
export class DenyStageForm extends ModelForm<DenyStage, string> {
|
export class DenyStageForm extends BaseStageForm<DenyStage> {
|
||||||
loadInstance(pk: string): Promise<DenyStage> {
|
loadInstance(pk: string): Promise<DenyStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesDenyRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesDenyRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: DenyStage): Promise<DenyStage> {
|
async send(data: DenyStage): Promise<DenyStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesDenyUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesDenyUpdate({
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -11,21 +11,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { DummyStage, StagesApi } from "@goauthentik/api";
|
import { DummyStage, StagesApi } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-dummy-form")
|
@customElement("ak-stage-dummy-form")
|
||||||
export class DummyStageForm extends ModelForm<DummyStage, string> {
|
export class DummyStageForm extends BaseStageForm<DummyStage> {
|
||||||
loadInstance(pk: string): Promise<DummyStage> {
|
loadInstance(pk: string): Promise<DummyStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesDummyRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesDummyRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: DummyStage): Promise<DummyStage> {
|
async send(data: DummyStage): Promise<DummyStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesDummyUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesDummyUpdate({
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -12,7 +12,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { EmailStage, StagesApi, TypeCreate } from "@goauthentik/api";
|
import { EmailStage, StagesApi, TypeCreate } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-email-form")
|
@customElement("ak-stage-email-form")
|
||||||
export class EmailStageForm extends ModelForm<EmailStage, string> {
|
export class EmailStageForm extends BaseStageForm<EmailStage> {
|
||||||
async loadInstance(pk: string): Promise<EmailStage> {
|
async loadInstance(pk: string): Promise<EmailStage> {
|
||||||
const stage = await new StagesApi(DEFAULT_CONFIG).stagesEmailRetrieve({
|
const stage = await new StagesApi(DEFAULT_CONFIG).stagesEmailRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
|
@ -30,14 +30,6 @@ export class EmailStageForm extends ModelForm<EmailStage, string> {
|
||||||
@property({ type: Boolean })
|
@property({ type: Boolean })
|
||||||
showConnectionSettings = false;
|
showConnectionSettings = false;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: EmailStage): Promise<EmailStage> {
|
async send(data: EmailStage): Promise<EmailStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesEmailPartialUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesEmailPartialUpdate({
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search";
|
import "@goauthentik/admin/common/ak-flow-search/ak-flow-search";
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first, groupBy } from "@goauthentik/common/utils";
|
import { first, groupBy } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
|
@ -23,7 +23,7 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-identification-form")
|
@customElement("ak-stage-identification-form")
|
||||||
export class IdentificationStageForm extends ModelForm<IdentificationStage, string> {
|
export class IdentificationStageForm extends BaseStageForm<IdentificationStage> {
|
||||||
loadInstance(pk: string): Promise<IdentificationStage> {
|
loadInstance(pk: string): Promise<IdentificationStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesIdentificationRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesIdentificationRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
|
@ -38,14 +38,6 @@ export class IdentificationStageForm extends ModelForm<IdentificationStage, stri
|
||||||
|
|
||||||
sources?: PaginatedSourceList;
|
sources?: PaginatedSourceList;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: IdentificationStage): Promise<IdentificationStage> {
|
async send(data: IdentificationStage): Promise<IdentificationStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesIdentificationUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesIdentificationUpdate({
|
||||||
|
|
|
@ -23,11 +23,9 @@ export class InvitationForm extends ModelForm<Invitation, string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated invitation.");
|
? msg("Successfully updated invitation.")
|
||||||
} else {
|
: msg("Successfully created invitation.");
|
||||||
return msg("Successfully created invitation.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: Invitation): Promise<Invitation> {
|
async send(data: Invitation): Promise<Invitation> {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -11,21 +11,13 @@ import { customElement } from "lit/decorators.js";
|
||||||
import { InvitationStage, StagesApi } from "@goauthentik/api";
|
import { InvitationStage, StagesApi } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-invitation-form")
|
@customElement("ak-stage-invitation-form")
|
||||||
export class InvitationStageForm extends ModelForm<InvitationStage, string> {
|
export class InvitationStageForm extends BaseStageForm<InvitationStage> {
|
||||||
loadInstance(pk: string): Promise<InvitationStage> {
|
loadInstance(pk: string): Promise<InvitationStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesInvitationStagesRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesInvitationStagesRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: InvitationStage): Promise<InvitationStage> {
|
async send(data: InvitationStage): Promise<InvitationStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesInvitationStagesUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesInvitationStagesUpdate({
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
import { RenderFlowOption } from "@goauthentik/admin/flows/utils";
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
|
@ -22,21 +22,13 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-password-form")
|
@customElement("ak-stage-password-form")
|
||||||
export class PasswordStageForm extends ModelForm<PasswordStage, string> {
|
export class PasswordStageForm extends BaseStageForm<PasswordStage> {
|
||||||
loadInstance(pk: string): Promise<PasswordStage> {
|
loadInstance(pk: string): Promise<PasswordStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesPasswordRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesPasswordRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: PasswordStage): Promise<PasswordStage> {
|
async send(data: PasswordStage): Promise<PasswordStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesPasswordUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesPasswordUpdate({
|
||||||
|
|
|
@ -90,11 +90,9 @@ export class PromptForm extends ModelForm<Prompt, string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated prompt.");
|
? msg("Successfully updated prompt.")
|
||||||
} else {
|
: msg("Successfully created prompt.");
|
||||||
return msg("Successfully created prompt.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResult[] {
|
static get styles(): CSSResult[] {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import "@goauthentik/admin/stages/prompt/PromptForm";
|
import "@goauthentik/admin/stages/prompt/PromptForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import "@goauthentik/elements/forms/ModalForm";
|
import "@goauthentik/elements/forms/ModalForm";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg, str } from "@lit/localize";
|
import { msg, str } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -19,7 +19,7 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-prompt-form")
|
@customElement("ak-stage-prompt-form")
|
||||||
export class PromptStageForm extends ModelForm<PromptStage, string> {
|
export class PromptStageForm extends BaseStageForm<PromptStage> {
|
||||||
loadInstance(pk: string): Promise<PromptStage> {
|
loadInstance(pk: string): Promise<PromptStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesPromptStagesRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesPromptStagesRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
|
@ -38,14 +38,6 @@ export class PromptStageForm extends ModelForm<PromptStage, string> {
|
||||||
prompts?: PaginatedPromptList;
|
prompts?: PaginatedPromptList;
|
||||||
policies?: PaginatedPolicyList;
|
policies?: PaginatedPolicyList;
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: PromptStage): Promise<PromptStage> {
|
async send(data: PromptStage): Promise<PromptStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesPromptStagesUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesPromptStagesUpdate({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -10,21 +10,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { StagesApi, UserDeleteStage } from "@goauthentik/api";
|
import { StagesApi, UserDeleteStage } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-user-delete-form")
|
@customElement("ak-stage-user-delete-form")
|
||||||
export class UserDeleteStageForm extends ModelForm<UserDeleteStage, string> {
|
export class UserDeleteStageForm extends BaseStageForm<UserDeleteStage> {
|
||||||
loadInstance(pk: string): Promise<UserDeleteStage> {
|
loadInstance(pk: string): Promise<UserDeleteStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesUserDeleteRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesUserDeleteRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: UserDeleteStage): Promise<UserDeleteStage> {
|
async send(data: UserDeleteStage): Promise<UserDeleteStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesUserDeleteUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesUserDeleteUpdate({
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/Alert";
|
import "@goauthentik/elements/Alert";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
import "@goauthentik/elements/utils/TimeDeltaHelp";
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
|
@ -13,21 +13,13 @@ import { customElement } from "lit/decorators.js";
|
||||||
import { StagesApi, UserLoginStage } from "@goauthentik/api";
|
import { StagesApi, UserLoginStage } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-user-login-form")
|
@customElement("ak-stage-user-login-form")
|
||||||
export class UserLoginStageForm extends ModelForm<UserLoginStage, string> {
|
export class UserLoginStageForm extends BaseStageForm<UserLoginStage> {
|
||||||
loadInstance(pk: string): Promise<UserLoginStage> {
|
loadInstance(pk: string): Promise<UserLoginStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesUserLoginRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesUserLoginRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: UserLoginStage): Promise<UserLoginStage> {
|
async send(data: UserLoginStage): Promise<UserLoginStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesUserLoginUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesUserLoginUpdate({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
|
|
||||||
import { msg } from "@lit/localize";
|
import { msg } from "@lit/localize";
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
|
@ -10,21 +10,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { StagesApi, UserLogoutStage } from "@goauthentik/api";
|
import { StagesApi, UserLogoutStage } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-user-logout-form")
|
@customElement("ak-stage-user-logout-form")
|
||||||
export class UserLogoutStageForm extends ModelForm<UserLogoutStage, string> {
|
export class UserLogoutStageForm extends BaseStageForm<UserLogoutStage> {
|
||||||
loadInstance(pk: string): Promise<UserLogoutStage> {
|
loadInstance(pk: string): Promise<UserLogoutStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesUserLogoutRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesUserLogoutRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: UserLogoutStage): Promise<UserLogoutStage> {
|
async send(data: UserLogoutStage): Promise<UserLogoutStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesUserLogoutUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesUserLogoutUpdate({
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { BaseStageForm } from "@goauthentik/admin/stages/BaseStageForm";
|
||||||
import { UserCreationModeEnum } from "@goauthentik/api/dist/models/UserCreationModeEnum";
|
import { UserCreationModeEnum } from "@goauthentik/api/dist/models/UserCreationModeEnum";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
||||||
import "@goauthentik/elements/forms/Radio";
|
import "@goauthentik/elements/forms/Radio";
|
||||||
import "@goauthentik/elements/forms/SearchSelect";
|
import "@goauthentik/elements/forms/SearchSelect";
|
||||||
|
|
||||||
|
@ -22,21 +22,13 @@ import {
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-stage-user-write-form")
|
@customElement("ak-stage-user-write-form")
|
||||||
export class UserWriteStageForm extends ModelForm<UserWriteStage, string> {
|
export class UserWriteStageForm extends BaseStageForm<UserWriteStage> {
|
||||||
loadInstance(pk: string): Promise<UserWriteStage> {
|
loadInstance(pk: string): Promise<UserWriteStage> {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesUserWriteRetrieve({
|
return new StagesApi(DEFAULT_CONFIG).stagesUserWriteRetrieve({
|
||||||
stageUuid: pk,
|
stageUuid: pk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
|
||||||
if (this.instance) {
|
|
||||||
return msg("Successfully updated stage.");
|
|
||||||
} else {
|
|
||||||
return msg("Successfully created stage.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async send(data: UserWriteStage): Promise<UserWriteStage> {
|
async send(data: UserWriteStage): Promise<UserWriteStage> {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
return new StagesApi(DEFAULT_CONFIG).stagesUserWriteUpdate({
|
return new StagesApi(DEFAULT_CONFIG).stagesUserWriteUpdate({
|
||||||
|
|
|
@ -26,11 +26,9 @@ export class TenantForm extends ModelForm<Tenant, string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated tenant.");
|
? msg("Successfully updated tenant.")
|
||||||
} else {
|
: msg("Successfully created tenant.");
|
||||||
return msg("Successfully created tenant.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: Tenant): Promise<Tenant> {
|
async send(data: Tenant): Promise<Tenant> {
|
||||||
|
|
|
@ -26,11 +26,9 @@ export class TokenForm extends ModelForm<Token, string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated token.");
|
? msg("Successfully updated token.")
|
||||||
} else {
|
: msg("Successfully created token.");
|
||||||
return msg("Successfully created token.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: Token): Promise<Token> {
|
async send(data: Token): Promise<Token> {
|
||||||
|
|
|
@ -21,11 +21,9 @@ export class UserTokenForm extends ModelForm<Token, string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuccessMessage(): string {
|
getSuccessMessage(): string {
|
||||||
if (this.instance) {
|
return this.instance
|
||||||
return msg("Successfully updated token.");
|
? msg("Successfully updated token.")
|
||||||
} else {
|
: msg("Successfully created token.");
|
||||||
return msg("Successfully created token.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(data: Token): Promise<Token> {
|
async send(data: Token): Promise<Token> {
|
||||||
|
|
Reference in New Issue