Skip to main content
Document permissions (document.*) are dynamic — they are generated at runtime from the job_file_types database table. Each document type has a permission_key column, and the system appends .upload, .read, or .delete to build the final permission key.
When a new document type is created in Settings → Documents, a new set of three permissions is automatically available for assignment. No code changes are required.

Permission pattern

For each document type with permission_key value document.{type}, three permissions are created:

Current document types

The following document types are currently configured. All permissions below are active — they are checked at runtime when a user attempts to upload, view, or delete a document.
Total: 45 permissions (15 document types × 3 actions each)

Adding new document types

When a new document type is created via Settings → Documents:
  1. A row is inserted into job_file_types with a permission_key (e.g. document.gas_safety_record)
  2. Three new permissions become immediately available: .upload, .read, .delete
  3. Assign the new permissions to the appropriate roles via Settings → Staff Permissions
  4. No deployment or code change is needed — the system reads document types from the database at runtime