AccessMode defines the type of access granted to a path. It’s used with CapabilitySet.allow_path() and CapabilitySet.allow_file().
Values
| Value | Description |
|---|---|
READ | Read-only access. Can open files for reading, list directories. |
WRITE | Write-only access. Can create, modify, and delete files. |
READ_WRITE | Full access. Combines READ and WRITE permissions. |
Usage
Basic Usage
With Query Context
Access Level Hierarchy
READ_WRITE is the highest access level and covers both READ and WRITE:
| Granted | Requested READ | Requested WRITE | Requested READ_WRITE |
|---|---|---|---|
READ | Allowed | Denied | Denied |
WRITE | Denied | Allowed | Denied |
READ_WRITE | Allowed | Allowed | Allowed |
String Representation
Comparison and Hashing
AccessMode values are hashable and can be used as dictionary keys or in sets:
Related
- CapabilitySet - Use AccessMode when granting permissions
- QueryContext - Use AccessMode when checking permissions
- FsCapability - Contains the access mode for a capability