Skip to content

Commit 552c2c5

Browse files
authored
feat(docs): file modification (#888)
1 parent a159c50 commit 552c2c5

5 files changed

Lines changed: 97 additions & 2 deletions

File tree

docs/community/translations/i18n.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
!!! tip "Quick how-to"
44

5-
For a short, end-to-end how-to of the new `invenio-i18n` CLI workflow, see [i18n CLI quick how-to](./i18n-cli.md).
5+
For a short, end-to-end how-to of the new `invenio-i18n` CLI workflow, see [i18n CLI quick how-to](./i18n-cli.md).
66

77
## Marking strings for translation
88

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# File modification
2+
3+
_Introduced in vNext_
4+
5+
Admins can now modify the files of all records on their instance by default and, with configuration, you can also allow users to edit their own published records within a certain time period.
6+
7+
## Disable
8+
9+
If you would like to disable file modification for all users including admins, add the following to your `invenio.cfg`.
10+
11+
```
12+
RDM_IMMEDIATE_FILE_MODIFICATION_ENABLED = False
13+
```
14+
15+
## User file modification
16+
17+
By default, only admins can modify files. To enable file modification for users, you need to add a relevant policy. Out of the box there is a time-based policy which you can use to allow users to edit their records within a certain period (by default this is 30 days). To enable this, add the following to your config:
18+
19+
```python
20+
from invenio_rdm_records.services.request_policies import (
21+
FileModificationGracePeriodPolicy,
22+
FileModificationAdminPolicy,
23+
)
24+
RDM_IMMEDIATE_FILE_MODIFICATION_POLICIES = [
25+
FileModificationGracePeriodPolicy(),
26+
FileModificationAdminPolicy(),
27+
]
28+
```
29+
30+
To use a custom grace period, pass a custom timedelta like `FileModificationGracePeriodPolicy(grace_period=timedelta(days=7)))` here instead. And if you remove the admin policy then only users will able to edit files of records.
31+
32+
### Configure policies
33+
34+
Using the default grace periods, here is how file modification works from a user perspective:
35+
36+
1. I create a draft, I have an unlimited time to edit the files before publishing
37+
2. After publishing, I have 30 days from publication to edit the files
38+
* The time to unlock the files is configured via passing a custom timedelta to the policy, e.g. `FileModificationGracePeriodPolicy(timedelta(days=30))`
39+
3. After editing the files, I have 45 days from publication to upload my files and publish my changes
40+
* The time in which to publish the changes, which should be greater than the grace period, is configured in your config via `RDM_FILE_MODIFICATION_PERIOD = timedelta(days=30 + 15)`
41+
42+
The second time period of 45 days is to prevent people from editing the files, and leaving the files editable for an unknown date in the future.
43+
44+
!!! info
45+
46+
Short time periods are recommended for the file modification period as there is a risk of users treating records as file storage, and not respecting that a DOI has been minted for this digital object.
47+
48+
## Configure out of policy messages
49+
50+
Unlike [record deletion](record_deletion.md) in which users outside of policy can "request" deletion, users are **not** similarly allowed to request file modification when they are outside of policy. Instead this request should be made via established channels relevant for your instance (whether by email, in person communication, official support ticket, etc) or you should communicate that no concessions will be made (and if they have an unpublishable draft it should be discarded). If you would like to satisfy the users request, you can unlock the record for them (in the same way they would) and then publish for them once they have made the changes.
51+
52+
There are two messages which should be customized based upon how your instance handles support.
53+
54+
First, the user facing message when they try to unlock the files outside of policy is a React component that should be [overridden](../customize/look-and-feel/override_components.md) using your `mapping.js`. For example,
55+
56+
```js
57+
import { ModalContent } from "semantic-ui-react";
58+
const ModificationMessage = () => {
59+
return (
60+
<ModalContent>
61+
<p>
62+
{i18next.t(
63+
"Please contact us to request file modification, including the" +
64+
" record URL and a detailed justification in your message."
65+
)}
66+
</p>
67+
</ModalContent>
68+
);
69+
};
70+
71+
export const overriddenComponents = {
72+
"InvenioAppRdm.Deposit.ModificationModal.message": ModificationMessage,
73+
};
74+
```
75+
76+
Second, the message which is returned to the user when they have run out of time to publish can be overriden via changing the [translation](../../community/translations/i18n.md). The default message is:
77+
78+
> "File modification grace period has passed. Please discard this draft to make any changes."
1.14 MB
Loading

docs/releases/vNext/version-vNext.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,28 @@ and digital assets management! Version Next will be maintained until at least 6
1919

2020
### Record deletion
2121

22-
You can now allow users to delete, or request deletion of, their own records in accordance with any required criteria you may have. When enabled the default behaviour is that records can be deleted by their owners within 30 days of publication and record owners can request deletion outside this period. Deletion requests are visible within the admin panel and the user's request dashboard.
22+
You can now allow users to delete, or request deletion of, their own records in accordance with any required criteria you may have. When enabled, the default behaviour is that records can be deleted by their owners within 30 days of publication and record owners can request deletion outside this period. Deletion requests are visible within the admin panel and the user's request dashboard.
2323

2424
![Modal to immediately delete a record](imgs/deletion-modal.png)
2525

2626
This feature is also [highly customisable](../../operate/customize/record_deletion.md)! You can introduce deletion policies based on the resource type, community role, file type or any other criteria you require. Additionally, you can prevent extraneous record deletion by adding a deletion checklist. This allows you to suggest how the user can fix the problem in the correct way instead of deleting the record.
2727

28+
### File modification
29+
30+
Admins can now edit the files of all records by default. To do so, simply edit the record and then unlock the files by completing the "Edit published files" modal. The files are then unlocked for you (or anyone with manage permissions) to add, remove or exchange files. Finally the draft can be published by an admin.
31+
32+
![Showing the flow to edit the files of a record](imgs/file-modification.png)
33+
34+
If you would like to disable file modification for all users including admins, add the following to your `invenio.cfg`.
35+
36+
```
37+
RDM_IMMEDIATE_FILE_MODIFICATION_ENABLED = False
38+
```
39+
40+
#### User file modification
41+
42+
Additionally in a similar way to the new record deletion feature, you can also allow users to modify the files of published records in line with your defined policies. By adding the relevant policy, the files can be unlocked by the owner of the record within 30 days and the edits published within 45 days (giving them at least 15 days to upload and publish their changes). See the [relevant documentation](../../operate/customize/file_modification.md) to see how to enable this behaviour.
43+
2844
#### New Web Archive previewer
2945

3046
https://github.com/inveniosoftware/invenio-previewer/pull/224

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ nav:
118118
- Submission: "operate/customize/emails.md"
119119
- Capture: operate/customize/dev_email.md
120120
- FAIR Signposting: "operate/customize/FAIR-signposting.md"
121+
- File modification: "operate/customize/file_modification.md"
121122
- File uploads & storage:
122123
- Files and versioning: "operate/customize/file-uploads/files-and-versioning.md"
123124
- Files uploaders: "operate/customize/file-uploads/uploader.md"

0 commit comments

Comments
 (0)