Working on the logic for permissions
This commit is contained in:
@@ -26,13 +26,13 @@ export let allow_moderator: boolean = false;
|
|||||||
export let show_convert_btn: null|boolean = null;
|
export let show_convert_btn: null|boolean = null;
|
||||||
|
|
||||||
// This more or less overrides the default access control. Some elements may have their own access control.
|
// This more or less overrides the default access control. Some elements may have their own access control.
|
||||||
if ($ae_loc.administrator_access) {
|
// if ($ae_loc.administrator_access) {
|
||||||
allow_basic = true;
|
// allow_basic = true;
|
||||||
allow_moderator = true;
|
// allow_moderator = true;
|
||||||
} else if ($ae_loc.trusted_access) {
|
// } else if ($ae_loc.trusted_access) {
|
||||||
allow_basic = true;
|
// allow_basic = true;
|
||||||
allow_moderator = true;
|
// allow_moderator = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
let ae_placeholder_li: key_val = {};
|
let ae_placeholder_li: key_val = {};
|
||||||
let ae_promises: key_val = {}; // Promise<any>;
|
let ae_promises: key_val = {}; // Promise<any>;
|
||||||
@@ -93,11 +93,11 @@ onMount(() => {
|
|||||||
<th class="text-center">Download File</th>
|
<th class="text-center">Download File</th>
|
||||||
<th
|
<th
|
||||||
class="text-center"
|
class="text-center"
|
||||||
class:hidden={!allow_basic}
|
class:hidden={!allow_basic && !$ae_loc.trusted_access}
|
||||||
>Options</th>
|
>Options</th>
|
||||||
<th
|
<th
|
||||||
class="text-center"
|
class="text-center"
|
||||||
class:hidden={!allow_basic}
|
class:hidden={!allow_basic && !$ae_loc.trusted_access}
|
||||||
>Status</th>
|
>Status</th>
|
||||||
<th class="text-center">Meta</th>
|
<th class="text-center">Meta</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -112,7 +112,7 @@ onMount(() => {
|
|||||||
class="min-w-full"
|
class="min-w-full"
|
||||||
> -->
|
> -->
|
||||||
<button
|
<button
|
||||||
disabled={!allow_basic && !allow_moderator}
|
disabled={!allow_basic && !allow_moderator && !$ae_loc.trusted_access}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
// ae_promises[event_file_obj.event_file_id_random]
|
// ae_promises[event_file_obj.event_file_id_random]
|
||||||
ae_promises[event_file_obj.event_file_id_random] = api.download_hosted_file({
|
ae_promises[event_file_obj.event_file_id_random] = api.download_hosted_file({
|
||||||
@@ -162,11 +162,11 @@ onMount(() => {
|
|||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="event_file__options"
|
class="event_file__options"
|
||||||
class:hidden={!allow_basic}
|
class:hidden={!allow_basic && !$ae_loc.trusted_access}
|
||||||
>
|
>
|
||||||
<div class="flex flex-col gap-1 text-sm">
|
<div class="flex flex-col gap-1 text-sm">
|
||||||
<button
|
<button
|
||||||
disabled={1==1 || !allow_basic}
|
disabled={!allow_basic || !$ae_loc.administrator_access}
|
||||||
class="btn btn-sm variant-glass-tertiary hover:variant-soft-success"
|
class="btn btn-sm variant-glass-tertiary hover:variant-soft-success"
|
||||||
title="The rename function is not ready yet."
|
title="The rename function is not ready yet."
|
||||||
>
|
>
|
||||||
@@ -174,7 +174,7 @@ onMount(() => {
|
|||||||
Rename
|
Rename
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
disabled={!allow_basic || !allow_moderator}
|
disabled={!allow_basic || !allow_moderator || !$ae_loc.administrator_access}
|
||||||
class:hidden={!$ae_loc.administrator_access}
|
class:hidden={!$ae_loc.administrator_access}
|
||||||
class="btn btn-sm variant-glass-tertiary hover:variant-soft-success"
|
class="btn btn-sm variant-glass-tertiary hover:variant-soft-success"
|
||||||
title="Hide this file from the presentation launcher"
|
title="Hide this file from the presentation launcher"
|
||||||
@@ -183,7 +183,7 @@ onMount(() => {
|
|||||||
Hide
|
Hide
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
disabled={!allow_basic}
|
disabled={!allow_basic && !$ae_loc.trusted_access}
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
if (!confirm(`Are you sure you want to delete this file?\n${event_file_obj.filename} [${event_file_obj.event_file_id_random}]`)) {return false;}
|
if (!confirm(`Are you sure you want to delete this file?\n${event_file_obj.filename} [${event_file_obj.event_file_id_random}]`)) {return false;}
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ onMount(() => {
|
|||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="event_file__status"
|
class="event_file__status"
|
||||||
class:hidden={!allow_basic}
|
class:hidden={!allow_basic && !$ae_loc.trusted_access}
|
||||||
>
|
>
|
||||||
<div class="flex flex-col gap-1 items-center text-sm">
|
<div class="flex flex-col gap-1 items-center text-sm">
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ onMount(() => {
|
|||||||
<select
|
<select
|
||||||
id="file_purpose"
|
id="file_purpose"
|
||||||
name="file_purpose"
|
name="file_purpose"
|
||||||
disabled={!allow_basic && !allow_moderator}
|
disabled={!allow_basic && !allow_moderator && !$ae_loc.trusted_access}
|
||||||
value={event_file_obj.file_purpose}
|
value={event_file_obj.file_purpose}
|
||||||
on:change={e => {
|
on:change={e => {
|
||||||
// ae_tmp[event_file_obj.event_file_id_random].file_purpose = e.target.value;
|
// ae_tmp[event_file_obj.event_file_id_random].file_purpose = e.target.value;
|
||||||
|
|||||||
@@ -1633,8 +1633,6 @@ $: if ($slct_trigger == 'load__event_presenter_obj_li') {
|
|||||||
<!-- {$lq__event_presenter_obj_li?.length} -->
|
<!-- {$lq__event_presenter_obj_li?.length} -->
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Element_manage_event_file_li
|
<Element_manage_event_file_li
|
||||||
link_to_type={'event_presentation'}
|
link_to_type={'event_presentation'}
|
||||||
link_to_id={event_presentation_obj.event_presentation_id_random}
|
link_to_id={event_presentation_obj.event_presentation_id_random}
|
||||||
|
|||||||
Reference in New Issue
Block a user