Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-67975

Nextcloud integration should allow the use of aliases to files in repository

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_38_STABLE, MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE, MOODLE_311_STABLE
    • Pull from Repository:
    • Pull 3.10 Branch:
      MDL-67975-310
    • Pull 3.11 Branch:
      MDL-67975-311
    • Pull Master Branch:
      MDL-67975-master
    • Testing Instructions:
      Hide

      Prerequisite for testing

      1. Docker

      2. ngrok
      For instance, use this ngrok for nextcloud:

      ngrok http --region=in 8081

       

      Setup Nextcloud instance

      1. Using docker (make sure docker is installed in your machine), run the command below:

      docker run -d -p 8081:80 nextcloud
      

      You should get the latest version of nextcloud installed on your machine. Access it using say, http://localhost:8081 (note the port used its 8081, you may use whatever port available in your machine, but make sure to change it first in the docker command)

      2. Create the admin user and login to the nextcloud instance.

      3. Now access the config/config.php file of your Nextcloud instance from the terminal using:

      docker exec -it <CONTAINER ID>  bash
      

        Where ID is the container ID of your Nextcloud instance( you may get it from 'docker ps'  command)

        After this open config/config.php

      4. Update the 'trusted_domains' array and add the url to the nextcloud instance generated by ngrok (ex. '23ba1b00d3fa.in.ngrok.io'):

      array (
         0 => 23ba1b00d3fa.in.ngrok.io
      )

      5.  Update the 'overwrite.cli.url' with:

      'overwrite.cli.url' => 'http://23ba1b00d3fa.in.ngrok.io'
      

      6. Save the changes in the config.php and access the nextcloud instance in the browser (ex. https://23ba1b00d3fa.in.ngrok.io)

      7. Navigate to Settings -> Security page

      8. Under OAuth 2.0 clients fill up the details like:
            a) Name: Moodle
            b) Redirection URI: http://localhost/m/pg_stable_master/admin/oauth2callback.php
            The redirection URL is your moodle URL + admin/oauth2callback.php

      9. Click on "Add" button, which would generate Client Identifier a Secret. Copy both values which are required in future steps.

      10. Create a teacher user
          username: t1
          password: test
          Create a student user
           username: s1
           password: test

       

      Configure Moodle instance

      1. Log in to moodle as admin.

      2. Navigate to Site Administration -> Server -> OAuth 2 services

      3. In the "Create new service" section select Nextcloud.

      4. Now fill the Client ID (copy it from step 4 of Nextcloud setup instance)

      5. Fill the Client secret (copy it from step 4 of Nextcloud setup instance)

      6. Fill in the "Service base URL". This has to be https address. Kindly refer to the ngrok https address which you executed in the prerequisite section. Use the https URL in "Service base URL".

      7. Click on the button "Save changes"

      8. Click on "System account connected" section of Nextcloud. And login as an admin account of Nextcloud.

      9. Navigate to: Site administration -> Plugins -> Repositories -> Manage repositories

      10. Select Nextcloud as "Enabled and visible".

      11. Click on the "Settings" link right next to "Enable and visible" option.

      12. Click the button "Create a repository instance".

      13. Give a name to your repo: Nextcloud repo
             Select issuer as Nextcloud

             Supported files and Default return types as default.

       

      Start testing

      1. Create a course and enroll a teacher and student. Make sure you have logged out of the Nextcloud instance from your browser.

      2. Login as a teacher and navigate to "Private files".

      3. You should see Nextcloud repo. Login as a teacher instance in Nextcloud. Remember to have same username for the teacher in Nextcloud and Moodle.

      4. Now click on a file from Nextcloud repo

      5. User should see a pop-up with 3 different options.

      • verify that "Link to the file" is in these options.

      6. Select the option "Link to the file".

      • verify that you can see a warning message: "Warning: This file would become public."

      8. Click on "Select this file" button.

      9. The file should be successfully added to the Private files area.

      10. Download the file from the Private files area.

      • verify that the file was succesfully downloaded
      • verify that the content of the downloaded file is the same as the original file in the nextcloud instance.

      11. Go to the nextcloud instance and login as t1

      12. Locate the file that was previously added in the Private files area  and modify its content.

      13. Go back to the Moodle instance as t1.

      14. Navigate to 'Private files' and download the same file once again.

      • verify that the file was succesfully downloaded
      • verify that the content of the downloaded file is the same as the original file in the nextcloud instance (has the recent modifications).
      Show
      Prerequisite for testing 1. Docker 2. ngrok For instance, use this ngrok for nextcloud: ngrok http --region=in 8081   Setup Nextcloud instance 1. Using docker (make sure docker is installed in your machine), run the command below: docker run -d -p 8081 : 80 nextcloud You should get the latest version of nextcloud installed on your machine. Access it using say, http://localhost:8081 (note the port used its 8081, you may use whatever port available in your machine, but make sure to change it first in the docker command) 2. Create the admin user and login to the nextcloud instance. 3. Now access the config/config.php file of your Nextcloud instance from the terminal using: docker exec -it <CONTAINER ID>  bash   Where ID is the container ID of your Nextcloud instance( you may get it from 'docker ps'  command)   After this open config/config.php 4. Update the 'trusted_domains' array and add the url to the nextcloud instance generated by ngrok (ex. '23ba1b00d3fa.in.ngrok.io'): array ( 0 => 23ba1b00d3fa.in.ngrok.io ) 5.  Update the 'overwrite.cli.url' with: 'overwrite.cli.url' => 'http://23ba1b00d3fa.in.ngrok.io' 6. Save the changes in the config.php and access the nextcloud instance in the browser (ex. https://23ba1b00d3fa.in.ngrok.io ) 7. Navigate to Settings -> Security page 8. Under OAuth 2.0 clients fill up the details like:       a) Name: Moodle       b) Redirection URI: http://localhost/m/pg_stable_master/admin/oauth2callback.php       The redirection URL is your moodle URL + admin/oauth2callback.php 9. Click on "Add" button, which would generate Client Identifier a Secret. Copy both values which are required in future steps. 10. Create a teacher user     username: t1     password: test     Create a student user      username: s1      password: test   Configure Moodle instance 1. Log in to moodle as admin. 2. Navigate to Site Administration -> Server -> OAuth 2 services 3. In the "Create new service" section select Nextcloud. 4. Now fill the Client ID (copy it from step 4 of Nextcloud setup instance) 5. Fill the Client secret (copy it from step 4 of Nextcloud setup instance) 6. Fill in the "Service base URL". This has to be https address. Kindly refer to the ngrok https address which you executed in the prerequisite section. Use the https URL in "Service base URL". 7. Click on the button "Save changes" 8. Click on "System account connected" section of Nextcloud. And login as an admin account of Nextcloud. 9. Navigate to: Site administration -> Plugins -> Repositories -> Manage repositories 10. Select Nextcloud as "Enabled and visible". 11. Click on the "Settings" link right next to "Enable and visible" option. 12. Click the button "Create a repository instance". 13. Give a name to your repo: Nextcloud repo        Select issuer as Nextcloud        Supported files and Default return types as default.   Start testing 1. Create a course and enroll a teacher and student. Make sure you have logged out of the Nextcloud instance from your browser. 2. Login as a teacher and navigate to "Private files". 3. You should see Nextcloud repo. Login as a teacher instance in Nextcloud. Remember to have same username for the teacher in Nextcloud and Moodle. 4. Now click on a file from Nextcloud repo 5. User should see a pop-up with 3 different options. verify that "Link to the file" is in these options. 6. Select the option "Link to the file". verify that you can see a warning message: " Warning: This file would become public." 8. Click on "Select this file" button. 9. The file should be successfully added to the Private files area. 10. Download the file from the Private files area. verify that the file was succesfully downloaded verify that the content of the downloaded file is the same as the original file in the nextcloud instance. 11. Go to the nextcloud instance and login as t1 12. Locate the file that was previously added in the Private files area  and modify its content. 13. Go back to the Moodle instance as t1. 14. Navigate to 'Private files' and download the same file once again. verify that the file was succesfully downloaded verify that the content of the downloaded file is the same as the original file in the nextcloud instance (has the recent modifications).
    • Story Points:
      1
    • Sprint:
      4.0 Navigation blitz 3, QA blitz, QA blitz 3

      Description

      The Next Cloud plugin offers the ability to link to the Next Cloud File repository. It allows a Teacher, for example, to add resources from the cloud storage, or it allows a student to submit an assignment using the "Access Controlled" function.

      However, the NextCloud Plugin does not replace the plugin produced by The University of Münster. This plugin offers an additional feature: the ability to create an alias link to the file.

      The alias feature effectively means that when the file is updated locally on the users PC, the file is automatically updated on Moodle via OwnCloud.

      It would therefore be advisable that Moodle stop trying to Automatically update, or Migrate the OwnCloud plugin to NextCloud since we loose this alias functionality.

      The screen shots below show the OwnCloud plugin with the alias option versus the NextCloud Plugin minus this option. The first two screenshots are Owncloud, the third, the one on the far right, is the nextcloud version.

      By the way, I'm sorry, but I could not find an appropriate component to assign this to, perhaps someone has some better thoughts on the matter.

      Either way, it would be great if this could be fixed since it irritates me that everytime I upgrade Moodle, it tries to Migrate the Owncloud repoistory to using the Nextcloud version, and I have then go back in an reasign everything.

      I have also added this to the MUA group in the hope that funding can be found to resolve this issue.

      Just for the record here:

      Münster University who first developed this plugin with the dynamic linking option have a GIT repository with the code here: https://github.com/learnweb/moodle-repository_owncloud

      And the Plugins home on Moodle is here: https://moodle.org/plugins/repository_owncloud

      The main problem I am having is that it seems that once Moodle migrates the the OwnCloud Plugin to the NextCloud Plugin, no amount of trying to reinstall the original OwnCloud Plugin will bring back the functionality of the original version. This is highly frustrating to say the least. You also loose any data that you had linked.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sujith Sujith Haridasan
              Reporter:
              paulraper Paul Raper
              Peer reviewer:
              Mihail Geshoski Mihail Geshoski
              Integrator:
              Adrian Greeve Adrian Greeve
              Tester:
              Carlos Escobedo Carlos Escobedo
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              7 Vote for this issue
              Watchers:
              18 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/Jul/21

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 3 hours, 40 minutes
                  1d 3h 40m