* Research the group folder feature of Nextcloud, its usage and limitations. limitations
## Acceptance criteria
On installation or migration the following logic should be applied: applied
* Check if the installation is "blank" so that we can safely create the missing user, group and group folder.
* Also check if the installation was already complete as it could be that user, group and group folder already correctly exist from an earlier installation. If there is everything in place and correctly setup then reuse the existing ones. The combination of group folder, group user and user is so unique that I believe that it is safe to assume that these objects are there from an earlier installation.
* If any of the objects exists, but the setup appears incomplete, don't proceed in creating them. Instead show an error message explaining that there cannot be a user, group and group folder with the name "OpenProject". The user should either fix the setup manually if she wants to reuse them or rename them.
* In case the it is "blank" then
* Create the group "OpenProject"
* Create the user "OpenProject" and make it group admin of "OpenProject" so that it can manage its group memberships.
* Create the group folder "OpenProject" and bind it to group "OpenProject". Make the user "OpenProject" have "advanced permissions" to manage access control lists for files and folders.
* Generate an app password for the "OpenProject" user and show it to the Nextcloud admin.
* In order to allow this automation, an extra step of both Nextcloud and OpenProject setup will be added in order to select if the users want the "Automatically managed folders" active or not. Because of that the button value of **step 3** also changes to "Yes, I have copied these values" **(**[**visuals**](https://community.openproject.org/#previous-step-step-3)**).** (see visuals) * The switch on In case the step 4 is by default active.
* Two flows are possible from a UX perspective in the Nextcloud side:
* **Automatically managed folders active (**[**visuals**](https://community.openproject.org/#automatically-managed-folders-active)**):**
* In the step 4 the user keeps selects to use the switch called "Automatically "Automatic managed folders" active.
* The button "Setup OpenProject user, group and folder" which triggers the creation of all related elements needed to be able tu use this function. This button also saves the switch status.
* If all the checks and creations related to the button are successful a new step (#5) (number 5) will appear called "Project folders application connection" which will contain the input field with the application password that can be copied added to the OpenProject administration settings.
* There is a possibility that the button action triggers some errors which will be displayed between the explanation text and the button Nextcloud in red. The errors could be because of not having order to see the group folder app installed or because application password the name used for the group folder already exists. When this happens, the button text string should change admin need to "Retry setup OpenProject user, group and folder".
copy to OpenProject.
* Once all As the setup steps are successfully completed, these will be marked with a green tick in the overview of the setup.
* **Automatically managed folders inactive (**[**visuals**](https://community.openproject.org/#automatically-managed-folders-inactive)**):**
* In the step now 4 or 5 the user deactivate action on the switch "Automatically managed folders".
* The field inside button of the step 4 called OpenProject user, group and folder with and its explanation text are hidden.
* The button label should in this case be "Complete without project folders".
* If the user chose to not activate this option the last step will be marked with a "minus" icon and left grey in the overview of the setup. 3 also changes. (see visuals) * Editing the decision taken before hand will always be possible from both sides:
* **Replace application password (**[**visuals**](https://community.openproject.org/#replace-application-password)**):**
* The The user clicks on the button of "Replace application password" and access the new password that needs to should be copied able to deactivate the OpenProject administration settings.
* Can confirm the setup using the button bellow once the new password is copied.
* **From active to inactive (**[**visuals**](https://community.openproject.org/#from-active-to-inactive)**):**
* The users clicks on the button "Edit "Automatically managed project folders" and or reset this password once all the information about project folders process is displayed with the switch active and a button text saying "Keep current setup".
* The user deactivates the switch and the OpenProject user, group and folder with, its explanation text and the step 5 (Application password) are hidden.
* User can complete the deactivation by clicking the button "Complete without project folders".
* **From inactive to active (**[**visuals**](https://community.openproject.org/#from-inactive-to-active)**):**
* The users clicks on the button "Edit managed project folders" and the information about project folders is displayed with the switch active and a button text saying "Keep current setup".
* The user activates the switch and the OpenProject user, group and folder with, its explanation text are shown. Also the button updates its text to "Setup OpenProject user, group and folder".
* When the users click on the button the triggers, actions and possible errors specified in the on the **"Automatically managed folders active"** flow above are performed. completed. (see visual)