Add tenant scoping to LoadAllByCookieBannerID
Every other LoadAll* method in coredata takes a Scoper parameter for tenant isolation. LoadAllByCookieBannerID was the only one that omitted it, making the isolation invariant depend entirely on callers first loading the banner with a scoped query. Add scope.SQLFragment to the WHERE clause to match the pattern used by the paginated sibling LoadByCookieBannerID. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -283,7 +283,7 @@ func (s *Service) CreateCookieBanner(
|
||||
}
|
||||
|
||||
var categories coredata.CookieCategories
|
||||
if err := categories.LoadAllByCookieBannerID(ctx, tx, banner.ID); err != nil {
|
||||
if err := categories.LoadAllByCookieBannerID(ctx, tx, scope, banner.ID); err != nil {
|
||||
return fmt.Errorf("cannot load cookie categories: %w", err)
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ func (s *Service) UpdateCookieBanner(
|
||||
|
||||
if consentChanged {
|
||||
var categories coredata.CookieCategories
|
||||
if err := categories.LoadAllByCookieBannerID(ctx, tx, banner.ID); err != nil {
|
||||
if err := categories.LoadAllByCookieBannerID(ctx, tx, scope, banner.ID); err != nil {
|
||||
return fmt.Errorf("cannot load cookie categories: %w", err)
|
||||
}
|
||||
|
||||
@@ -635,7 +635,7 @@ func (s *Service) CreateCookieCategory(
|
||||
}
|
||||
|
||||
var categories coredata.CookieCategories
|
||||
if err := categories.LoadAllByCookieBannerID(ctx, tx, req.CookieBannerID); err != nil {
|
||||
if err := categories.LoadAllByCookieBannerID(ctx, tx, scope, req.CookieBannerID); err != nil {
|
||||
return fmt.Errorf("cannot load cookie categories: %w", err)
|
||||
}
|
||||
|
||||
@@ -779,7 +779,7 @@ func (s *Service) UpdateCookieCategory(
|
||||
}
|
||||
|
||||
var categories coredata.CookieCategories
|
||||
if err := categories.LoadAllByCookieBannerID(ctx, tx, category.CookieBannerID); err != nil {
|
||||
if err := categories.LoadAllByCookieBannerID(ctx, tx, scope, category.CookieBannerID); err != nil {
|
||||
return fmt.Errorf("cannot load cookie categories: %w", err)
|
||||
}
|
||||
|
||||
@@ -829,7 +829,7 @@ func (s *Service) DeleteCookieCategory(
|
||||
}
|
||||
|
||||
var categories coredata.CookieCategories
|
||||
if err := categories.LoadAllByCookieBannerID(ctx, tx, bannerID); err != nil {
|
||||
if err := categories.LoadAllByCookieBannerID(ctx, tx, scope, bannerID); err != nil {
|
||||
return fmt.Errorf("cannot load cookie categories: %w", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user