Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<template #[`item.action`]="{ item }">
<!-- Resend Invitation -->
<v-btn
v-if="canDoActions"
icon
class="mr-1"
aria-label="Resend invitation"
Expand All @@ -42,6 +43,7 @@

<!-- Remove Invitation -->
<v-btn
v-if="canDoActions"
icon
aria-label="Remove Invitation"
title="Remove Invitation"
Expand All @@ -58,16 +60,22 @@
import { Component, Emit, Vue } from 'vue-property-decorator'
import CommonUtils from '@/util/common-util'
import { Invitation } from '@/models/Invitation'
import { KCUserProfile } from 'sbc-common-components/src/models/KCUserProfile'
import { Role } from '@/util/constants'
import { mapState } from 'pinia'
import { useOrgStore } from '@/stores/org'
import { useUserStore } from '@/stores/user'

@Component({
computed: {
...mapState(useOrgStore, ['pendingOrgInvitations'])
...mapState(useOrgStore, ['pendingOrgInvitations']),
...mapState(useUserStore, ['currentUser'])
}
})
export default class InvitationsDataTable extends Vue {
private readonly pendingOrgInvitations!: Invitation[]
readonly currentUser!: KCUserProfile
canDoActions: boolean = false
readonly headerInvitations = [
{
text: 'Email',
Expand Down Expand Up @@ -95,6 +103,10 @@ export default class InvitationsDataTable extends Vue {
}
]

public mounted () {
this.canDoActions = !this.currentUser?.roles?.includes(Role.ContactCentreStaff)
Copy link
Collaborator

@ochiu ochiu Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to just abstract this a bit since we are re-using v-can and the common utils Permissions?
We can add a permission there and not need to add the role check here specifically?

^ The above applies to other places as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed transactions, and moved logic to permissions and v-can:

}

formatDate = CommonUtils.formatDisplayDate

getIndexedTag (tag, index): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</template>
<template #[`item.action`]="{ item }">
<v-btn
v-if="canDoActions"
icon
class="mr-1"
aria-label="Approve user access to this account"
Expand All @@ -38,6 +39,7 @@
<v-icon>mdi-check-circle-outline</v-icon>
</v-btn>
<v-btn
v-if="canDoActions"
icon
aria-label="Deny access to this account"
title="Deny access to this account"
Expand All @@ -52,20 +54,26 @@

<script lang="ts">
import { Component, Emit, Prop, Vue } from 'vue-property-decorator'
import { KCUserProfile } from 'sbc-common-components/src/models/KCUserProfile'
import { Member } from '@/models/Organization'
import { Role } from '@/util/constants'
import { mapState } from 'pinia'
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
import moment from 'moment'
import { useOrgStore } from '@/stores/org'
import { useUserStore } from '@/stores/user'

@Component({
computed: {
...mapState(useOrgStore, ['pendingOrgMembers'])
...mapState(useOrgStore, ['pendingOrgMembers']),
...mapState(useUserStore, ['currentUser'])
}
})
export default class PendingMemberDataTable extends Vue {
@Prop({ default: '' }) userNamefilterText: string
readonly pendingOrgMembers!: Member[]
readonly currentUser!: KCUserProfile
canDoActions: boolean = false
readonly headerPendingMembers = [
{
text: 'Team Member',
Expand All @@ -81,6 +89,10 @@ export default class PendingMemberDataTable extends Vue {
}
]

public mounted () {
this.canDoActions = !this.currentUser?.roles?.includes(Role.ContactCentreStaff)
}

getIndexedTag (tag, index): string {
return `${tag}-${index}`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
Active
</v-tab>
<v-tab
v-can:INVITE_MEMBERS.hide
data-test="pending-approval-tab"
>
<v-badge
Expand All @@ -52,7 +51,6 @@
</v-badge>
</v-tab>
<v-tab
v-can:INVITE_MEMBERS.hide
data-test="invitations-tab"
>
Invitations
Expand Down
14 changes: 13 additions & 1 deletion auth-web/src/components/auth/common/ProductTOS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</div>
<v-checkbox
v-model="termsAccepted"
:disabled="canAcceptTerms"
color="primary"
class="terms-checkbox align-checkbox-label--top ma-0 pa-0"
hide-details
Expand Down Expand Up @@ -39,15 +40,25 @@

<script lang="ts">
import { Component, Emit, Prop, Vue, Watch } from 'vue-property-decorator'
import { KCUserProfile } from 'sbc-common-components/src/models/KCUserProfile'
import { Role } from '@/util/constants'
import { mapState } from 'pinia'
import { useUserStore } from '@/stores/user'

@Component
@Component({
computed: {
...mapState(useUserStore, ['currentUser'])
}
})
export default class ProductTOS extends Vue {
@Prop({ default: '' }) userName: string
@Prop({ default: '' }) orgName: string
@Prop({ default: false }) isTOSAlreadyAccepted: boolean
@Prop({ default: false }) isApprovalFlow: boolean
termsAccepted: boolean = false
canAcceptTerms: boolean = false
public istosTouched: boolean = false
readonly currentUser!: KCUserProfile

@Watch('isTOSAlreadyAccepted')
onisTOSALreadyAcceptedChange (newTos:boolean, oldTos:boolean) {
Expand All @@ -57,6 +68,7 @@ export default class ProductTOS extends Vue {
}

public mounted () {
this.canAcceptTerms = this.currentUser?.roles?.includes(Role.ContactCentreStaff)
this.termsAccepted = this.isTOSAlreadyAccepted
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default defineComponent({
await getCodes()
await syncTasks()
await syncSuspendedStaffOrgs()
if (state.canCreateAccounts) {
if (state.canManageAccounts) {
await syncPendingInvitationOrgs()
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{{ subTitle }}
</p>
<v-btn
v-if="canDownloadAffidavit"
x-large=""
outlined
color="primary"
Expand All @@ -26,14 +27,28 @@

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import { KCUserProfile } from 'sbc-common-components/src/models/KCUserProfile'
import { Role } from '@/util/constants'
import { mapState } from 'pinia'
import { useUserStore } from '@/stores/user'

@Component({})
@Component({
computed: {
...mapState(useUserStore, ['currentUser'])
}
})
export default class DownloadAffidavit extends Vue {
@Prop({ default: null }) tabNumber: number
@Prop({ default: 'Download Affidavit' }) title: string
@Prop({ default: 'Download the notarized affidavit associated with this account to verify the account creators ' +
'identity and associated information.' }) subTitle: string
@Prop({ default: '' }) affidavitName: string
canDownloadAffidavit: boolean = false
readonly currentUser!: KCUserProfile

public mounted () {
this.canDownloadAffidavit = !this.currentUser?.roles?.includes(Role.ContactCentreStaff)
}
}
</script>

Expand Down
5 changes: 4 additions & 1 deletion auth-web/src/views/auth/staff/StaffDashboardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@
</BaseVExpansionPanel>

<!-- Feature Launch Tiles: ie Involuntary Dissolution, Document Record Service -->
<v-row>
<v-row
v-if="!isContactCentreStaff"
>
<v-col
v-for="tile in launchTileConfig"
:key="tile.title"
Expand Down Expand Up @@ -376,6 +378,7 @@ export default defineComponent({
canViewAllTransactions: computed((): boolean => currentUser.value?.roles?.includes(Role.ViewAllTransactions)),
canViewEFTPayments: computed((): boolean => currentUser.value?.roles?.includes(Role.ManageEft)),
canViewGLCodes: computed((): boolean => currentUser.value?.roles?.includes(Role.ManageGlCodes)),
isContactCentreStaff: computed(() => currentUser.value?.roles?.includes(Role.ContactCentreStaff)),
canViewIncorporationSearchResult: false,
errorMessage: '',
isFasDashboardEnabled: computed((): boolean => currentUser.value?.roles?.includes(Role.FasSearch)),
Expand Down
Loading