From c1a6e3d921c948cca620324b91895561b57edf35 Mon Sep 17 00:00:00 2001 From: Gerda Shank Date: Tue, 19 Nov 2024 16:21:55 -0500 Subject: [PATCH] Change is_invalid_private_ref to check package --- core/dbt/contracts/graph/manifest.py | 4 +++- tests/functional/access/test_access.py | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/dbt/contracts/graph/manifest.py b/core/dbt/contracts/graph/manifest.py index e5d4ca416eb..e53ae1a48b1 100644 --- a/core/dbt/contracts/graph/manifest.py +++ b/core/dbt/contracts/graph/manifest.py @@ -1505,8 +1505,10 @@ def is_invalid_private_ref( return is_private_ref and ( not hasattr(node, "group") or not node.group + # Invalid reference because group does not match or node.group != target_model.group - or restrict_package_access + # Or, invalid because these are different namespaces (project/package) and restrict-access is enforced + or (node.package_name != target_model.package_name and restrict_package_access) ) def is_invalid_protected_ref( diff --git a/tests/functional/access/test_access.py b/tests/functional/access/test_access.py index 0b006719f89..13cec0f0ee5 100644 --- a/tests/functional/access/test_access.py +++ b/tests/functional/access/test_access.py @@ -486,10 +486,15 @@ def test_dbt_project_access_config(self, project): tests: - not_null - unique + +groups: + - name: sales + owner: + name: sales_owner """ accounts_sql = """ -select "Jane" as name +select 'Jane' as name """