SafeExamBrowser / seb-server

The Safe Exam Browser Server web application simplifies and centralizes the configuration of SEB clients for exams. It interacts with a learning management or exam system for setting up and conducting e-assessments with Safe Exam Browser. It also improves security by allowing to monitor connected SEB clients in real time during e-assessments.
Mozilla Public License 2.0
43 stars 38 forks source link

How to connect a SEB server to Moodle? #18

Closed ratnavis closed 3 years ago

ratnavis commented 3 years ago

We have installed a SEB server but don't know how to connect it to a Moodle quizz.

We have the admin account on the web interface of SEB server, also the admin account of a fresh Moodle 3.9. We just need a good documentation.

anhefti commented 3 years ago

Hi, The documentation can be found here: https://seb-server.readthedocs.io/en/latest/#

Moodle integration is not offical supported for the SEB Server Version 1.0. there is a experimental implementation with the course API of Moodle. But full Moodle support is planed for SEB Server Version 1.1 that is coming Q2 2021 There is full support for Open edX in SEB Server Version 1.0.

Best regards

anhefti commented 3 years ago

I forgot to mention that If you use the initial, self generated account on the SEB Server you have just SEB Server administrator role, which gives you the rights to administrate institutions and users but not to create new LMS Setups. Please go to your user-accounts and open your account in edit mode. Check all roles at the end of the form and save. Logout and login again to make sure the new privileges take effect. Then go to the section "LMS Setup" and use "New LMS Setup" to create a new binding setup to an existing learning management system. Please see also in the documentation for details https://seb-server.readthedocs.io/en/latest/.

Best

ratnavis commented 3 years ago

Hi anhefti

Thanks for the replies.

Moodle integration is not offical supported for the SEB Server Version 1.0.

My bad. I overlooked this information.

It would have been very convenient for me, since I am familiar with Moodle.

There is a experimental implementation with the course API of Moodle. But full Moodle support is planed for SEB Server Version 1.1 that is coming Q2 2021.

How can I get in touch with the experimental implementation with the course API of Moodle?

There is full support for Open edX in SEB Server Version 1.0.

The timing was good. My colleague set up a full Open edX server just for testing the SEB Server connection.

The documentation can be found here: https://seb-server.readthedocs.io/en/latest/# I forgot to mention that If you use the initial, self generated account on the SEB Server you have just SEB Server administrator role, which gives you the rights to administrate institutions and users but not to create new LMS Setups. Please go to your user-accounts and open your account in edit mode. Check all roles at the end of the form and save. Logout and login again to make sure the new privileges take effect. Then go to the section "LMS Setup" and use "New LMS Setup" to create a new binding setup to an existing learning management system. Please see also in the documentation for details https://seb-server.readthedocs.io/en/latest/.

Correct. The SEB Server is still empty. I will go through those steps.

Do you know of the documentation for the Open edX side, specially suitable for a Open edX newcomer?

Cheers

nimalr commented 3 years ago

The documentation https://seb-server.readthedocs.io/en/latest/lmssetup.html does not seem to be applicable for newer OpenEdX releases. In the section "API Access Account on LMS" https://seb-server.readthedocs.io/en/latest/lmssetup.html#api-access-account-on-lms the screenshots of the OpenEdx admin console is different from what we see in OpenEdx Juniper release.

anhefti commented 3 years ago

@nimalr thanks for your input. Unfortunately we don't have an OpenEdx Juniper version running local. I hope the differences are not to match between the Versions on Open edX side. We use a Hawthorn instance of Open edX.

Would it be possible from your side to provide us with the setup steps and screenshots for the OpenEdx Juniper release? This would be very appreciated and I would extend the documentation with the setup for the Juniper release.

@ratnavis You can try to choose the Moodle type in the LMS Setup form while setting up the LMS binding and use the connection settings and Moodle account. Quizzes and/or courses will then be able to import. But there are many changes within the current development in this area and it is possible that old exams that where imported with SEB Server Version 1 would not work anymore with an update to version 1.1. So please treat this as experimental.

If you are interested in Open edX integration please also install the SEB Plugin for Open edX: https://seb-openedx.readthedocs.io/en/latest/

I'm also not very familiar with Open edX and we use an instance her just for development.

ratnavis commented 3 years ago

@anhefti

Many thanks for your quick response!

@ratnavis You can try to choose the Moodle type in the LMS Setup form while setting up the LMS binding and use the connection settings and Moodle account. Quizzes and/or courses will then be able to import.

Took note.

But there are many changes within the current development in this area and it is possible that old exams that where imported with SEB Server Version 1 would not work anymore with an update to version 1.1. So please treat this as experimental.

We are completely new to SEB server, so no history. (Experienced in SEB Client Windows 10 and Moodle, also with the SEB enhancements in Moodle rel. 3.9.) So, will go ahead with SEB Server version 1.1.

If you are interested in Open edX integration please also install the SEB Plugin for Open edX: https://seb-openedx.readthedocs.io/en/latest/

Sorry, we installed that "middleware" too. Got it going after a couple of iterations, but can't say whether functional or not until we get it going.

I'm also not very familiar with Open edX and we use an instance her just for development.

It is a steep learning curve for us. After (over) spending time this week, we can return to the project only early next week. Will report back. Kindly deposit here any additional information we might need in the process.

Regards

nimalr commented 3 years ago

Thanks @anhefti for reaching out.

@ratnavis and myself are from the same team. We are stuck at creating an API Access account on Openedx Juniper.

Here is what I have experienced so far:

  1. SEB Server plugin (neither 1.0.0 mentioned in the documentation nor 1.3.1 which is the latest version) work with Juniper. I raised an issue (see https://github.com/eduNEXT/seb-openedx/issues/44). I have installed the suggested branch, but that was not enough, I have had to manually install another python package, namely djangorestframework-oauth to get the plugin to work.

  2. To activate the SEB Server plugin, the config entry EXTRA_MIDDLEWARE_CLASSES: ['seb_openedx.middleware.SecureExamBrowserMiddleware'] needs to be changed in files /edx/etc/lms.yml and /edx/etc/studio.yml as Juniper no longer uses /edx/app/edxapp/lms.env.json and /edx/app/edxapp/cms.env.json

  3. We have created an LMS Setup in SEB Server, but "Activate LMS Setup" fails, probably because API Access account setup is incomplete. lms-activation-error

  4. We are stuck at creating an API Access account in OpenEdx. We have enabled OAUTH2 in LMS and CMS ENABLE_OAUTH2_PROVIDER: true but the OAUTH section of the admin console is different:

Screen Shot 2020-11-13 at 3 39 05 PM

"Clients" seems to have been renamed "Application" and the Change Application screen looks like this

juniper-admin-oauth-application

Authorization Grant Type options are

auth-grant-types

Not sure how to proceed.

nimalr commented 3 years ago

Update:

After changing Authorization grant type to "Resource owner password-based", I can get an access token using CURL from the command line (as indicated in Django Oauth Toolkit (DOT) documentation) https://django-oauth-toolkit.readthedocs.io/en/1.3.3/rest-framework/getting_started.html

But "Activate LMS Setup" from SEB Server web interface still does not work. I had to specify the client-id and the secret from the command line. Maybe there should be a way to specify the client-id and the secret in the LMS setup as well?

anhefti commented 3 years ago

Hi nimalr

Hmm, is there no OAUTH2 section on the Juniper administration with a Client entry anymore, like described in the picture below?

image

Resource owner password based should work, Client credential should also work but not sure about that. But if you are able to get an access token with CURL it should also be possible with the SEB Server web interface. Please try to use the client-id as LMS Server User Name and the secret as LMS Server Password in the SEB Server LMS Setup form as you see it in the picture below.

image

If this doesn't work, please try to get the logs from that try from the SEB Server logs and paste it here. So we might get a closer look to the cause of the problem. FYI The LMS Setup sould work independently from whether the SEB Plugin ins installed on Open edX or not. The SEB Plugin is only needed for the SEB restriction API feature but not for the Course Access features.

nimalr commented 3 years ago

Thanks @anhefti for the reply.

Openedx Juniper is reportedly used Django Oauth Toolkit instead of Django Oauth Provider. The change in the OUATH section of the admin console may be due to that. But the differences are only the heading (DJANGO OAUTH TOOLKIT) instead of OAUTH2 and "Applications" instead of "Clients". juniper-admin-oauth

Making the changes in LMS Setup in the SEB Server does not change anything. I have tried with "Authorization Grant Type" set to both "Client Credentials" and "Resource owner password based". Same result in both cases.

Just to check, I have tried getting an access token using only client credentials: curl -X POST -d "grant_type=client_credentials" -u "<client-id>:<secret>" https://lms.schoolweb.ch/oauth2/access_token and I was able to get an access token.

I have attached the log from the SEB server.

seb-server.log

nimalr commented 3 years ago

Update:

When I look at the logs in the OpenEdx side: When trying to "Activate LMS Setup" - I see no attempt to access /oauth2/access_token. Also looked at network level traffic using tcpdump - there is no HTTP POST request coming from SEB server. So it looks like SEB server does not get to the point where it makes the HTTP POST request.

nimalr commented 3 years ago

Update:

Took the docker containers down and up again. Edited the LMS setup from scratch. Now the "Activate LMS Setup" is successful. I wonder what the problem may have been.

Thanks for the help in sorting this out. I would be happy to contribute to updating documentation.

anhefti commented 3 years ago

Glad to hear that it is running now @nimalr.

Hmm, but I don't know, what might have changed during the docker container reboot. Maybe there was an error on the docker network connection so that SEB Server was not able to connect to the Open edX server. In the SEB Server logs that you have given me, I also cannot see any point. But there must be a causing error in the logs where the given error was following on. If you have time, please can you have a quick look again to the SEB Server logs and see if there are some other errors with stack-traces to? This would be very helpful.

Contributing to the documentation would be very helpful. if possible please check out the "documentation" branch and add the changes, then make a pull request. Or, if you prefer; provide me with a document with additional content. Then I will add that to the documentation.

Best regards

nimalr commented 3 years ago

Thanks @anhefti for the reply.

Actually, even before sending the previous log excerpt to you, I checked for any immediately preceding log entries, but they were unrelated.

I will edit the relevant page of the document on Github and send you a pull request. Before that, I have the following query regarding the page https://seb-server.readthedocs.io/en/latest/lmssetup.html: There are several labels (such as lms-setup-rest-plugin-label), in the page that don't appear be valid, and hence just exposing the label itself instead of showing a link. Would it be possible to correct those? The ones appearing in the section "Create a new LMS Setup for Open edX" are quite confusing. labels

Rgds,

Nimal R.

anhefti commented 3 years ago

Thanks Nimal

Yes, sorry, there was a problem with internal refs in the document. Internal refs in bucked-lists or notes seems not to work for whatever reason. I changed that by using links instead. Now it should work. I also did some other minor corrections and you can now create a pull request with your additions. please use the "documentation" branch if possible.

Best regards

anhefti commented 3 years ago

Updated the documentation