Content
View differences
Updated by Dominic Bräunlein over 2 years ago
**As** an OpenProject user
**I want to** see file links of a work package even when the corresponding file got deleted
**so that** I can take steps to recover the file or remove the file link manually.
**Acceptance criteria**
* When a linked file got deleted on **Nextcloud**, the corresponding file links are visible in the files tab but disabled and with a message showing on hover **"The file cannot be found."** got deleted"**
* When a linked file got deleted on **OneDrive/SharePoint**, the corresponding file links are visible in the files tab but disabled and with a message showing on hover **"The file cannot be found."** got deleted or you have no permission to see it"**
* When a user looses read permissions to a linked file on **OneDrive/SharePoint**, the corresponding file links are visible in the files tab but disabled and with a message showing on hover **"The file cannot be found."**
* A user with file link managing rights can delete a file link, even when the file link got deleted or you have no permission to see it"**
**Note: The UI copy is in a disabled state not finalised**
**\---**
###
### Problem and background
Currently, file links get deleted when the target file got moved to the trash bin or deleted permanently.
This behaviour can have a negative impact for the user in case the file got deleted accidentally.
The file links would need to be recreated in all linked work packages after restoring the deleted file from the trash bin.
The current behaviour is even more problematic in SharePoint/OneDrive where we don't differentiate between deleted files and files a user lost permissions to. If a user looses permission to a file and opens the Files tab the file links will be deleted.
### Current workflow in detail
1. A file in a storage is linked to a work package
2. The file in the storage gets deleted
3. User opens the **Files** tab in OpenProject
4. File links that are saved in OpenProject are loaded
5. The currently saved file information gets updated (e.g. to update last modified date)
6. To accomplish the update a request to the file storage in the user context is made
7. Through this request we also get the information when a file got deleted
8. When a file got deleted the file link in OpenProject gets deleted too
###
###
### Solutions
#### User lost permissions to a file
##### Nextcloud
For Nextcloud storages we disable the file link and show information that the user has no permission.
<img class="op-uc-image op-uc-image_inline" style="width:232px;" src="/api/v3/attachments/84730/content">
This is the desired behaviour and no further changes are needed.
##### OneDrive/SharePoint
Currently for OneDrive/SharePoint storages the file links would be deleted when a user accesses the file tabs and has no access to the file.
With the new changes we want the same behaviour as we have currently in Nextcloud. We disable the file link and show information that the user has no permission.
There is a difference in the shown message, as in OneDrive/SharePoint we can not tell the difference of deleted files or files with missing permissions:
**"The file got deleted or you have no permission to see it."**
#### File got deleted (permanently or in trash)
Currently the file link gets deleted when the file is deleted for all storage types.
##### Nextcloud
With the new changes the file link should be disabled and the user should be informed that the file link can't be found. The user is able to delete the file link.
**"The file got deleted"**
##### OneDrive/SharePoint
With the new changes the file link should be disabled and the user should be informed that the file link can't be found. The user is able to delete the file link.
**"The file got deleted or you have no permission to see it."**
###
### **UI changes summary**
From a **UI perspective,** file links to OneDrive/SharePoint will have one additional state:
**"The file got deleted or you have no permission to see it."**
And file links to Nextcloud will have additionally:
"**The file got deleted"**
**I want to** see file links of a work package even when the corresponding file got deleted
**so that** I can take steps to recover the file or remove the file link manually.
**Acceptance criteria**
* When a linked file got deleted on **Nextcloud**, the corresponding file links are visible in the files tab but disabled and with a message showing on hover **"The file cannot be found."**
* When a linked file got deleted on **OneDrive/SharePoint**, the corresponding file links are visible in the files tab but disabled and with a message showing on hover **"The file cannot be found."**
* When a user looses read permissions to a linked file on **OneDrive/SharePoint**, the corresponding file links are visible in the files tab but disabled and with a message showing on hover **"The file cannot be found."**
* A user with file link managing rights can delete a file link, even when the file link
**Note: The UI copy
**\---**
###
### Problem and background
Currently, file links get deleted when the target file got moved to the trash bin or deleted permanently.
This behaviour can have a negative impact for the user in case the file got deleted accidentally.
The file links would need to be recreated in all linked work packages after restoring the deleted file from the trash bin.
The current behaviour is even more problematic in SharePoint/OneDrive where we don't differentiate between deleted files and files a user lost permissions to. If a user looses permission to a file and opens the Files tab the file links will be deleted.
### Current workflow in detail
1. A file in a storage is linked to a work package
2. The file in the storage gets deleted
3. User opens the **Files** tab in OpenProject
4. File links that are saved in OpenProject are loaded
5. The currently saved file information gets updated (e.g. to update last modified date)
6. To accomplish the update a request to the file storage in the user context is made
7. Through this request we also get the information when a file got deleted
8. When a file got deleted the file link in OpenProject gets deleted too
###
###
### Solutions
#### User lost permissions to a file
##### Nextcloud
For Nextcloud storages we disable the file link and show information that the user has no permission.
<img class="op-uc-image op-uc-image_inline" style="width:232px;" src="/api/v3/attachments/84730/content">
This is the desired behaviour and no further changes are needed.
##### OneDrive/SharePoint
Currently for OneDrive/SharePoint storages the file links would be deleted when a user accesses the file tabs and has no access to the file.
With the new changes we want the same behaviour as we have currently in Nextcloud. We disable the file link and show information that the user has no permission.
There is a difference in the shown message, as in OneDrive/SharePoint we can not tell the difference of deleted files or files with missing permissions:
**"The file got deleted or you have no permission to see it."**
#### File got deleted (permanently or in trash)
Currently the file link gets deleted when the file is deleted for all storage types.
##### Nextcloud
With the new changes the file link should be disabled and the user should be informed that the file link can't be found. The user is able to delete the file link.
**"The file got deleted"**
##### OneDrive/SharePoint
With the new changes the file link should be disabled and the user should be informed that the file link can't be found. The user is able to delete the file link.
**"The file got deleted or you have no permission to see it."**
###
### **UI changes summary**
From a **UI perspective,** file links to OneDrive/SharePoint will have one additional state:
**"The file got deleted or you have no permission to see it."**
And file links to Nextcloud will have additionally:
"**The file got deleted"**