@@ -214,21 +214,25 @@ func (r *mutationResolver) cloneControls(ctx context.Context, controlsToClone []
214214 return nil , generated .ErrPermissionDenied
215215 }
216216
217- allow , err := r .db .Authz .CheckAccess (ctx , fgax.AccessCheck {
218- ObjectType : generated .TypeProgram ,
219- ObjectID : * programID ,
220- Relation : fgax .CanEdit ,
221- SubjectID : caller .SubjectID ,
222- SubjectType : caller .SubjectType (),
223- })
224- if err != nil {
225- return nil , err
226- }
217+ // support users should skip this check but for other users,
218+ // we still want to verify they have edit access to the program
219+ if ! caller .Has (auth .CapOrgSupport ) {
220+ allow , err := r .db .Authz .CheckAccess (ctx , fgax.AccessCheck {
221+ ObjectType : generated .TypeProgram ,
222+ ObjectID : * programID ,
223+ Relation : fgax .CanEdit ,
224+ SubjectID : caller .SubjectID ,
225+ SubjectType : caller .SubjectType (),
226+ })
227+ if err != nil {
228+ return nil , err
229+ }
227230
228- if ! allow {
229- logger .Error ().Str ("organization_id" , caller .OrganizationID ).Str ("user_id" , caller .SubjectID ).Msg ("no access to edit specified program" )
231+ if ! allow {
232+ logger .Error ().Str ("organization_id" , caller .OrganizationID ).Str ("user_id" , caller .SubjectID ).Msg ("no access to edit specified program" )
230233
231- return nil , generated .ErrPermissionDenied
234+ return nil , generated .ErrPermissionDenied
235+ }
232236 }
233237 }
234238
0 commit comments