Drop redundant access source organization checks
Scoped LoadByID already enforces tenant isolation; remove OrganizationID comparisons against the campaign in create, sync, add source, and review engine paths. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
@@ -69,10 +69,6 @@ func (s *Service) CreateCampaign(
|
|||||||
return fmt.Errorf("cannot load access source: %w", err)
|
return fmt.Errorf("cannot load access source: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if source.OrganizationID != campaign.OrganizationID {
|
|
||||||
return coredata.ErrResourceNotFound
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := s.upsertCampaignSource(ctx, conn, scope, campaign.ID, source); err != nil {
|
if err := s.upsertCampaignSource(ctx, conn, scope, campaign.ID, source); err != nil {
|
||||||
return fmt.Errorf("cannot snapshot scope source: %w", err)
|
return fmt.Errorf("cannot snapshot scope source: %w", err)
|
||||||
}
|
}
|
||||||
@@ -252,10 +248,6 @@ func (s *Service) AddCampaignSource(
|
|||||||
return fmt.Errorf("cannot load access source: %w", err)
|
return fmt.Errorf("cannot load access source: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if source.OrganizationID != campaign.OrganizationID {
|
|
||||||
return coredata.ErrResourceNotFound
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := s.upsertCampaignSource(ctx, conn, scope, campaign.ID, source); err != nil {
|
if err := s.upsertCampaignSource(ctx, conn, scope, campaign.ID, source); err != nil {
|
||||||
return fmt.Errorf("cannot snapshot scope source: %w", err)
|
return fmt.Errorf("cannot snapshot scope source: %w", err)
|
||||||
}
|
}
|
||||||
@@ -340,10 +332,6 @@ func (s *Service) syncCampaignSources(
|
|||||||
return fmt.Errorf("cannot load access source: %w", err)
|
return fmt.Errorf("cannot load access source: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if source.OrganizationID != campaign.OrganizationID {
|
|
||||||
return coredata.ErrResourceNotFound
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := s.upsertCampaignSource(ctx, conn, scope, campaign.ID, source); err != nil {
|
if err := s.upsertCampaignSource(ctx, conn, scope, campaign.ID, source); err != nil {
|
||||||
return fmt.Errorf("cannot snapshot scope source: %w", err)
|
return fmt.Errorf("cannot snapshot scope source: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,10 +67,6 @@ func (s *Service) FetchSource(
|
|||||||
return fmt.Errorf("cannot load access source %s: %w", sourceID, err)
|
return fmt.Errorf("cannot load access source %s: %w", sourceID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if source.OrganizationID != campaign.OrganizationID {
|
|
||||||
return fmt.Errorf("cannot process access source: %s does not belong to campaign organization", sourceID)
|
|
||||||
}
|
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
driver, err = s.resolveDriver(ctx, tx, scope, source)
|
driver, err = s.resolveDriver(ctx, tx, scope, source)
|
||||||
|
|||||||
Reference in New Issue
Block a user