Skip to content

Commit 74640b1

Browse files
committed
WIP: feat: file modification
missing image, will force push
1 parent a9e4943 commit 74640b1

File tree

2 files changed

+93
-1
lines changed

2 files changed

+93
-1
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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+
To enable user file modification, there is a default time-based policy which allows users to edit their records within a certain period. 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+
### Configure policies
31+
32+
The time periods of the grace period policy are configured in two places, both in `invenio.cfg`:
33+
34+
First, the time to unlock the files is configured via passing a custom timedelta to the policy, e.g. `FileModificationGracePeriodPolicy(timedelta(days=30))`
35+
36+
Second, the time 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)`
37+
38+
!!! info
39+
40+
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.
41+
42+
## Configure out of policy messages
43+
44+
Unlike record deletion 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 bucket for them (in the same way they would) and then publish for them once they have made the changes.
45+
46+
There are two messages which should be customised based upon how your instance handles support.
47+
48+
First, the user facing message when they try to unlock the files outside of policy is a React compontent that should be overriden using your `mapping.js`. For example,
49+
50+
```js
51+
import { ModalContent } from "semantic-ui-react";
52+
const ModificationMessage = () => {
53+
return (
54+
<ModalContent>
55+
<p>
56+
{i18next.t(
57+
"Please contact us to request file modification, including the" +
58+
" record URL and a detailed justification in your message."
59+
)}
60+
</p>
61+
</ModalContent>
62+
);
63+
};
64+
65+
export const overriddenComponents = {
66+
"InvenioAppRdm.Deposit.ModificationModal.message": UpgradeLegacyRecordButton,
67+
};
68+
```
69+
70+
Second, the message which is returned to the user when they have run out of time is defined via your config:
71+
72+
```
73+
RDM_FILE_MODIFICATION_VALIDATION_ERROR_MESSAGE = _(
74+
"File modification grace period has passed. Please discard this draft to make any changes."
75+
)
76+
```

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 upload files and then the draft can be published by an admin.
31+
32+
![]()
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

0 commit comments

Comments
 (0)