Revert "fix(http): propagate cross-tenant context in HTTP auth middleware (#427)"

This reverts commit 39b7c689f2.
This commit is contained in:
viettranx committed 2026-03-24 11:40:54 +07:00
1 parent 39b7c689f2
commit 0209f6f970
1 file changed
+1 -5
+1 -5
View File
@@ -289,17 +289,14 @@ func requireAuth(minRole permissions.Role, next http.HandlerFunc) http.HandlerFu
}
if auth.CrossTenant && auth.TenantID != uuid.Nil {
// Cross-tenant admin with tenant scope: filter data by chosen tenant
ctx = store.WithCrossTenant(ctx)
ctx = store.WithTenantID(ctx, auth.TenantID)
slog.Debug("security.http_auth_resolved",
"path", r.URL.Path,
"role", string(auth.Role),
"cross_tenant", true,
"tenant_scope", auth.TenantID.String(),
)
} else if auth.CrossTenant {
// Cross-tenant admin without scope: default to MasterTenantID.
ctx = store.WithCrossTenant(ctx)
// Auto-scope to MasterTenantID so all operations use a concrete tenant.
ctx = store.WithTenantID(ctx, store.MasterTenantID)
slog.Debug("security.http_auth_resolved",
"path", r.URL.Path,
@@ -370,7 +367,6 @@ func requireAuthBearer(minRole permissions.Role, bearer string, w http.ResponseW
ctx = store.WithUserID(ctx, userID)
}
if auth.CrossTenant {
ctx = store.WithCrossTenant(ctx)
ctx = store.WithTenantID(ctx, store.MasterTenantID)
} else if auth.TenantID != uuid.Nil {
ctx = store.WithTenantID(ctx, auth.TenantID)