Skip to content

Commit

Permalink
metabase: isrestricted check must evaluate permission group id not co…
Browse files Browse the repository at this point in the history
…llection id as collection is not removed when opening a restricted mb database
  • Loading branch information
erikvatt committed Nov 27, 2024
1 parent c7bb914 commit a85c4f8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/database/gensql/metabase_metadata.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/database/queries/metabase_metadata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ WITH sources_in_same_dataset AS (
SELECT table_name FROM sources_in_same_dataset sds
JOIN metabase_metadata mbm
ON mbm.dataset_id = sds.dataset_id
WHERE mbm.collection_id = 0 OR mbm.collection_id IS NULL;
WHERE mbm.permission_group_id = 0;
2 changes: 1 addition & 1 deletion pkg/service/core/service_metabase.go
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ func (s *metabaseService) SyncTableVisibility(ctx context.Context, meta *service
}

func isRestrictedDatabase(meta *service.MetabaseMetadata) bool {
if meta.CollectionID != nil && *meta.CollectionID != 0 {
if meta.PermissionGroupID != nil && *meta.PermissionGroupID != 0 {
return true
}

Expand Down

0 comments on commit a85c4f8

Please sign in to comment.