Expand description
File access level helpers
Provides functions to determine user access levels to files based on:
- Scoped tokens (file:{file_id}:{R|W} grants Read/Write access)
- Ownership (owner always has Write access)
- FSHR action grants (WRITE subtype = Write, otherwise Read)
Structs§
- File
Access Ctx - Context describing the subject requesting file access
- File
Access Result - Result of checking file access
Enums§
- File
Access Error - Error type for file access checks
- Scope
Check - Result of checking whether a file is allowed by scope
Constants§
- MAX_
PARENT_ DEPTH - Maximum parent-chain depth for bounded folder-tree traversals.
Functions§
- check_
file_ access_ with_ scope - Check file access and return file view with access level
- check_
scope_ allows_ create_ in - Check if a scoped token allows file creation, honoring folder subtrees.
- check_
scope_ allows_ file - Check if a file operation is allowed by scope.
- check_
share_ for_ file - Check if a user has share access to a file — either a direct share entry on the file itself or an inherited share from an ancestor folder.
- get_
access_ level - Get access level for a user on a file
- get_
access_ level_ with_ scope - Get access level for a user on a file, considering scoped tokens
- is_
descendant_ of - Return true if
ancestor_idis an ancestor folder offile_id. - resolve_
dir_ entry - Resolve one
(tn, file_id)→DirEntrythrough the folder cache, falling back to a singleread_fileon a miss. The row is cached only when it is a folder (is_folder), keeping the cache small and folder-only; non-folder rows (e.g. the leaf that starts a descendant walk) are returned but never inserted. - scope_
grants_ collection_ op - Returns true when a scoped token is itself sufficient authorization for a collection-level operation, letting the middleware skip the role/quota path.
- scope_
target_ is_ folder - Return true if the scoped target file is a folder (
file_tp == "FLDR"). - walk_
parent_ chain_ for_ share - Walk the parent chain of a file to find an inherited share entry.