aboutsummaryrefslogtreecommitdiffstats
path: root/bsfs/graph/ac
diff options
context:
space:
mode:
authorMatthias Baumgartner <dev@igsor.net>2022-12-22 20:35:15 +0100
committerMatthias Baumgartner <dev@igsor.net>2022-12-22 20:35:15 +0100
commit9ab60f915fa53ae2ac2cf06b2f68138ffaa534d4 (patch)
treee6290053c00e06fda9e41ac0a602ff53d91a38ac /bsfs/graph/ac
parente94368c75468e3e94382b12705e55d396249eaca (diff)
parentca7ee6c59d2eb3f4ec4d16e392d12d946cd85e4d (diff)
downloadbsfs-9ab60f915fa53ae2ac2cf06b2f68138ffaa534d4.tar.gz
bsfs-9ab60f915fa53ae2ac2cf06b2f68138ffaa534d4.tar.bz2
bsfs-9ab60f915fa53ae2ac2cf06b2f68138ffaa534d4.zip
Merge branch 'mb/filter' into develop
Diffstat (limited to 'bsfs/graph/ac')
-rw-r--r--bsfs/graph/ac/base.py4
-rw-r--r--bsfs/graph/ac/null.py5
2 files changed, 9 insertions, 0 deletions
diff --git a/bsfs/graph/ac/base.py b/bsfs/graph/ac/base.py
index bc9aeb3..0703e2e 100644
--- a/bsfs/graph/ac/base.py
+++ b/bsfs/graph/ac/base.py
@@ -10,6 +10,7 @@ import typing
# bsfs imports
from bsfs import schema
+from bsfs.query import ast
from bsfs.triple_store import TripleStoreBase
from bsfs.utils import URI
@@ -67,5 +68,8 @@ class AccessControlBase(abc.ABC):
def createable(self, node_type: schema.Node, guids: typing.Iterable[URI]) -> typing.Iterable[URI]:
"""Return nodes that are allowed to be created."""
+ @abc.abstractmethod
+ def filter_read(self, node_type: schema.Node, query: ast.filter.FilterExpression) -> ast.filter.FilterExpression:
+ """Re-write a filter *query* to get (i.e., read) *node_type* nodes."""
## EOF ##
diff --git a/bsfs/graph/ac/null.py b/bsfs/graph/ac/null.py
index 36838bd..12b4e87 100644
--- a/bsfs/graph/ac/null.py
+++ b/bsfs/graph/ac/null.py
@@ -10,6 +10,7 @@ import typing
# bsfs imports
from bsfs import schema
from bsfs.namespace import ns
+from bsfs.query import ast
from bsfs.utils import URI
# inner-module imports
@@ -49,4 +50,8 @@ class NullAC(base.AccessControlBase):
"""Return nodes that are allowed to be created."""
return guids
+ def filter_read(self, node_type: schema.Node, query: ast.filter.FilterExpression) -> ast.filter.FilterExpression:
+ """Re-write a filter *query* to get (i.e., read) *node_type* nodes."""
+ return query
+
## EOF ##