Who Can See a File
In the admin: a role › Permissions › schema totalbase
Files have no permission system of their own. files and folders are tables like any other, and a role's permissions on them decide:
| Operation | Needs |
|---|---|
| Upload | CREATE on files |
| Read content or details | READ, within the grant's row filter; nothing for a public file |
| Change details or content | UPDATE, with the row filter checked before and after |
| Delete | DELETE, within the row filter |
| Create, rename, delete folders | CREATE, UPDATE, DELETE on folders |
A refusal is 403 FILE_ACCESS_DENIED. The explorer hides what a user may not do, and a user who may read files sees Files in their rail. See Delegated administration.
Who uploaded it
PostgreSQL sets created_by and updated_by to the user who made the change, whether through a session, a token or a workflow's executor. Row filters can use them. Apply Default Permissions, on a role, lets its users upload and read files, and change or delete only their own:
{ "created_by": { "_eq": "$USER.id" } }
The storage columns (storage_provider, storage_key) are never readable or writable through the API.
Public and private
A file is Private by default: every read needs permission. A Public file is served to anyone who has its address, without credentials. Use it for images in emails, embeds and public pages, where the browser can't send a token: the sign-in page's logo and background must be public. The address contains a random id that can't be guessed.
READ on a table that references files doesn't grant READ on the files. A role that sees work orders also needs READ on files to open their photos, and its row filter decides which.