diff --git a/backend/iam/views.py b/backend/iam/views.py index 942ae18b5..a87ee9f65 100644 --- a/backend/iam/views.py +++ b/backend/iam/views.py @@ -78,6 +78,7 @@ def get(self, request) -> Response: "roles": request.user.get_roles(), "permissions": request.user.permissions, "is_third_party": request.user.is_third_party, + "is_admin": request.user.is_admin(), } return Response(res_data, status=HTTP_200_OK) diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 103f78728..7ab123d5c 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -765,5 +765,6 @@ "associatedEntities": "Associated entities", "noMailerConfigured": "No mailer configured", "errorLicenseSeatsExceeded": "The number of license seats is exceeded, you will not be able to grant editing rights to this user. Please contact your administrator.", - "availableSeats": "Available seats" + "availableSeats": "Available seats", + "librariesCanOnlyBeLoadedByAdmin": "Libraries can only be loaded by an administrator" } diff --git a/frontend/src/lib/components/ModelTable/LibraryActions.svelte b/frontend/src/lib/components/ModelTable/LibraryActions.svelte index 49fd182bd..4a5d25404 100644 --- a/frontend/src/lib/components/ModelTable/LibraryActions.svelte +++ b/frontend/src/lib/components/ModelTable/LibraryActions.svelte @@ -3,6 +3,7 @@ import { invalidateAll } from '$app/navigation'; import type { ActionResult } from '@sveltejs/kit'; import * as m from '$paraglide/messages'; + import { page } from '$app/stores'; export let meta: any; export let actionsURLModel: string; @@ -46,7 +47,7 @@ /> - {:else} + {:else if $page.data.user.is_admin}
{#if tabSet === 0} +
+ +

{m.librariesCanOnlyBeLoadedByAdmin()}

+
-{#if tabSet === 0} +{#if tabSet === 0 && $page.data.user.is_admin}
{#await superValidate(zod(LibraryUploadSchema))}

{m.loadingLibraryUploadButton()}...

diff --git a/frontend/src/routes/(app)/(internal)/libraries/[id=uuid]/+page.svelte b/frontend/src/routes/(app)/(internal)/libraries/[id=uuid]/+page.svelte index 2d2cf641b..5d6b0998b 100644 --- a/frontend/src/routes/(app)/(internal)/libraries/[id=uuid]/+page.svelte +++ b/frontend/src/routes/(app)/(internal)/libraries/[id=uuid]/+page.svelte @@ -5,6 +5,7 @@ import Dropdown from '$lib/components/Dropdown/Dropdown.svelte'; import TreeViewItemContent from '../../frameworks/[id=uuid]/TreeViewItemContent.svelte'; import * as m from '$paraglide/messages'; + import { page } from '$app/stores'; export let data; let loading = { form: false, library: '' }; @@ -122,9 +123,11 @@ }} on:submit={handleSubmit} > - + {#if $page.data.user.is_admin} + + {/if} {/if} {/if}