core: add superuser_full_list to applications list, shows all applications when superuser

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-19 16:07:30 +02:00
parent fdc7f14056
commit 8a6879afa5
5 changed files with 52 additions and 32 deletions

View File

@ -91,6 +91,15 @@ class ApplicationViewSet(ModelViewSet):
applications.append(application)
return applications
@swagger_auto_schema(
manual_parameters=[
openapi.Parameter(
name="superuser_full_list",
in_=openapi.IN_QUERY,
type=openapi.TYPE_BOOLEAN,
)
]
)
def list(self, request: Request) -> Response:
"""Custom list method that checks Policy based access instead of guardian"""
queryset = self._filter_queryset_for_list(self.get_queryset())
@ -98,6 +107,13 @@ class ApplicationViewSet(ModelViewSet):
should_cache = request.GET.get("search", "") == ""
superuser_full_list = (
request.GET.get("superuser_full_list", "false").lower() == "true"
)
if superuser_full_list and request.user.is_superuser:
serializer = self.get_serializer(queryset, many=True)
return self.get_paginated_response(serializer.data)
allowed_applications = []
if not should_cache:
allowed_applications = self._get_allowed_applications(queryset)

View File

@ -1152,6 +1152,9 @@ paths:
description: Page Size
required: false
type: integer
- name: superuser_full_list
in: query
type: boolean
responses:
'200':
description: ''

View File

@ -168,12 +168,12 @@ msgstr "App"
#: src/elements/user/UserConsentList.ts:29
#: src/pages/admin-overview/TopApplicationsTable.ts:42
#: src/pages/applications/ApplicationListPage.ts:104
#: src/pages/applications/ApplicationListPage.ts:105
#: src/pages/providers/ProviderListPage.ts:53
msgid "Application"
msgstr "Application"
#: src/pages/applications/ApplicationListPage.ts:68
#: src/pages/applications/ApplicationListPage.ts:69
msgid "Application Icon"
msgstr "Application Icon"
@ -695,8 +695,8 @@ msgid "Copy Key"
msgstr "Copy Key"
#: src/pages/applications/ApplicationForm.ts:120
#: src/pages/applications/ApplicationListPage.ts:120
#: src/pages/applications/ApplicationListPage.ts:128
#: src/pages/applications/ApplicationListPage.ts:121
#: src/pages/applications/ApplicationListPage.ts:129
#: src/pages/crypto/CertificateKeyPairListPage.ts:122
#: src/pages/crypto/CertificateKeyPairListPage.ts:130
#: src/pages/events/RuleListPage.ts:91
@ -742,7 +742,7 @@ msgstr "Copy Key"
msgid "Create"
msgstr "Create"
#: src/pages/applications/ApplicationListPage.ts:123
#: src/pages/applications/ApplicationListPage.ts:124
#: src/pages/providers/RelatedApplicationButton.ts:30
msgid "Create Application"
msgstr "Create Application"
@ -868,7 +868,7 @@ msgid "Define how notifications are sent to users, like Email or Webhook."
msgstr "Define how notifications are sent to users, like Email or Webhook."
#: src/elements/forms/DeleteForm.ts:79
#: src/pages/applications/ApplicationListPage.ts:111
#: src/pages/applications/ApplicationListPage.ts:112
#: src/pages/crypto/CertificateKeyPairListPage.ts:86
#: src/pages/events/RuleListPage.ts:82
#: src/pages/events/TransportListPage.ts:86
@ -1014,7 +1014,7 @@ msgstr "Dummy stage used for testing. Shows a simple continue button and always
msgid "Each provider has a different issuer, based on the application slug."
msgstr "Each provider has a different issuer, based on the application slug."
#: src/pages/applications/ApplicationListPage.ts:94
#: src/pages/applications/ApplicationListPage.ts:95
#: src/pages/applications/ApplicationViewPage.ts:91
#: src/pages/applications/ApplicationViewPage.ts:105
#: src/pages/crypto/CertificateKeyPairListPage.ts:74
@ -1255,8 +1255,8 @@ msgid "Expression using Python."
msgstr "Expression using Python."
#: src/pages/applications/ApplicationListPage.ts:31
msgid "External Applications which use authentik as Identity-Provider, utilizing protocols like OAuth2 and SAML."
msgstr "External Applications which use authentik as Identity-Provider, utilizing protocols like OAuth2 and SAML."
msgid "External Applications which use authentik as Identity-Provider, utilizing protocols like OAuth2 and SAML. All applications are shown here, even ones you cannot access."
msgstr "External Applications which use authentik as Identity-Provider, utilizing protocols like OAuth2 and SAML. All applications are shown here, even ones you cannot access."
#: src/pages/providers/proxy/ProxyProviderViewPage.ts:90
msgid "External Host"
@ -1846,7 +1846,7 @@ msgid "Monitor"
msgstr "Monitor"
#: src/pages/applications/ApplicationForm.ts:86
#: src/pages/applications/ApplicationListPage.ts:57
#: src/pages/applications/ApplicationListPage.ts:58
#: src/pages/crypto/CertificateKeyPairForm.ts:45
#: src/pages/crypto/CertificateKeyPairListPage.ts:51
#: src/pages/events/EventInfo.ts:51
@ -2115,7 +2115,7 @@ msgstr "Only fail the policy, don't invalidate user's password."
msgid "Only send notification once, for example when sending a webhook into a chat channel."
msgstr "Only send notification once, for example when sending a webhook into a chat channel."
#: src/pages/applications/ApplicationListPage.ts:99
#: src/pages/applications/ApplicationListPage.ts:100
msgid "Open application"
msgstr "Open application"
@ -2393,12 +2393,12 @@ msgstr "Provide support for protocols like SAML and OAuth to assigned applicatio
#: src/elements/oauth/UserCodeList.ts:29
#: src/elements/oauth/UserRefreshList.ts:29
#: src/pages/applications/ApplicationForm.ts:100
#: src/pages/applications/ApplicationListPage.ts:59
#: src/pages/applications/ApplicationListPage.ts:60
#: src/pages/applications/ApplicationViewPage.ts:68
msgid "Provider"
msgstr "Provider"
#: src/pages/applications/ApplicationListPage.ts:60
#: src/pages/applications/ApplicationListPage.ts:61
#: src/pages/sources/oauth/OAuthSourceViewPage.ts:71
msgid "Provider Type"
msgstr "Provider Type"
@ -2809,7 +2809,7 @@ msgid "Skip path regex"
msgstr "Skip path regex"
#: src/pages/applications/ApplicationForm.ts:93
#: src/pages/applications/ApplicationListPage.ts:58
#: src/pages/applications/ApplicationListPage.ts:59
#: src/pages/flows/FlowForm.ts:94
#: src/pages/sources/ldap/LDAPSourceForm.ts:60
#: src/pages/sources/oauth/OAuthSourceForm.ts:106
@ -3469,7 +3469,7 @@ msgstr "Unknown"
msgid "Up-to-date!"
msgstr "Up-to-date!"
#: src/pages/applications/ApplicationListPage.ts:86
#: src/pages/applications/ApplicationListPage.ts:87
#: src/pages/applications/ApplicationViewPage.ts:97
#: src/pages/crypto/CertificateKeyPairListPage.ts:66
#: src/pages/events/RuleListPage.ts:62
@ -3507,7 +3507,7 @@ msgstr "Up-to-date!"
msgid "Update"
msgstr "Update"
#: src/pages/applications/ApplicationListPage.ts:89
#: src/pages/applications/ApplicationListPage.ts:90
#: src/pages/applications/ApplicationViewPage.ts:100
msgid "Update Application"
msgstr "Update Application"

View File

@ -168,12 +168,12 @@ msgstr ""
#: src/elements/user/UserConsentList.ts:29
#: src/pages/admin-overview/TopApplicationsTable.ts:42
#: src/pages/applications/ApplicationListPage.ts:104
#: src/pages/applications/ApplicationListPage.ts:105
#: src/pages/providers/ProviderListPage.ts:53
msgid "Application"
msgstr ""
#: src/pages/applications/ApplicationListPage.ts:68
#: src/pages/applications/ApplicationListPage.ts:69
msgid "Application Icon"
msgstr ""
@ -689,8 +689,8 @@ msgid "Copy Key"
msgstr ""
#: src/pages/applications/ApplicationForm.ts:120
#: src/pages/applications/ApplicationListPage.ts:120
#: src/pages/applications/ApplicationListPage.ts:128
#: src/pages/applications/ApplicationListPage.ts:121
#: src/pages/applications/ApplicationListPage.ts:129
#: src/pages/crypto/CertificateKeyPairListPage.ts:122
#: src/pages/crypto/CertificateKeyPairListPage.ts:130
#: src/pages/events/RuleListPage.ts:91
@ -736,7 +736,7 @@ msgstr ""
msgid "Create"
msgstr ""
#: src/pages/applications/ApplicationListPage.ts:123
#: src/pages/applications/ApplicationListPage.ts:124
#: src/pages/providers/RelatedApplicationButton.ts:30
msgid "Create Application"
msgstr ""
@ -862,7 +862,7 @@ msgid "Define how notifications are sent to users, like Email or Webhook."
msgstr ""
#: src/elements/forms/DeleteForm.ts:79
#: src/pages/applications/ApplicationListPage.ts:111
#: src/pages/applications/ApplicationListPage.ts:112
#: src/pages/crypto/CertificateKeyPairListPage.ts:86
#: src/pages/events/RuleListPage.ts:82
#: src/pages/events/TransportListPage.ts:86
@ -1006,7 +1006,7 @@ msgstr ""
msgid "Each provider has a different issuer, based on the application slug."
msgstr ""
#: src/pages/applications/ApplicationListPage.ts:94
#: src/pages/applications/ApplicationListPage.ts:95
#: src/pages/applications/ApplicationViewPage.ts:91
#: src/pages/applications/ApplicationViewPage.ts:105
#: src/pages/crypto/CertificateKeyPairListPage.ts:74
@ -1247,7 +1247,7 @@ msgid "Expression using Python."
msgstr ""
#: src/pages/applications/ApplicationListPage.ts:31
msgid "External Applications which use authentik as Identity-Provider, utilizing protocols like OAuth2 and SAML."
msgid "External Applications which use authentik as Identity-Provider, utilizing protocols like OAuth2 and SAML. All applications are shown here, even ones you cannot access."
msgstr ""
#: src/pages/providers/proxy/ProxyProviderViewPage.ts:90
@ -1838,7 +1838,7 @@ msgid "Monitor"
msgstr ""
#: src/pages/applications/ApplicationForm.ts:86
#: src/pages/applications/ApplicationListPage.ts:57
#: src/pages/applications/ApplicationListPage.ts:58
#: src/pages/crypto/CertificateKeyPairForm.ts:45
#: src/pages/crypto/CertificateKeyPairListPage.ts:51
#: src/pages/events/EventInfo.ts:51
@ -2107,7 +2107,7 @@ msgstr ""
msgid "Only send notification once, for example when sending a webhook into a chat channel."
msgstr ""
#: src/pages/applications/ApplicationListPage.ts:99
#: src/pages/applications/ApplicationListPage.ts:100
msgid "Open application"
msgstr ""
@ -2385,12 +2385,12 @@ msgstr ""
#: src/elements/oauth/UserCodeList.ts:29
#: src/elements/oauth/UserRefreshList.ts:29
#: src/pages/applications/ApplicationForm.ts:100
#: src/pages/applications/ApplicationListPage.ts:59
#: src/pages/applications/ApplicationListPage.ts:60
#: src/pages/applications/ApplicationViewPage.ts:68
msgid "Provider"
msgstr ""
#: src/pages/applications/ApplicationListPage.ts:60
#: src/pages/applications/ApplicationListPage.ts:61
#: src/pages/sources/oauth/OAuthSourceViewPage.ts:71
msgid "Provider Type"
msgstr ""
@ -2801,7 +2801,7 @@ msgid "Skip path regex"
msgstr ""
#: src/pages/applications/ApplicationForm.ts:93
#: src/pages/applications/ApplicationListPage.ts:58
#: src/pages/applications/ApplicationListPage.ts:59
#: src/pages/flows/FlowForm.ts:94
#: src/pages/sources/ldap/LDAPSourceForm.ts:60
#: src/pages/sources/oauth/OAuthSourceForm.ts:106
@ -3459,7 +3459,7 @@ msgstr ""
msgid "Up-to-date!"
msgstr ""
#: src/pages/applications/ApplicationListPage.ts:86
#: src/pages/applications/ApplicationListPage.ts:87
#: src/pages/applications/ApplicationViewPage.ts:97
#: src/pages/crypto/CertificateKeyPairListPage.ts:66
#: src/pages/events/RuleListPage.ts:62
@ -3497,7 +3497,7 @@ msgstr ""
msgid "Update"
msgstr ""
#: src/pages/applications/ApplicationListPage.ts:89
#: src/pages/applications/ApplicationListPage.ts:90
#: src/pages/applications/ApplicationViewPage.ts:100
msgid "Update Application"
msgstr ""

View File

@ -22,7 +22,7 @@ export class ApplicationListPage extends TablePage<Application> {
return t`Applications`;
}
pageDescription(): string {
return t`External Applications which use authentik as Identity-Provider, utilizing protocols like OAuth2 and SAML.`;
return t`External Applications which use authentik as Identity-Provider, utilizing protocols like OAuth2 and SAML. All applications are shown here, even ones you cannot access.`;
}
pageIcon(): string {
return "pf-icon pf-icon-applications";
@ -37,6 +37,7 @@ export class ApplicationListPage extends TablePage<Application> {
page: page,
pageSize: PAGE_SIZE,
search: this.search || "",
superuserFullList: true,
});
}