beldathas
11/14/2023, 7:45 PMopendal a little bit (mostly the Python bindings), really interesting project!
Operator.layer(). My guess is that the API docs point to main branch instead of the latest release available on PyPI? Xuanwo
11/14/2023, 9:14 PMbeldathas
11/14/2023, 9:18 PMXuanwo
11/15/2023, 2:56 AMbeldathas
11/15/2023, 5:57 AMLayer API would look like in Python, but I was thinking about having some custom access control layer. Here's a very quick draft of how I'm seeing it.
python
from typing import Dict, List, Callable, Literal, Optional
import opendal
from opendal.layers import Layer
class AccessRule:
def __init__(self, allowed_operations: List[Literal["read", "write"]], condition: Optional[Callable] = None): ...
class AccessControlLayer(Layer):
def __init__(self, user_permissions: Dict[str, AccessRule]): ...
access_rules = {
"user1": AccessRule(["read", "write"]),
"user2": AccessRule(["read"], condition=lambda user, op, path: path.startswith("/public/"))
}
acl_layer = AccessControlLayer(access_rules)
op = opendal.Operator("fs", root="/data").layer(acl_layer)
after making this draft, I tend to agree with you that it's probably not the best place for it.