Overview
ACLService is the main entry point for permission management in Syft. It maintains an internal tree structure of permission rules and provides methods to check access, load permissions from the filesystem, and manage rulesets.
Class Definition
Constructor
The email address of the datasite owner. The owner has unrestricted access to all resources, bypassing all permission rules.
Internal tree structure for storing and querying permission rules. Automatically initialized if not provided.
Example
Methods
load_permissions_from_filesystem
Scans all permission files under a datasite directory and rebuilds the internal tree structure.Root directory of the datasite to scan. The method will recursively find all
syft.pub.yaml files.Behavior
- Clears the existing permission tree
- Recursively searches for all files named
syft.pub.yamlunder the datasite directory - Loads each ruleset and adds it to the tree with its relative path from the datasite root
- Normalizes paths so the root directory is represented as an empty string
Example
can_access
Checks whether a user has the requested level of access to a specific path.An access request containing the path, access level, and user information.
True if access is granted, False otherwise.Access Logic
- Owner Bypass: If the requesting user is the owner, access is always granted
- Rule Matching: Finds the nearest ruleset in the tree and evaluates rules by specificity
- Permission File Protection: Accessing
syft.pub.yamlfiles always requiresADMINlevel access - No Match: If no matching rule is found, access is denied
Example
add_ruleset
Adds or updates a ruleset in the permission tree.The ruleset to add. The ruleset’s
path field determines its location in the tree.Behavior
- Rules within the ruleset are automatically sorted by specificity (most specific first)
- If a ruleset already exists at the given path, it is replaced
- The ruleset’s
terminalflag affects tree traversal during access checks
Example
remove_ruleset
Removes a ruleset from the permission tree.The path of the ruleset to remove (relative to the datasite root).
Behavior
- Removes the ruleset at the specified path
- Clears the
terminalflag for that node - If the path doesn’t exist, the operation has no effect
Example
Complete Example
See Also
- RuleSet - Define permission rules
- ACLRequest - Create access requests
- Access - Configure access levels