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;
|
||||
|
||||
// This more or less overrides the default access control. Some elements may have their own access control.
|
||||
if ($ae_loc.administrator_access) {
|
||||
allow_basic = true;
|
||||
allow_moderator = true;
|
||||
} else if ($ae_loc.trusted_access) {
|
||||
allow_basic = true;
|
||||
allow_moderator = true;
|
||||
}
|
||||
// if ($ae_loc.administrator_access) {
|
||||
// allow_basic = true;
|
||||
// allow_moderator = true;
|
||||
// } else if ($ae_loc.trusted_access) {
|
||||
// allow_basic = true;
|
||||
// allow_moderator = true;
|
||||
// }
|
||||
|
||||
let ae_placeholder_li: key_val = {};
|
||||
let ae_promises: key_val = {}; // Promise<any>;
|
||||
@@ -93,11 +93,11 @@ onMount(() => {
|
||||
<th class="text-center">Download File</th>
|
||||
<th
|
||||
class="text-center"
|
||||
class:hidden={!allow_basic}
|
||||
class:hidden={!allow_basic && !$ae_loc.trusted_access}
|
||||
>Options</th>
|
||||
<th
|
||||
class="text-center"
|
||||
class:hidden={!allow_basic}
|
||||
class:hidden={!allow_basic && !$ae_loc.trusted_access}
|
||||
>Status</th>
|
||||
<th class="text-center">Meta</th>
|
||||
</tr>
|
||||
@@ -112,7 +112,7 @@ onMount(() => {
|
||||
class="min-w-full"
|
||||
> -->
|
||||
<button
|
||||
disabled={!allow_basic && !allow_moderator}
|
||||
disabled={!allow_basic && !allow_moderator && !$ae_loc.trusted_access}
|
||||
on:click={() => {
|
||||
// ae_promises[event_file_obj.event_file_id_random]
|
||||
ae_promises[event_file_obj.event_file_id_random] = api.download_hosted_file({
|
||||
@@ -162,11 +162,11 @@ onMount(() => {
|
||||
</td>
|
||||
<td
|
||||
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">
|
||||
<button
|
||||
disabled={1==1 || !allow_basic}
|
||||
disabled={!allow_basic || !$ae_loc.administrator_access}
|
||||
class="btn btn-sm variant-glass-tertiary hover:variant-soft-success"
|
||||
title="The rename function is not ready yet."
|
||||
>
|
||||
@@ -174,7 +174,7 @@ onMount(() => {
|
||||
Rename
|
||||
</button>
|
||||
<button
|
||||
disabled={!allow_basic || !allow_moderator}
|
||||
disabled={!allow_basic || !allow_moderator || !$ae_loc.administrator_access}
|
||||
class:hidden={!$ae_loc.administrator_access}
|
||||
class="btn btn-sm variant-glass-tertiary hover:variant-soft-success"
|
||||
title="Hide this file from the presentation launcher"
|
||||
@@ -183,7 +183,7 @@ onMount(() => {
|
||||
Hide
|
||||
</button>
|
||||
<button
|
||||
disabled={!allow_basic}
|
||||
disabled={!allow_basic && !$ae_loc.trusted_access}
|
||||
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;}
|
||||
|
||||
@@ -206,7 +206,7 @@ onMount(() => {
|
||||
</td>
|
||||
<td
|
||||
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">
|
||||
|
||||
@@ -233,7 +233,7 @@ onMount(() => {
|
||||
<select
|
||||
id="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}
|
||||
on:change={e => {
|
||||
// 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} -->
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
<Element_manage_event_file_li
|
||||
link_to_type={'event_presentation'}
|
||||
link_to_id={event_presentation_obj.event_presentation_id_random}
|
||||
|
||||
Reference in New Issue
Block a user