Aaronw/Quick Mnet setup

From Mahara Wiki

< User:Aaronw

In working on the Mahara assignment submission plugin & Mahara assignment feedback plugin for Moodle, I've had to set up Mnet lots and lots of times. I've gotten pretty quick at it. Here is basically what you have to do to:

  1. Set up MNet roaming between a Moodle & Mahara site
  2. Set up the Mahara assignment plugin for Moodle

The outline version

Most of the steps are on the Moodle side.

  1. Moodle: Enable networking (Advanced Features)
  2. Mahara: Enable networking (Configure site -> Networking)
  3. Mahara: Set up an XML-RPC authentication instance that goes to your Moodle site
  4. Moodle: Create an MNet host for your Mahara site (Networking -> Manage Peers)
  5. Moodle: Tick all the services boxes for the Mnet host
  6. Moodle: Enable the Mnet authentication plugin
  7. Moodle: Allow the "Roam to a remote application via ment" permission for the "Authenticated Users" role
  8. Moodle: Create a student user
  9. Moodle: Create a course to put MNet content in
  10. Moodle: Add a "Network Servers" block to the course
  11. Moodle: Add an "Assignment" activity to the course, and add the "Mahara" submission type
  12. Moodle: Enrol the student in the course. Enrol yourself in the course as a teacher.

The detailed version

Throughout these instructions, I'll list relative links to some of the admin pages you'll need to access. If you're running through this process repeatedly, you may wish to make a list of this links, put your sitename in front of it, and use those as a shortcut to get to the necessary admin pages instead of navigating there through the menu.

There are also a couple of steps that can be configured via the config.php file, as noted.

In Mahara

0. Get a Mahara instance. For dev work this is often a clean install, or you can just configure an existing instance.

1. Log in as an admin. Go to "Administration" -> "Configure site" -> "Networking"

  • (aka /admin/site/networking.php )
  • Set "Enable networking" to "Yes"
  • (or in your Mahara config.php file, add $cfg->enablenetworking=1; and you can skip this step!)

In Moodle

0. Get a Moodle instance. Again, clean install or configure existing install. The admin options here assume you're using Moodle 2.6; in other versions some things may be labelled differently.

0.5. If you're testing the Mahara plugins for Moodle, then install those now. You may either install them by fetching them from git, or by using Moodle's facility to install them from the Moodle plugin database (Site administration -> Plugins -> Install plugins).

1. Log in as an admin. Go to "Site administration" -> "Advanced Features".

  • (aka /admin/settings.php?section=optionalsubsystems )
  • Set "Networking" to "On"
  • (or in your Moodle config.php file, add $CFG->mnet_dispatcher_mode = 'strict'; and you can skip this step!)

2. Go to "Site Administration" -> "Plugins" -> "Authentication" -> "Manage authentication"

  • (aka /admin/settings.php?section=manageauths )
  • Tick the eye icon to enable the "MNet authentication" plugin

3. Go to "Site Administration" -> "Users" -> "Permissions" -> "Define roles"

  • Tick the "edit" icon next to the "Authenticated user" role
  • (or go directly to admin/roles/define.php?action=edit&roleid=7)
  • Find the permission "Roam to a remote application via MNet" i.e. "moodle/site:mnetlogintoremote"
    • It's under the "System" permissions.
  • Tick "Allow" for this permission
  • Scroll to the bottom and click "Save changes"

4. Go to "Site administration" -> "Networking" -> "Manage Peers"

  • (aka /admin/mnet/peers.php )
  • Hostname: The URL to your Mahara site (doesn't have to end with a slash)
  • Application type: Mahara
  • Click "Save changes" or "Add host"

5. It should now load up a screen showing the public key of your Mahara site. If it doesn,t make sure that the web server your Moodle site is on has HTTP/HTTPS access to the web server your Mahara site is on, and vice versa.

  • If it does show the public key, click "Save changes"

6. The page will reload, still showing the public key. You should now have some tabs on the top that say "Review host details", "Services", and "Profile fields"

  • Go to the "Services" tab and tick these boxes
  • SSO (Identity Provider): Publish
  • SSO (Service Provider): Subscribe
  • Assign Submission Mahara services: Subscribe and Publish
  • Click "Save changes"

7. Create a student & teacher user in Moodle.

  • You can do this however you'd like, but I like to do this quickly using the "Upload users" tool at "Site administration -> Users -> Accounts -> Upload users"
  • (aka /admin/tool/uploaduser/index.php )
  • ... and this CSV file:
teacher,passwords,Teach,Er,[email protected]
student,passwords,Stu,Dent,[email protected]

8. Create a course.

  • Enrol the teacher in the course as a teacher
  • Enrol the student in the course as a student

9. Log out as admin. Log in as the teacher user. Navigate to the course.

10. Add a "Network servers" block to the course page

  • If you don't have an option for the "Network servers" block, make sure that you've carried out all the above steps
    • Enabling Networking
    • Setting up an Mnet host with SSO services
    • Enabling the Mnet auth plugin
    • Setting the "moodle/site:mnetloginremote" permission to "Allow"

11. If you're testing the Mahara assignment submission plugin:

  • Add an "assignment" activity to the course.
  • In the assignment's "Submission types" section, make sure "Mahara portfolio" is ticked.

Back in Mahara

Now for users to be able to roam to Mahara, you need to set up an auth instance for Moodle in your Mahara site.

1. Go to "Administration" -> "Institutions"

  • (aka /admin/users/institutions.php )

2. Create an institution (or edit an existing one)

3. Once the institution is created, you'll now be able to edit its "Authentication plugins" on its settings page.

  • Add an "XML-RPC" instance

4. Fill in the details of your Moodle site into the popup

  • Authority name: Name displayed to admins to describe this auth instance
  • WWW root: The URL of your Moodle site
  • Site name: Display name of the Moodle site (Used in the "Roam back to ____" message)
  • Application: Moodle
  • Parent authority: Internal is a good choice
  • SSO direction: They SSO in
  • Update user info on login: Yes
  • We auto-create users: Yes
  • We import content: Yes
  • Click "Submit"
  • Once the popup closes, it automatically saves the details to the DB and you don't actually need to save on the parent page.

Back in Moodle

1. Go to the course where you added a "Network Servers" block

2. You should see a link to your Mahara site. Click on it.

3. You should roam through to your Mahara site. There'll be a sideblock that says "You have logged in from (site name you entered into Moodle)". Clicking on that link should take you back to Moodle

4. In a second browser window, log in to Moodle as the student user.

  • I like to use Firefox's "New Private Window" for this.
  • I believe Chrome's "Incognito Window" feature may also work
  • Or just open Chrome and Firefox both.

5. As the student user, go to the course with the "Network Servers" block. Roam across to Mahara and create some pages and/or collections.

6. Still as the student user, return to Moodle. Go into the assignment activity you created earlier as an admin. When you go to edit your submission, you should see an option to choose one of your Mahara pages (and/or collections)

  • You should also be able to link through to your pages and view them.
  • Note that one important test-case is to test what happens if you try to do this but you don't have any pages or collections in Mahara.

7. Pick a Mahara page (or collection) for your submission, and submit your submission in Moodle.

  • Unless you're using the assignment "draft" settings, your Mahara page should now be locked from editing in Mahara
  • This means that if you roam over to Mahara, you should not be able to edit or delete the page

8. Now look at the first window, where you are still logged in as the teacher.

9. View the assignment.

  • You should see a gradebook
  • The gradebook should have a link to the submitted page for the student
  • If you click the link to grade the student's submission, the grading page should also have a link to the submitted page