Skip to content

Permissions

Understanding file and folder permissions in LoonFS.

LoonFS supports granular permissions on individual files and folders.

Every request that reads or changes namespace contents chooses its authority explicitly. Send Loonfs-Principals to enforce file and folder permissions, or Loonfs-Context: service for a trusted application request with the deployment token’s full authority. There is no permanent namespace access mode.

A permission grant connects a principal to a set of privileges. A principal is an application layer ID, such as a user ID or a group ID. LoonFS does not manage group membership; the application backend sends the applicable principal IDs with each request.

PrivilegeOn a folderOn a file
readList entries and read attributes.Read contents and attributes.
historyRead previous folder contents through a snapshot. (Requires read too.)Read previous revisions and revision history. (Requires read too.)
writeUpdate attributes.Update contents or attributes. Restoring an earlier revision also requires history.
createAdd files and folders, including moving an item into the folder.Not applicable. (Permission for creating a file is granted using create on the parent folder.)
removeDelete entries or move them out of the folder.Not applicable. (Permission for deleting a file is granted using remove on the parent folder.)
shareAdd or remove grants for permissions already granted to the actor.Same as folders.
manageChange grants and whether the folder inherits permissions. Cannot grant or remove admin.Change grants, except admin.
adminFull access to the namespace. (Can only be granted on the root folder.)Not applicable.

For example, editing a file requires write on the file, while deleting it requires remove on its parent folder.

LoonFS stores permissions, not role names. Applications may wish to combine permissions into familiar roles:

Example rolePermissions
Upload-onlycreate
Viewerread
Viewer with historyread, history
Editorread, history, write, create, remove
Managerread, history, write, create, remove, share, manage
Administratoradmin on the root folder

These are examples, not built-in roles. For instance, applications may wish to add the share permission to the Editor role if editors should be able to invite other users.

A grant on a folder applies to its files and subfolders. If a user has access through several principals, those permissions are combined.

Set boundary: true on a folder to stop it from inheriting grants from its parents. The folder’s own grants still apply to its contents. For example, a restricted /finance folder can stop inheriting the access granted to everyone at /.

There are no explicit deny rules. Namespace administrators can access every file and folder, including folders with an inheritance boundary.

Create a namespace with Create namespace and the required Loonfs-Actor header:

JSON
{
"namespace_id": "team-files"
}

Then submit a commit in service context to set its first administrator. Include Loonfs-Actor: user_123 and Loonfs-Context: service with this body:

JSON
{
"commit_id": "initialize-team-permissions",
"operations": [
{
"kind": "update_access",
"path": "/",
"boundary": false,
"grants": {
"user_123": ["admin"]
}
}
]
}

This grants user_123 administrator rights on the root folder. Service context can update grants in any namespace, including restoring access when no administrator remains.

Alongside the bearer token, send the principals whose combined grants should authorize the request:

HTTP
Loonfs-Actor: user_123
Loonfs-Principals: user_123,team_design

This request uses grants for user_123 and team_design. The actor identifies the caller for commit attribution and upload ownership; it does not determine the request’s permissions. Use stable internal IDs, not email addresses or display names. Principal IDs must be separated with commas and no spaces.

Loonfs-Actor is required for commits, namespace creation and forking, and every upload operation. It is not required for ordinary reads. Applications must authenticate users and supply their principals before forwarding requests to LoonFS.

For trusted work such as indexing, migrations, or an application without per-user permissions, send:

HTTP
Loonfs-Actor: document-importer
Loonfs-Context: service

Service context bypasses per-user permission checks. Do not let an untrusted client choose it. A namespace-content request must send exactly one of Loonfs-Principals and Loonfs-Context; sending neither or both returns invalid_request. Capability discovery, namespace metadata reads, and namespace creation do not read these context headers.

The API reference’s curl examples use service context. Replace it with Loonfs-Principals when acting for a user.

For example, to let the design team edit an existing /design folder, POST a commit with this operation:

JSON
{
"kind": "update_access",
"path": "/design",
"boundary": false,
"grants": {
"team_design": ["read", "history", "write", "create", "remove"]
}
}

update_access replaces the item’s direct grants, so include any existing grants you want to keep. Setting boundary: false ensures grants from parent folders still apply.

To avoid overwriting another permission change, include expected_inode_id and expected_access_revision_no from the item’s current entry.

  • Reading a folder’s children can reveal the names of children that the user cannot open. Reading those files still requires permission on each file.
  • Moving a file can change its inherited permissions. Moves that grant new access require permission to share that access.
  • Snapshot and revision reads use the user’s current permissions. An old snapshot does not restore permissions that were removed.
  • Deleting a folder checks remove on its parent, even if the folder contains restricted subfolders.