File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,6 @@ export const getTeamMembers = authActionClient
2121 const { teamId } = parsedInput
2222 const { user } = ctx
2323
24- const isAuthorized = await checkUserTeamAuthorization ( user . id , teamId )
25-
26- if ( ! isAuthorized ) {
27- return returnServerError ( 'User is not authorized to get team members' )
28- }
29-
3024 const { data, error } = await supabaseAdmin
3125 . from ( 'users_teams' )
3226 . select ( '*' )
@@ -36,6 +30,13 @@ export const getTeamMembers = authActionClient
3630 throw error
3731 }
3832
33+ const accessGranted =
34+ data . findIndex ( ( userTeam ) => userTeam . user_id === user . id ) !== - 1
35+
36+ if ( ! accessGranted ) {
37+ return returnServerError ( 'User is not authorized to get team members' )
38+ }
39+
3940 if ( ! data ) {
4041 return [ ]
4142 }
You can’t perform that action at this time.
0 commit comments