# Permissions¶

Permissions in the File Abstraction Layer are the result of a combination of various mechanisms.

## System Permissions¶

System permissions are strictly enforced and may prevent an action no matter what component triggered them.

Administrators always have full access. The only reason they might not have access is that the underlying file system or storage service does not allow access to a resource (e.g. some file is read-only in the local file system).

## File Mounts¶

Files mounts (discussed in the Getting Started Tutorial) restrict users to a certain folder in a certain Storage. This is an obvious permission restriction: users will never be able to act on a file or folder outside of their allotted file mounts.

## User Permissions¶

User permissions for files can be set in the “Fileoperation permissions” section of the Backend User or Backend User Group records.

It is also possible to set permissions using User TSconfig, defined either at Backend User or Backend User Group level. The TSconfig way is recommended because it allows for more flexibility. See some examples below and read on in the section about permissions in the user TSconfig reference.

The default permissions for backend users and backend user groups are read-only:

permissions.file.default {
writeFile    = 0
copyFile     = 0
moveFile     = 0
renameFile   = 0
deleteFile   = 0
writeFolder  = 0
copyFolder   = 0
moveFolder   = 0
renameFolder = 0
deleteFolder = 0
recursivedeleteFolder = 0
}


If no permissions are defined in TSconfig, the settings in the Backend User and in the Backend User Group record are taken into account and treated as default permissions for all Storages.

### User Permissions per Storage¶

Using User TSconfig it is possible to set different permissions for different Storages. This syntax uses the uid of the targeted Storage record.

The following example grants all permission for the Storage with uid “1”:

permissions.file.storage.1 {
writeFile    = 1
copyFile     = 1
moveFile     = 1
renameFile   = 1
deleteFile   = 1
writeFolder  = 1
copyFolder   = 1
moveFolder   = 1
renameFolder = 1
deleteFolder = 1
recursivedeleteFolder = 1
}


Note

Configured permissions for a specific Storage take precedence over default permissions.

### User Permissions Details¶

This model for permissions behaves very similar to permission systems on Unix and Linux systems. Folders are seen as a collection of files and folders. If you want to change that collection by adding, removing or renaming files or folders you need to have write permissions for the folder as well. If you only want to change the content of a file you need write permissions for the file but not for the containing folder.

Here is the detail of what the various permission options mean:

Show content of files.
writeFile
Edit or save contents of files, even if NO write permissions to folders are granted.
copyFile
Allow copying of files; needs writeFolder permissions for the target folder.
moveFile
Allow moving files; needs writeFolder permissions for source and target folders.
renameFile
Allow renaming files; needs writeFolder permissions.
deleteFile
Delete a file; needs writeFolder permissions.
Add or create new folders; needs writeFolder permissions for the parent folder.
List contents of folder.
writeFolder
Permission to change contents of folder (add files, rename files, add folders, rename folders). Changing contents of existing files is not governed by this permission!
copyFolder
Needs writeFolder permissions for the target folder.
moveFolder
Needs writeFolder permissions for both target and source folder (because it is removed from the latter, which changes the folder).
renameFolder
Needs writeFolder permissions (because it changes the folder itself and also the containing folder’s contents).
deleteFolder
Remove an (empty) folder; needs write folder permissions.
recursivedeleteFolder
Remove a folder even if it has contents; needs write folder permissions.

When nothing else is defined, any file uploaded by a user will end up in fileadmin/user_upload. The user TSconfig property defaultUploadFolder, allows to define a different default upload folder on a backend user or backend user group level, example:
options.defaultUploadFolder = 3:users/uploads/