Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
[REVERTIBLE]: Remove node/type access validation support
Browse files Browse the repository at this point in the history
  • Loading branch information
amadolid committed Jun 27, 2024
1 parent 63bd85a commit 770d8b5
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions jaclang/core/architype.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class Permission(Generic[T]):

all: int = 0
roots: Access[T] = field(default_factory=Access[T])
types: dict[type[Architype], Access[T]] = field(default_factory=dict)
nodes: Access[T] = field(default_factory=Access[T])
# types: dict[type[Architype], Access[T]] = field(default_factory=dict)
# nodes: Access[T] = field(default_factory=Access[T])


@dataclass(eq=False)
Expand Down Expand Up @@ -171,22 +171,22 @@ def is_allowed(self, to: Union[ObjectAnchor, Architype]) -> bool:
return True

if self.current_access_level and self.current_access_level > -1:
whitelist, has_access, level = to_access.nodes.check(self.id)
if not whitelist and not has_access:
to.current_access_level = None
return False
elif whitelist and has_access and to.current_access_level is None:
to.current_access_level = level

if (architype := self.architype) and (
access_type := to_access.types.get(architype.__class__)
):
whitelist, has_access, level = access_type.check(self.id)
if not whitelist and not has_access:
to.current_access_level = None
return False
elif whitelist and has_access and to.current_access_level is None:
to.current_access_level = level
# whitelist, has_access, level = to_access.nodes.check(self.id)
# if not whitelist and not has_access:
# to.current_access_level = None
# return False
# elif whitelist and has_access and to.current_access_level is None:
# to.current_access_level = level

# if (architype := self.architype) and (
# access_type := to_access.types.get(architype.__class__)
# ):
# whitelist, has_access, level = access_type.check(self.id)
# if not whitelist and not has_access:
# to.current_access_level = None
# return False
# elif whitelist and has_access and to.current_access_level is None:
# to.current_access_level = level

whitelist, has_access, level = to_access.roots.check(jroot.id)
if not whitelist and not has_access:
Expand Down

0 comments on commit 770d8b5

Please sign in to comment.