Fix permissions

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-12-10 19:29:09 +01:00
parent e115c8bcaf
commit 8a817a70ec
2 changed files with 7 additions and 4 deletions

View File

@@ -5827,6 +5827,8 @@ func (r *reportResolver) DownloadURL(ctx context.Context, obj *types.Report) (*s
// Audit is the resolver for the audit field.
func (r *reportResolver) Audit(ctx context.Context, obj *types.Report) (*types.Audit, error) {
r.MustBeAuthorized(ctx, obj.ID, authz.ActionGetAudit)
prb := r.ProboService(ctx, obj.ID.TenantID())
audit, err := prb.Audits.GetByReportID(ctx, obj.ID)
@@ -5834,8 +5836,6 @@ func (r *reportResolver) Audit(ctx context.Context, obj *types.Report) (*types.A
panic(fmt.Errorf("cannot load audit for report: %w", err))
}
r.MustBeAuthorized(ctx, audit.OrganizationID, authz.ActionAudit)
return types.NewAudit(audit), nil
}