web/admin: improve default selection for property-mappings
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
f328b21e89
commit
caa5dc1d14
|
@ -117,7 +117,7 @@ export class OAuth2ProviderFormPage extends Form<OAuth2Provider> {
|
|||
name="redirectUris">
|
||||
<textarea class="pf-c-form-control">${this.provider?.redirectUris}</textarea>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Valid redirect URLs after a successful authorization flow. Also specify any origins here for CORS Headers.`}
|
||||
${t`Valid redirect URLs after a successful authorization flow. Also specify any origins here for Implicit flows.`}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
</div>
|
||||
|
@ -157,9 +157,14 @@ export class OAuth2ProviderFormPage extends Form<OAuth2Provider> {
|
|||
ordering: "scope_name"
|
||||
}).then(scopes => {
|
||||
return scopes.results.map(scope => {
|
||||
const selected = Array.from(this.provider?.propertyMappings || []).some(su => {
|
||||
let selected = false;
|
||||
if (!this.provider?.propertyMappings) {
|
||||
selected = scope.managed?.startsWith("goauthentik.io/providers/oauth2/scope-") || false;
|
||||
} else {
|
||||
selected = Array.from(this.provider?.propertyMappings).some(su => {
|
||||
return su == scope.pk;
|
||||
});
|
||||
}
|
||||
return html`<option value=${ifDefined(scope.pk)} ?selected=${selected}>${scope.name}</option>`;
|
||||
});
|
||||
}), html`<option>${t`Loading...`}</option>`)}
|
||||
|
|
|
@ -154,9 +154,14 @@ export class SAMLProviderFormPage extends Form<SAMLProvider> {
|
|||
ordering: "saml_name"
|
||||
}).then(mappings => {
|
||||
return mappings.results.map(mapping => {
|
||||
const selected = Array.from(this.provider?.propertyMappings || []).some(su => {
|
||||
let selected = false;
|
||||
if (!this.provider?.propertyMappings) {
|
||||
selected = mapping.managed?.startsWith("goauthentik.io/providers/saml") || false;
|
||||
} else {
|
||||
selected = Array.from(this.provider?.propertyMappings).some(su => {
|
||||
return su == mapping.pk;
|
||||
});
|
||||
}
|
||||
return html`<option value=${ifDefined(mapping.pk)} ?selected=${selected}>${mapping.name}</option>`;
|
||||
});
|
||||
}), html`<option>${t`Loading...`}</option>`)}
|
||||
|
|
Reference in New Issue