Skip to content

Commit

Permalink
Change is_invalid_private_ref to check package
Browse files Browse the repository at this point in the history
  • Loading branch information
gshank committed Nov 19, 2024
1 parent 3f9ac00 commit c1a6e3d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion core/dbt/contracts/graph/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 6 additions & 1 deletion tests/functional/access/test_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""


Expand Down

0 comments on commit c1a6e3d

Please sign in to comment.