Skip to content

Commit

Permalink
Merge branch 'main' into ci/backend-migrations-check
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Oct 11, 2024
2 parents e630e64 + 5cf1ac3 commit e3302de
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions backend/iam/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
3 changes: 2 additions & 1 deletion frontend/src/lib/components/ModelTable/LibraryActions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -46,7 +47,7 @@
/>
</svg>
</div>
{:else}
{:else if $page.data.user.is_admin}
<span class="hover:text-primary-500">
<form
method="post"
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/routes/(app)/(internal)/libraries/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import ModelTable from '$lib/components/ModelTable/ModelTable.svelte';
import { superValidate } from 'sveltekit-superforms';
import { zod } from 'sveltekit-superforms/adapters';
import { page } from '$app/stores';
export let data;
Expand All @@ -32,6 +33,10 @@
<svelte:fragment slot="panel">
<!-- storedlibraries -->
{#if tabSet === 0}
<div class="flex items-center mb-2 px-2 text-xs space-x-2">
<i class="fa-solid fa-info-circle" />
<p>{m.librariesCanOnlyBeLoadedByAdmin()}</p>
</div>
<ModelTable
source={data.storedLibrariesTable}
URLModel="libraries"
Expand All @@ -54,7 +59,7 @@
</svelte:fragment>
</TabGroup>
</div>
{#if tabSet === 0}
{#if tabSet === 0 && $page.data.user.is_admin}
<div class="card bg-white p-4 mt-4 shadow">
{#await superValidate(zod(LibraryUploadSchema))}
<h1>{m.loadingLibraryUploadButton()}...</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: '' };
Expand Down Expand Up @@ -122,9 +123,11 @@
}}
on:submit={handleSubmit}
>
<button type="submit" class="p-1 btn text-xl hover:text-primary-500">
<i class="fa-solid fa-file-import" />
</button>
{#if $page.data.user.is_admin}
<button type="submit" class="p-1 btn text-xl hover:text-primary-500">
<i class="fa-solid fa-file-import" />
</button>
{/if}
</form>
{/if}
{/if}
Expand Down

0 comments on commit e3302de

Please sign in to comment.