Content
View differences
Updated by Marc Alcobé almost 4 years ago
### Use cases:
* Create a link between a work package and an existing file in Nextcloud.
* Clicking a button in the "Files" tab will show a file picker with the Nextcloud file structure for that user (Keep in mind that every Nextcloud user has a different file structure)
* To achieve this, the current OpenProject user will need to request authorization from Nextcloud via OAuth, so that OpenProject consequently can make personalized API requests to Nextcloud.
* Upload a file from within a work package in OpenProject
* Chose a location in Nextcloud via a _location picker_
* Save the file in Nextcloud
* Create a _file link_ between the work package
* **Out of scope:** Upload of entire directories, as normal Form uploads do not allow this. So only the upload of individual files will be supported in the first version.
* Delete _file links_ from a work package (without deleting it in Nextcloud).
### Implementation chunks:
* File picker for selecting link targets (files and directories). Queries Nextcloud with the user's access token (probably via WebDAV). Tunneled through OpenProject backend.
* Location picker for upload targets (a target is always a directory). Queries Nextcloud with the user's access token (probably via WebDAV). Tunneled through OpenProject backend.
* If possible, direct upload of files to Nextcloud without tunneling through OpenProject server. This requires some sort of one-time upload tokens, which can get exposed to the OpenProject frontend. Fallback could be tunneling all uploaded files through OpenProject.
* Remove file links from OpenProject when files get deleted in Nextcloud (either some sort of callback triggered by Nextcloud or through polling when user opens the _Files_ tab).
### Implementation decisions:
* The file name we present in OpenProject is the name of the file that the file's owner sees. Apparently in Nextcloud a file can have multiple names and paths every time a file gets shared. To have a "canonical" name for all OpenProject users we will always show the file name that the file's owner sees.
* OpenProject updates the "cached" file name in OpenProject when a user open the _Files_ tab.
### Out of scope:
* Syncing of access rights to the files in Nextcloud according to the roles and privileges of members in a OpenProject project. That will get partly tackled later with shared project folders (<mention class="mention" data-id="41400" data-type="work_package" data-text="#41400">#41400</mention>)
* Linking between a OpenProject project (instead of work packages) and files in Nextcloud. That is feasible and intended to built in a later stage. The outlook could be a possible replacement for the current "Documents" module.
### Wire frames (to sketch the idea. Not final design)
Listing attachments and file links in a separate :work package tab
<figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/29264/content"></div></figure>
Linked file's meta data
<figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/29263/content"></div></figure>
Uploading files via drag'n drop (early concept sketch)
<figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/29265/content"></div></figure>
File picker
<figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/29266/content"></div></figure>
* Create a link between a work package and an existing file in Nextcloud.
* Clicking a button in the "Files" tab will show a file picker with the Nextcloud file structure for that user (Keep in mind that every Nextcloud user has a different file structure)
* To achieve this, the current OpenProject user will need to request authorization from Nextcloud via OAuth, so that OpenProject consequently can make personalized API requests to Nextcloud.
* Upload a file from within a work package in OpenProject
* Chose a location in Nextcloud via a _location picker_
* Save the file in Nextcloud
* Create a _file link_ between the work package
* **Out of scope:** Upload of entire directories, as normal Form uploads do not allow this. So only the upload of individual files will be supported in the first version.
* Delete _file links_ from a work package (without deleting it in Nextcloud).
### Implementation chunks:
* File picker for selecting link targets (files and directories). Queries Nextcloud with the user's access token (probably via WebDAV). Tunneled through OpenProject backend.
* Location picker for upload targets (a target is always a directory). Queries Nextcloud with the user's access token (probably via WebDAV). Tunneled through OpenProject backend.
* If possible, direct upload of files to Nextcloud without tunneling through OpenProject server. This requires some sort of one-time upload tokens, which can get exposed to the OpenProject frontend. Fallback could be tunneling all uploaded files through OpenProject.
* Remove file links from OpenProject when files get deleted in Nextcloud (either some sort of callback triggered by Nextcloud or through polling when user opens the _Files_ tab).
### Implementation decisions:
* The file name we present in OpenProject is the name of the file that the file's owner sees. Apparently in Nextcloud a file can have multiple names and paths every time a file gets shared. To have a "canonical" name for all OpenProject users we will always show the file name that the file's owner sees.
* OpenProject updates the "cached" file name in OpenProject when a user open the _Files_ tab.
### Out of scope:
* Syncing of access rights to the files in Nextcloud according to the roles and privileges of members in a OpenProject project. That will get partly tackled later with shared project folders (<mention class="mention" data-id="41400" data-type="work_package" data-text="#41400">#41400</mention>)
* Linking between a OpenProject project (instead of work packages) and files in Nextcloud. That is feasible and intended to built in a later stage. The outlook could be a possible replacement for the current "Documents" module.
### Wire frames (to sketch the idea. Not final design)
Listing attachments and file links in a separate :work package tab
<figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/29264/content"></div></figure>
Linked file's meta data
<figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/29263/content"></div></figure>
Uploading files via drag'n drop (early concept sketch)
<figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/29265/content"></div></figure>
File picker
<figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/29266/content"></div></figure>