Attachment Management
SimpleOne supports attaching files to records. See the Attachments article to learn how to upload, download and delete files attached to a record using the portal or agent interfaces. This article provides information on how to configure various aspects of the system related to attachments:
- configure attachment actions in the interface.
- manage attachment records.
- parsing and indexing.
- monitor the system logs.
- set the system properties.
- configure access to attachments.
Attachment in interface
Action and Image field
You can attach files to a field of Image type and a record with the attachment action. The action is displayed on forms as the paper clip icon .
The screenshot below illustrates two attachment actions on the record form:
Attachment widget
Attachments can be added via an attachment widget in the agent interface. For this, you need to use the <attachment> SimpleTag within a certain widget instance. It is unnecessary to specify the recordId, tableName attributes for the <attachment> tag located on the page with the form. Therefore, a widget template with an attachment tag will look like this:
<attachment> </attachment>
After adding a widget instance to a form of the agent interface, the standard action in the top right corner of the form will be removed:
You can add files from the clipboard to the widget directly on the form by using Ctrl+V shortcut while hovering over Drag & drop area.
Attachment record
When you upload a file, a record is created in the Attachment (sys_attachment) table. To reach these records, navigate to Attachments → All Attachments.
Attachment record form fields
Field | Mandatory | Description |
---|---|---|
Document record | N | This field is automatically populated with a reference to the record the file is attached to. |
File name | Y | Displays the file name. |
File path | N | Displays the absolute file path on the server. |
Size bytes | N | Displays the file size in bytes. |
MIME content type | Y | Displays the file content type described in the MIME standard. |
Public | N | Select this checkbox to make the attachment public. |
Parsing and indexing
Parsing and indexing attachment content is possible only if the attachment file size is under 30 Mb. The limit is fixed and cannot be modified. If the file is bigger than 30 Mb, it will not be indexed. The warning message related to the indexation is written to logs. To find this message open the Main Log (sys_log) table and use the criteria below for the filter:
- Level is Warning
- Message contains {Attachment ID}
Indexing is performed only for specific file formats. The Content field on the Attachment form will be automatically filled with the text content of the attached file if the file extension is included in the list: TXT, INI, REG, CVS, JSON, HTM, HTML, DOC, DOCS, XLS, XLSX. The Full text search is enabled within the Content field, which allows you to perform a global search on the field's content.
To disable indexing for specific tables, specify their names in the simple.attachments.ignored_tables_indexing system property.
The attachment parsing and indexing process is asynchronous. Within this process, the following events take place:
-
A file is attached to a record. A new record is created in the Attachment (sys_attachment) table.
-
A record in the Search Indices (sys_search_index) table is created for the attached file with the following fields:
Field Description Record ID of the record the file is attached to. Table Reference to the Attachment (sys_attachment) table. Column Reference to the Content column of the Attachment (sys_attachment) table. Text The parsed content of the attached file in text format. -
The parsed content is placed in the previously created record in the Attachments (sys_attachment) table. The attachment content is stored in the Content field, and the content encoding – in the Encoding field. The content encoding is detected automatically.
Attachment logging
The system logs all operations (except for reading) in the Main Log (sys_log) table. Operations related to attachments have the Source field value equal to Attachment
. Navigate to System Logs → Main Log to view the log.
If any errors or exceptions occur when adding an attachment, they are recorded in the Exception Log (sys_log_exception). Navigate to System Logs → Exception Log to view these records.
See the System Audit article to learn more.
Configure attachment properties
To set up attachment properties, perform the following steps:
- Navigate to System Properties → All Properties.
- Find the required property record in the list and open it.
- Edit the Value field.
- Click Save or Save and exit to apply the changes.
Property | Description |
---|---|
max_files_upload_count | Specify the maximum number of files that can be uploaded. |
max_file_size_upload | Specify the maximum file size (in bytes) that can be uploaded. |
allowed_upload_file_extension | Specify the file types that are allowed for uploading. List the extensions separated by commas without spaces, for example, jpeg,png,pdf . Files of other types will be ignored. To allow all types of files, type [] . |
simple.attachments.ignored_tables_indexing | Disable indexing of files attached to the records in a table or tables. List the system names of tables separated by a comma and a space, for example, sys_email, sys_import_source . |
Access to attachments
The Access Control List (ACL) rules determine whether a certain user or a group can upload, download or delete files attached to a record.
Role required: security_admin.
Restrict access to attachments
- Attachments can only be uploaded by a user with rights to create records in the Attachment (sys_attachment) table, and with rights to edit records to which they are trying to upload an attachment. To prevent a user from uploading an attachment, set up access control to one of these operations.
- Attachments can be deleted by a user with rights to delete records from the Attachment (sys_attachment) table, and with rights to edit or delete the record from which they are trying to delete an attachment.
- Attachments can be downloaded by a user with rights to read the Attachment (sys_attachment) table and the record to which the file is attached.
- Copying can be done by a user with read access to the table of the record to which the original file is attached, and with edit access to the table in which the copy is being made.
You can supplement the existing access control rules for the Attachment (sys_attachment) table with new rules containing other conditions. New rules should not contradict the existing ones. To do so, complete the steps below:
- Navigate to System Security → Access Control (ACL).
- Click New and fill in the fields.
- In the Table field, select the Attachment table.
- Click Save or Save and exit to apply the changes.
See the ACL and Role Structure articles to learn more about access limitations.
Restrict access to fields of the Image type
Use the Access Control List (ACL) to restrict operations on Image columns for users with specific roles.
To restrict access, perform the following steps:
- Navigate to System Security → Access Control (ACL).
- Click New and fill in the fields.
- In the Column field, select the image column you need to protect.
- Click Save or Save and exit to apply the changes.
As a result:
- Creating, editing, and/or reading columns in a specific table is restricted.
- The specified rules are applied to the portal forms as well.
The table below describes the effect of the operation restrictions on an image field:
Operation | Description |
---|---|
create | The field is hidden on a new record form and appears after the record is saved. |
read | The field and its contents (attached files) are hidden. |
write | The field is read-only. |