From 34b8a97ae9d3145faa030869b3b6a5d6948ab7ef Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 9 Apr 2021 16:21:17 +0200 Subject: [PATCH] web/admin: add custom rendering for inbuilt sources Signed-off-by: Jens Langhammer --- .../core/migrations/0019_source_managed.py | 14 +++++--- .../migrations/0012_auto_20210323_1339.py | 2 +- swagger.yaml | 12 ++++++- web/src/elements/table/Table.ts | 5 --- web/src/locales/en.po | 35 +++++++++---------- web/src/locales/pseudo-LOCALE.po | 35 +++++++++---------- web/src/pages/sources/SourcesListPage.ts | 32 ++++++++--------- 7 files changed, 69 insertions(+), 66 deletions(-) diff --git a/authentik/core/migrations/0019_source_managed.py b/authentik/core/migrations/0019_source_managed.py index cef8e2748..756164186 100644 --- a/authentik/core/migrations/0019_source_managed.py +++ b/authentik/core/migrations/0019_source_managed.py @@ -6,13 +6,19 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('authentik_core', '0018_auto_20210330_1345'), + ("authentik_core", "0018_auto_20210330_1345"), ] operations = [ migrations.AddField( - model_name='source', - name='managed', - field=models.TextField(default=None, help_text='Objects which are managed by authentik. These objects are created and updated automatically. This is flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.', null=True, unique=True, verbose_name='Managed by authentik'), + model_name="source", + name="managed", + field=models.TextField( + default=None, + help_text="Objects which are managed by authentik. These objects are created and updated automatically. This is flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.", + null=True, + unique=True, + verbose_name="Managed by authentik", + ), ), ] diff --git a/authentik/policies/event_matcher/migrations/0012_auto_20210323_1339.py b/authentik/policies/event_matcher/migrations/0012_auto_20210323_1339.py index a29cc4e18..d5a109d5b 100644 --- a/authentik/policies/event_matcher/migrations/0012_auto_20210323_1339.py +++ b/authentik/policies/event_matcher/migrations/0012_auto_20210323_1339.py @@ -73,8 +73,8 @@ class Migration(migrations.Migration): ("authentik.stages.user_login", "authentik Stages.User Login"), ("authentik.stages.user_logout", "authentik Stages.User Logout"), ("authentik.stages.user_write", "authentik Stages.User Write"), - ("authentik.managed", "authentik Managed"), ("authentik.core", "authentik Core"), + ("authentik.managed", "authentik Managed"), ], default="", help_text="Match events created by selected application. When left empty, all applications are matched.", diff --git a/swagger.yaml b/swagger.yaml index 4cfef041f..cca4335e1 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -16039,8 +16039,8 @@ definitions: - authentik.stages.user_login - authentik.stages.user_logout - authentik.stages.user_write - - authentik.managed - authentik.core + - authentik.managed ExpressionPolicy: required: - expression @@ -17950,6 +17950,16 @@ definitions: enum: - all - any + managed: + title: Managed by authentik + description: Objects which are managed by authentik. These objects + are created and updated automatically. This is flag only indicates + that an object can be overwritten by migrations. You can still + modify the objects via the API, but expect changes to be overwritten + in a later update. + type: string + minLength: 1 + x-nullable: true name: title: Name description: Source's display Name. diff --git a/web/src/elements/table/Table.ts b/web/src/elements/table/Table.ts index 516e3c6cb..06d32bf99 100644 --- a/web/src/elements/table/Table.ts +++ b/web/src/elements/table/Table.ts @@ -230,10 +230,6 @@ export abstract class Table extends LitElement { return html``; } - renderRowsAbove(): TemplateResult { - return html``; - } - firstUpdated(): void { this.fetch(); } @@ -269,7 +265,6 @@ export abstract class Table extends LitElement { ${this.columns().map((col) => col.render(this))} - ${this.renderRowsAbove()} ${(this.isLoading || !this.data) ? this.renderLoading() : this.renderRows()}
diff --git a/web/src/locales/en.po b/web/src/locales/en.po index fbc5a2c01..abd3542f6 100644 --- a/web/src/locales/en.po +++ b/web/src/locales/en.po @@ -370,7 +370,8 @@ msgstr "Binding Type" msgid "Build hash: {0}" msgstr "Build hash: {0}" -#: src/pages/sources/SourcesListPage.ts:62 +#: src/pages/sources/SourcesListPage.ts:103 +#: src/pages/sources/SourcesListPage.ts:105 msgid "Built-in" msgstr "Built-in" @@ -688,8 +689,8 @@ msgstr "Copy Key" #: src/pages/providers/ProviderListPage.ts:116 #: src/pages/providers/RelatedApplicationButton.ts:27 #: src/pages/providers/RelatedApplicationButton.ts:35 -#: src/pages/sources/SourcesListPage.ts:115 -#: src/pages/sources/SourcesListPage.ts:124 +#: src/pages/sources/SourcesListPage.ts:113 +#: src/pages/sources/SourcesListPage.ts:122 #: src/pages/stages/StageListPage.ts:119 #: src/pages/stages/StageListPage.ts:128 #: src/pages/stages/invitation/InvitationListPage.ts:77 @@ -786,7 +787,7 @@ msgstr "Create provider" #: src/pages/policies/PolicyListPage.ts:136 #: src/pages/property-mappings/PropertyMappingListPage.ts:125 #: src/pages/providers/ProviderListPage.ts:119 -#: src/pages/sources/SourcesListPage.ts:127 +#: src/pages/sources/SourcesListPage.ts:125 #: src/pages/stages/StageListPage.ts:131 msgid "Create {0}" msgstr "Create {0}" @@ -841,7 +842,7 @@ msgstr "Define how notifications are sent to users, like Email or Webhook." #: src/pages/policies/PolicyListPage.ts:115 #: src/pages/property-mappings/PropertyMappingListPage.ts:104 #: src/pages/providers/ProviderListPage.ts:98 -#: src/pages/sources/SourcesListPage.ts:106 +#: src/pages/sources/SourcesListPage.ts:94 #: src/pages/stages/StageListPage.ts:110 #: src/pages/stages/invitation/InvitationListPage.ts:68 #: src/pages/stages/prompt/PromptListPage.ts:87 @@ -943,7 +944,7 @@ msgstr "Disable Static Tokens" msgid "Disable Time-based OTP" msgstr "Disable Time-based OTP" -#: src/pages/sources/SourcesListPage.ts:75 +#: src/pages/sources/SourcesListPage.ts:63 msgid "Disabled" msgstr "Disabled" @@ -980,7 +981,7 @@ msgstr "Each provider has a different issuer, based on the application slug." #: src/pages/providers/oauth2/OAuth2ProviderViewPage.ts:139 #: src/pages/providers/proxy/ProxyProviderViewPage.ts:138 #: src/pages/providers/saml/SAMLProviderViewPage.ts:132 -#: src/pages/sources/SourcesListPage.ts:94 +#: src/pages/sources/SourcesListPage.ts:82 #: src/pages/sources/ldap/LDAPSourceViewPage.ts:116 #: src/pages/sources/oauth/OAuthSourceViewPage.ts:135 #: src/pages/sources/saml/SAMLSourceViewPage.ts:122 @@ -1208,10 +1209,6 @@ msgstr "External Applications which use authentik as Identity-Provider, utilizin msgid "External Host" msgstr "External Host" -#: src/pages/sources/SourcesListPage.ts:33 -msgid "External Sources which can be used to get Identities into authentik, for example Social Providers like Twiter and GitHub or Enterprise Providers like ADFS and LDAP." -msgstr "External Sources which can be used to get Identities into authentik, for example Social Providers like Twiter and GitHub or Enterprise Providers like ADFS and LDAP." - #: src/pages/providers/proxy/ProxyProviderForm.ts:118 msgid "External host" msgstr "External host" @@ -2601,7 +2598,7 @@ msgstr "See documentation for a list of all variables." msgid "Select a provider that this application should use. Alternatively, create a new provider." msgstr "Select a provider that this application should use. Alternatively, create a new provider." -#: src/elements/table/Table.ts:218 +#: src/elements/table/Table.ts:215 msgid "Select all rows" msgstr "Select all rows" @@ -2746,7 +2743,7 @@ msgid "Something went wrong! Please try again later." msgstr "Something went wrong! Please try again later." #: src/pages/providers/ProviderListPage.ts:91 -#: src/pages/sources/SourcesListPage.ts:99 +#: src/pages/sources/SourcesListPage.ts:87 msgid "Source" msgstr "Source" @@ -2759,6 +2756,10 @@ msgstr "Source {0}" msgid "Sources" msgstr "Sources" +#: src/pages/sources/SourcesListPage.ts:33 +msgid "Sources of identities, which can either be synced into authentik's database, like LDAP, or can be used by users to authenticate and enroll themselves, like OAuth and social logins" +msgstr "Sources of identities, which can either be synced into authentik's database, like LDAP, or can be used by users to authenticate and enroll themselves, like OAuth and social logins" + #: src/pages/flows/StageBindingForm.ts:98 msgid "Stage" msgstr "Stage" @@ -3379,7 +3380,7 @@ msgstr "Up-to-date!" #: src/pages/providers/oauth2/OAuth2ProviderViewPage.ts:129 #: src/pages/providers/proxy/ProxyProviderViewPage.ts:128 #: src/pages/providers/saml/SAMLProviderViewPage.ts:122 -#: src/pages/sources/SourcesListPage.ts:81 +#: src/pages/sources/SourcesListPage.ts:69 #: src/pages/sources/ldap/LDAPSourceViewPage.ts:106 #: src/pages/sources/oauth/OAuthSourceViewPage.ts:125 #: src/pages/sources/saml/SAMLSourceViewPage.ts:112 @@ -3482,7 +3483,7 @@ msgstr "Update details" #: src/pages/policies/PolicyListPage.ts:80 #: src/pages/property-mappings/PropertyMappingListPage.ts:69 #: src/pages/providers/ProviderListPage.ts:76 -#: src/pages/sources/SourcesListPage.ts:84 +#: src/pages/sources/SourcesListPage.ts:72 #: src/pages/stages/StageListPage.ts:88 #: src/pages/users/UserActiveForm.ts:41 msgid "Update {0}" @@ -3746,10 +3747,6 @@ msgstr "Yes" msgid "You're currently impersonating {0}." msgstr "You're currently impersonating {0}." -#: src/pages/sources/SourcesListPage.ts:61 -msgid "authentik Built-in" -msgstr "authentik Built-in" - #: src/pages/stages/password/PasswordStageForm.ts:76 msgid "authentik Builtin Database" msgstr "authentik Builtin Database" diff --git a/web/src/locales/pseudo-LOCALE.po b/web/src/locales/pseudo-LOCALE.po index 6977033c4..68546685c 100644 --- a/web/src/locales/pseudo-LOCALE.po +++ b/web/src/locales/pseudo-LOCALE.po @@ -366,7 +366,8 @@ msgstr "" msgid "Build hash: {0}" msgstr "" -#: src/pages/sources/SourcesListPage.ts:62 +#: src/pages/sources/SourcesListPage.ts:103 +#: src/pages/sources/SourcesListPage.ts:105 msgid "Built-in" msgstr "" @@ -684,8 +685,8 @@ msgstr "" #: src/pages/providers/ProviderListPage.ts:116 #: src/pages/providers/RelatedApplicationButton.ts:27 #: src/pages/providers/RelatedApplicationButton.ts:35 -#: src/pages/sources/SourcesListPage.ts:115 -#: src/pages/sources/SourcesListPage.ts:124 +#: src/pages/sources/SourcesListPage.ts:113 +#: src/pages/sources/SourcesListPage.ts:122 #: src/pages/stages/StageListPage.ts:119 #: src/pages/stages/StageListPage.ts:128 #: src/pages/stages/invitation/InvitationListPage.ts:77 @@ -782,7 +783,7 @@ msgstr "" #: src/pages/policies/PolicyListPage.ts:136 #: src/pages/property-mappings/PropertyMappingListPage.ts:125 #: src/pages/providers/ProviderListPage.ts:119 -#: src/pages/sources/SourcesListPage.ts:127 +#: src/pages/sources/SourcesListPage.ts:125 #: src/pages/stages/StageListPage.ts:131 msgid "Create {0}" msgstr "" @@ -837,7 +838,7 @@ msgstr "" #: src/pages/policies/PolicyListPage.ts:115 #: src/pages/property-mappings/PropertyMappingListPage.ts:104 #: src/pages/providers/ProviderListPage.ts:98 -#: src/pages/sources/SourcesListPage.ts:106 +#: src/pages/sources/SourcesListPage.ts:94 #: src/pages/stages/StageListPage.ts:110 #: src/pages/stages/invitation/InvitationListPage.ts:68 #: src/pages/stages/prompt/PromptListPage.ts:87 @@ -939,7 +940,7 @@ msgstr "" msgid "Disable Time-based OTP" msgstr "" -#: src/pages/sources/SourcesListPage.ts:75 +#: src/pages/sources/SourcesListPage.ts:63 msgid "Disabled" msgstr "" @@ -976,7 +977,7 @@ msgstr "" #: src/pages/providers/oauth2/OAuth2ProviderViewPage.ts:139 #: src/pages/providers/proxy/ProxyProviderViewPage.ts:138 #: src/pages/providers/saml/SAMLProviderViewPage.ts:132 -#: src/pages/sources/SourcesListPage.ts:94 +#: src/pages/sources/SourcesListPage.ts:82 #: src/pages/sources/ldap/LDAPSourceViewPage.ts:116 #: src/pages/sources/oauth/OAuthSourceViewPage.ts:135 #: src/pages/sources/saml/SAMLSourceViewPage.ts:122 @@ -1204,10 +1205,6 @@ msgstr "" msgid "External Host" msgstr "" -#: src/pages/sources/SourcesListPage.ts:33 -msgid "External Sources which can be used to get Identities into authentik, for example Social Providers like Twiter and GitHub or Enterprise Providers like ADFS and LDAP." -msgstr "" - #: src/pages/providers/proxy/ProxyProviderForm.ts:118 msgid "External host" msgstr "" @@ -2597,7 +2594,7 @@ msgstr "" msgid "Select a provider that this application should use. Alternatively, create a new provider." msgstr "" -#: src/elements/table/Table.ts:218 +#: src/elements/table/Table.ts:215 msgid "Select all rows" msgstr "" @@ -2742,7 +2739,7 @@ msgid "Something went wrong! Please try again later." msgstr "" #: src/pages/providers/ProviderListPage.ts:91 -#: src/pages/sources/SourcesListPage.ts:99 +#: src/pages/sources/SourcesListPage.ts:87 msgid "Source" msgstr "" @@ -2755,6 +2752,10 @@ msgstr "" msgid "Sources" msgstr "" +#: src/pages/sources/SourcesListPage.ts:33 +msgid "Sources of identities, which can either be synced into authentik's database, like LDAP, or can be used by users to authenticate and enroll themselves, like OAuth and social logins" +msgstr "" + #: src/pages/flows/StageBindingForm.ts:98 msgid "Stage" msgstr "" @@ -3373,7 +3374,7 @@ msgstr "" #: src/pages/providers/oauth2/OAuth2ProviderViewPage.ts:129 #: src/pages/providers/proxy/ProxyProviderViewPage.ts:128 #: src/pages/providers/saml/SAMLProviderViewPage.ts:122 -#: src/pages/sources/SourcesListPage.ts:81 +#: src/pages/sources/SourcesListPage.ts:69 #: src/pages/sources/ldap/LDAPSourceViewPage.ts:106 #: src/pages/sources/oauth/OAuthSourceViewPage.ts:125 #: src/pages/sources/saml/SAMLSourceViewPage.ts:112 @@ -3476,7 +3477,7 @@ msgstr "" #: src/pages/policies/PolicyListPage.ts:80 #: src/pages/property-mappings/PropertyMappingListPage.ts:69 #: src/pages/providers/ProviderListPage.ts:76 -#: src/pages/sources/SourcesListPage.ts:84 +#: src/pages/sources/SourcesListPage.ts:72 #: src/pages/stages/StageListPage.ts:88 #: src/pages/users/UserActiveForm.ts:41 msgid "Update {0}" @@ -3740,10 +3741,6 @@ msgstr "" msgid "You're currently impersonating {0}." msgstr "" -#: src/pages/sources/SourcesListPage.ts:61 -msgid "authentik Built-in" -msgstr "" - #: src/pages/stages/password/PasswordStageForm.ts:76 msgid "authentik Builtin Database" msgstr "" diff --git a/web/src/pages/sources/SourcesListPage.ts b/web/src/pages/sources/SourcesListPage.ts index d41c00da6..1302d256f 100644 --- a/web/src/pages/sources/SourcesListPage.ts +++ b/web/src/pages/sources/SourcesListPage.ts @@ -24,7 +24,7 @@ export class SourceListPage extends TablePage { return t`Sources`; } pageDescription(): string | undefined { - return t`External Sources which can be used to get Identities into authentik, for example Social Providers like Twiter and GitHub or Enterprise Providers like ADFS and LDAP.`; + return t`Sources of identities, which can either be synced into authentik's database, like LDAP, or can be used by users to authenticate and enroll themselves, like OAuth and social logins`; } pageIcon(): string { return "pf-icon pf-icon-middleware"; @@ -53,23 +53,10 @@ export class SourceListPage extends TablePage { ]; } - renderRowsAbove(): TemplateResult { - return html` - - - -
${t`authentik Built-in`}
- ${t`Built-in`} -
- - - - - - - `; - } - row(item: Source): TemplateResult[] { + if (item.component === "") { + return this.rowInbuilt(item); + } return [ html`
${item.name}
@@ -110,6 +97,17 @@ export class SourceListPage extends TablePage { ]; } + rowInbuilt(item: Source): TemplateResult[] { + return [ + html` +
${item.name}
+ ${t`Built-in`} +
`, + html`${t`Built-in`}`, + html``, + ]; + } + renderToolbar(): TemplateResult { return html`