Skip to content

Commit

Permalink
[ACCESS-CHANGE]: Prioritize higher access level permission
Browse files Browse the repository at this point in the history
  • Loading branch information
amadolid committed Jan 17, 2025
1 parent 8ae56fd commit 877704f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions jac-cloud/jac_cloud/plugin/jaseci.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,13 +457,13 @@ def check_access_level(to: Anchor) -> AccessLevel:
access_level = to_root.access.all

level = to_root.access.roots.check(jroot.ref_id)
if level > AccessLevel.NO_ACCESS and access_level == AccessLevel.NO_ACCESS:
if level > AccessLevel.NO_ACCESS and access_level > level:
access_level = level

# if target anchor have set allowed roots
# if current root is allowed to target anchor
level = to_access.roots.check(jroot.ref_id)
if level > AccessLevel.NO_ACCESS and access_level == AccessLevel.NO_ACCESS:
if level > AccessLevel.NO_ACCESS and access_level > level:
access_level = level

return access_level
Expand Down
4 changes: 2 additions & 2 deletions jac/jaclang/plugin/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ def check_access_level(to: Anchor) -> AccessLevel:
access_level = to_root.access.all

level = to_root.access.roots.check(str(jroot.id))
if level > AccessLevel.NO_ACCESS and access_level == AccessLevel.NO_ACCESS:
if level > AccessLevel.NO_ACCESS and access_level < level:
access_level = level

# if target anchor have set allowed roots
# if current root is allowed to target anchor
level = to_access.roots.check(str(jroot.id))
if level > AccessLevel.NO_ACCESS and access_level == AccessLevel.NO_ACCESS:
if level > AccessLevel.NO_ACCESS and access_level < level:
access_level = level

return access_level
Expand Down

0 comments on commit 877704f

Please sign in to comment.