Skip to content

Commit

Permalink
Merge pull request #186 from bcgov/invite-perm
Browse files Browse the repository at this point in the history
Show Invite button requires MANAGE
  • Loading branch information
norrisng-bc authored Apr 24, 2024
2 parents b26993f + a21af0d commit 483d12b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/bucket/BucketTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ watch(getBuckets, () => {
:parent-bucket="node.data"
/>
<Button
v-if="permissionStore.isBucketActionAllowed(node.data.bucketId, getUserId, Permissions.UPDATE)"
v-if="permissionStore.isBucketActionAllowed(node.data.bucketId, getUserId, Permissions.MANAGE)"
v-tooltip.bottom="'Configure bucket'"
class="p-button-lg p-button-text"
aria-label="Configure bucket"
Expand Down
16 changes: 14 additions & 2 deletions frontend/src/components/common/InviteButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { computed, ref, onMounted } from 'vue';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import ShareLinkContent from '@/components/object/share/ShareLinkContent.vue';
import { Button, Dialog, TabView, TabPanel, RadioButton, InputText, useToast, InputSwitch } from '@/lib/primevue';
import { Permissions } from '@/utils/constants';
import { inviteService } from '@/services';
import { useConfigStore, useObjectStore, useBucketStore } from '@/store';
import { useAuthStore, useConfigStore, useObjectStore, usePermissionStore, useBucketStore } from '@/store';
import type { Ref } from 'vue';
import type { COMSObject, Bucket } from '@/types';
Expand Down Expand Up @@ -36,13 +37,21 @@ const props = withDefaults(defineProps<Props>(), {
const objectStore = useObjectStore();
const bucketStore = useBucketStore();
const { getConfig } = storeToRefs(useConfigStore());
const { getUserId } = storeToRefs(useAuthStore());
const permissionStore = usePermissionStore();
const toast = useToast();
// State
const obj: Ref<COMSObject | undefined> = ref(undefined);
const bucket: Ref<Bucket | undefined> = ref(undefined);
const isRestricted: Ref<boolean> = ref(props.restricted);
const showInviteLink: Ref<boolean> = ref(false);
const hasManagePermission: Ref<boolean> = computed(() => {
return (props.objectId) ?
permissionStore.isObjectActionAllowed(props.objectId, getUserId.value, Permissions.MANAGE) :
permissionStore.isBucketActionAllowed(props.bucketId, getUserId.value, Permissions.MANAGE);
});
// Share link
const inviteLink: Ref<string> = ref('');
Expand Down Expand Up @@ -145,7 +154,10 @@ onMounted(() => {
label="Share Link"
/>
</TabPanel>
<TabPanel header="Invite link">
<TabPanel
header="Invite link"
:disabled="!hasManagePermission"
>
<h3 class="mt-1 mb-2">{{ props.labelText }} Invite</h3>
<p>Make invite available for:</p>
<div class="flex flex-wrap gap-3">
Expand Down

0 comments on commit 483d12b

Please sign in to comment.