@@ -20,6 +20,8 @@ import type {
2020 SharePurpose ,
2121 PublicPollEmailConditions ,
2222} from './shares.types'
23+ import { usePollStore } from './poll'
24+ import { NotAllowed } from '../Exceptions/Exceptions'
2325
2426export const useSharesStore = defineStore ( 'shares' , {
2527 state : ( ) : SharesStore => ( {
@@ -69,6 +71,14 @@ export const useSharesStore = defineStore('shares', {
6971
7072 if ( purpose === 'pollGroup' ) {
7173 const pollGroupsStore = usePollGroupsStore ( )
74+ if (
75+ pollGroupsStore . currentPollGroup ?. owner . id
76+ !== useSessionStore ( ) . currentUser . id
77+ ) {
78+ this . shares = [ ]
79+ throw new NotAllowed ( 'Not allowed to load shares for this group' )
80+ }
81+
7282 Logger . info ( 'Loading group shares' )
7383 // For group shares, we need to use the current poll group ID
7484
@@ -77,6 +87,11 @@ export const useSharesStore = defineStore('shares', {
7787 }
7888 pollOrPollGroupId = pollGroupsStore . currentPollGroup . id
7989 } else {
90+ const pollStore = usePollStore ( )
91+ if ( ! pollStore . permissions . edit ) {
92+ this . shares = [ ]
93+ throw new NotAllowed ( 'Not allowed to load shares for this poll' )
94+ }
8095 Logger . info ( 'Loading poll shares' )
8196 // For regular poll shares, we use the current poll ID
8297 const sessionStore = useSessionStore ( )
0 commit comments