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

Create Nextcloud integration, similar to G-Suite and Office

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      A. Create old issuer types using the preconfigured issuers and verify that the resulting configuration is identical to before.

      (This is the only part that needs a "before" installation and an "after" installation! Perform all steps in both. You don't need to register with those services first, we are not going to open real connections.)

      1. Go to Site administration > Server > OAuth 2 services.
      2. Click "Create new Google service", enter some nonempty value for Client ID and Secret (do not need to be real!) and click "Save changes".
      3. For the new issuer, click on "Configure endpoints".
      4. Compare that the endpoints are the same in the "before" installation and the "after" installation.
      5. Go back to the list of issuers. For the new issuer, click on "Configure user field mappings".
      6. Compare that the user field mappings are the same in the "before" installation and the "after" installation.
      7. Repeat for Microsoft, Facebook.

      B. Create a Nextcloud issuer using the preconfigured issuer type.

      1. Get a Nextcloud instant demo for testing: https://demo.nextcloud.com/ (this will just take a minute and the instance will remain online for approx. 60 min).
      2. Log in to Nextcloud (username: admin, password: admin).
      3. In the settings menu (cog in the top-right corner), click on "Settings".
      4. On the left, click on "Security" in the "Administration" menu (second occurrence in the menu).
      5. Add a client. Name: Moodle, Redirection URI: <Moodle wwwroot>/admin/oauth2callback.php – does not need to be reachable for Nextcloud, but must match the URL that you use in the browser.
      6. Jot down client ID and secret.
      7. In Moodle, go to Site administration > Server > OAuth 2 services.
      8. Click "Create new Nextcloud service".
      9. Enter Client ID and Secret. Enter the base URL https://demo.nextcloud.com/<your instance id>/. Click "save changes".
      10. For the new issuer, click on "Configure endpoints" and check that there are some entries.
      11. Go back to the list of issuers. For the new issuer, click on "Configure user field mappings" and check that there are some entries.

      C. Connect a Nextcloud system account.

      1. Go to Site administration > Server > OAuth 2 services.
      2. Click "Connect to a system account". Confirm at Moodle and at Nextcloud. If prompted in Nextcloud, enter admin as username and password.
      3. After you are redirected back to Moodle, check that the username admin appears in the system account column.

      D. Create a repository instance.

      1. Go to Site administration > Plugins > Repositories > Manage repositories.
      2. Open the dropdown for "Nextcloud" and select "Enabled and visible".
      3. Go to the "Nextcloud" line and click "Settings".
      4. Click "Create a repository instance".
      5. Enter a name and choose the issuer that you configured previously. Click "Save".

      E. Connect to the repository as a user and upload a file.

      1. Log in to Nextcloud as admin.
      2. In the settings menu (cog in the top-right corner), click on "Users". Create a user with an arbitrary password. Log out and log in as that user.
      3. Go to Moodle and open a course. Add a file resource.
      4. At "select files", open the file picker and choose the Nextcloud repository that you have just created.
      5. Click "Log in to your account" and authorise Moodle to connect to Nextcloud. If prompted, log in with the user you have just created.
      6. Select "Nextcloud.mp4". In the dialog modal that opens, select "Make a copy of the file".
      7. Save the file and the resource. Go to the course and check that you can download the file.

      F. Create an access controlled link.

      1. Go to Moodle and open a course. Add a file resource.
      2. At "select files", open the file picker and choose the Nextcloud repository that you have just created.
      3. Click "Log in to your account" and authorise Moodle to connect to Nextcloud. If prompted, log in with the user you have just created.
      4. Select "Nextcloud Manual.pdf". In the dialog modal that opens, select "Create an access controlled link to the file".
      5. Save the file and the resource. Go to the course and check that you can download the file.
      6. Go to Nextcloud and login as the user that you have created before. Go to the folder "Moodlefiles" and check that there is a file "Nextcloud Manual.pdf" that has been shared with you (the "Nextcloud Manual.pdf" in the root directory does not count!)
      7. Log out from Nextcloud. Log back in as admin.
      8. Check the folder structure created by Moodle. It should be something along the lines of "System (<shortname>)/Category <x> (id <y>)/Course <z> (id <a>)/File <b> (id <c>)/mod_resource/content/0/" and the PDF file must be inside.
      Show
      A. Create old issuer types using the preconfigured issuers and verify that the resulting configuration is identical to before. (This is the only part that needs a "before" installation and an "after" installation! Perform all steps in both. You don't need to register with those services first, we are not going to open real connections.) Go to Site administration > Server > OAuth 2 services . Click "Create new Google service", enter some nonempty value for Client ID and Secret (do not need to be real!) and click "Save changes". For the new issuer, click on "Configure endpoints". Compare that the endpoints are the same in the "before" installation and the "after" installation. Go back to the list of issuers. For the new issuer, click on "Configure user field mappings". Compare that the user field mappings are the same in the "before" installation and the "after" installation. Repeat for Microsoft, Facebook. B. Create a Nextcloud issuer using the preconfigured issuer type. Get a Nextcloud instant demo for testing: https://demo.nextcloud.com/ (this will just take a minute and the instance will remain online for approx. 60 min). Log in to Nextcloud (username: admin , password: admin ). In the settings menu (cog in the top-right corner), click on "Settings". On the left, click on "Security" in the "Administration" menu (second occurrence in the menu). Add a client. Name: Moodle , Redirection URI: <Moodle wwwroot>/admin/oauth2callback.php – does not need to be reachable for Nextcloud, but must match the URL that you use in the browser. Jot down client ID and secret. In Moodle, go to Site administration > Server > OAuth 2 services . Click "Create new Nextcloud service". Enter Client ID and Secret. Enter the base URL https://demo.nextcloud.com/ <your instance id>/ . Click "save changes". For the new issuer, click on "Configure endpoints" and check that there are some entries. Go back to the list of issuers. For the new issuer, click on "Configure user field mappings" and check that there are some entries. C. Connect a Nextcloud system account. Go to Site administration > Server > OAuth 2 services . Click "Connect to a system account". Confirm at Moodle and at Nextcloud. If prompted in Nextcloud, enter admin as username and password. After you are redirected back to Moodle, check that the username admin appears in the system account column. D. Create a repository instance. Go to Site administration > Plugins > Repositories > Manage repositories . Open the dropdown for "Nextcloud" and select "Enabled and visible". Go to the "Nextcloud" line and click "Settings". Click "Create a repository instance". Enter a name and choose the issuer that you configured previously. Click "Save". E. Connect to the repository as a user and upload a file. Log in to Nextcloud as admin . In the settings menu (cog in the top-right corner), click on "Users". Create a user with an arbitrary password. Log out and log in as that user. Go to Moodle and open a course. Add a file resource. At "select files", open the file picker and choose the Nextcloud repository that you have just created. Click "Log in to your account" and authorise Moodle to connect to Nextcloud. If prompted, log in with the user you have just created. Select "Nextcloud.mp4". In the dialog modal that opens, select "Make a copy of the file". Save the file and the resource. Go to the course and check that you can download the file. F. Create an access controlled link. Go to Moodle and open a course. Add a file resource. At "select files", open the file picker and choose the Nextcloud repository that you have just created. Click "Log in to your account" and authorise Moodle to connect to Nextcloud. If prompted, log in with the user you have just created. Select "Nextcloud Manual.pdf". In the dialog modal that opens, select "Create an access controlled link to the file". Save the file and the resource. Go to the course and check that you can download the file. Go to Nextcloud and login as the user that you have created before. Go to the folder "Moodlefiles" and check that there is a file "Nextcloud Manual.pdf" that has been shared with you (the "Nextcloud Manual.pdf" in the root directory does not count!) Log out from Nextcloud. Log back in as admin . Check the folder structure created by Moodle. It should be something along the lines of "System (<shortname>)/Category <x> (id <y>)/Course <z> (id <a>)/File <b> (id <c>)/mod_resource/content/0/" and the PDF file must be inside.
    • Affected Branches:
      MOODLE_33_STABLE, MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull Master Branch:
      nextcloud-in-moodle

      Description

      In 3.3 we've added Oauth2 and file integrations for Google G-Suite and MS Office365.

      I want to see us supporting the open source community equally as well (and probably better!)

      NextCloud (formerly OwnCloud) is the best one I know, let's do this!   https://nextcloud.com 

       

      (I linked this to the NextCloud forums https://help.nextcloud.com/t/official-moodle-nextcloud-integration/12585)

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                31 Vote for this issue
                Watchers:
                32 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Dec/18