Moodle and Google Apps for education

Re: Moodle and Google Apps for education

by Kevin Bruton -
Number of replies: 18

I've been trying out the http://www.moodleinschools.org.nz version of Moodle with the Google Integration plugins already incorporated. However, I'm unable to get the integration working. I find the installation and configuration instructions very scarce and noone has posted anything in their tech forum for over a year.

The documentation for the plugins seem to refer to the Moodle plugins already published in moodle.org that have eliminated entries for all Moodle versions after 2.4.

Bob, Rob or anyone... If you're willing to publish code and instructions sufficient for me to get  Google Integration working with 2.7, I'm willing to help with testing and maintenance or whatever to help others get it going as well.

I've found the Google Drive Repostitory plugin really easy to get working. I think we need something like that to be able to integrate Google accounts right from the login page of Moodle, not just when you want to upload something. Help!

In reply to Kevin Bruton

Re: Moodle and Google Apps for education

by Rob Johnson -

The instructions for earlier versions should apply to 2.7.  For the record, I have not used the integration beyond 2.6.

  • Have you generated certificates and uploaded to Google and pasted the text into the gsaml auth page?
  • Have you turned on SSO in the GApps control panel
  • Are you seeing errors?
Below are the set up instructions from the gsaml settings page on my 2.4 production site.  I have been testing 2.6 on my dev box, and it is working fine.

  1. Set the Domain Name to your google service domain name then click Save Changes

  2. In a new window open Google Apps Control Panel page as admin (Link to Google Settings)

  3. Click the Advanced tools tab.

  4. Click the Set up single sign-on (SSO) link next to Authentication.

  5. First check the Enable Single Sign-on box.

  6. Now insert this url into the Sign-in page URL text field.
    http://yourdomian/login/index.php

  7. Insert this url into the Sign-out page URL text field.
    http://yourdomian/login/logout.php

  8. Insert this url into the Change password URL text field.
    http://yourdomian/login/change_password.php

  9. Generate and upload a Verification certificate to Google (X.509 certificate containing the public key)

  10. Upload the privatekey and certificate to Moodle as well and then click Save Changes

Average of ratings: Useful (1)
In reply to Rob Johnson

Re: Moodle and Google Apps for education

by Kevin Bruton -

Thanks very much for your reply, Rob.

I've done a new install and followed all the steps, including putting the certificates in the right place etc., etc. 

After I do all of this, and I logout, then I am unable to login again. When I try to do so it says "Error reading from database", following the link on more information, it tells me it is an "error/moodle/dmlreadexception". 

The only way I can login again is setting $CFG->auth = ''; in config.php.

If I go to the Google SAML diagnostics page is shows me the private key, the domainname I've set, the certificate, and then:


Any ideas?

In reply to Kevin Bruton

Re: Moodle and Google Apps for education

by Rob Johnson -

Hi Kevin,

Please turn on debugging and post the stack trace for the error message you see.  That may give us better information.

Is your account authenticated using "Manual accounts?"   I am not sure why setting the Gauth would break log ins.

In reply to Rob Johnson

Re: Moodle and Google Apps for education

by Kevin Bruton -

Hi Rob,

I've turned debugging on and now I receive a different error message:


Table "block_gdata_gapps" does not exist

More information about this error

Debug info: 
Error code: ddltablenotexist

Stack trace:
  • line 585 of /lib/dml/moodle_database.php: dml_exception thrown
  • line 1426 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
  • line 59 of /auth/gsaml/auth.php: call to moodle_database->get_record()
  • line 4487 of /lib/moodlelib.php: call to auth_plugin_gsaml->user_authenticated_hook()
  • line 140 of /login/index.php: call to authenticate_user_login()

It doesn't let me change the login authentication to anything else but "Manual" for the admin account. I've been able to change it to Google SAML for another user, but when I try to login with that user, I still get the same error.

I've examined the database and it's true that the said table doesn't exist, nor with nor without the prefix. Does that mean I'm missing some plugin? or a part of one?

In reply to Kevin Bruton

Re: Moodle and Google Apps for education

by Rob Johnson -

In the original integration for 1.9, there was a Google Sync block.  That is the missing table in the stack trace.  It looks like Moodle in NZ schools removed it from their 2.6 and 2.7 forks.  The 2.6.2 site I am testing has the table because I upgraded from 2.4.  Even though the table exists on my site, I don't use the block anymore.  I have the 2.4 version in my blocks folder, but it is hidden on my test site.  It has been buggy in the 2.x versions.  I had to hack it to sync newly created users.

Since you are working with a fresh installation, try the attached file.  It contains the block from the Moodle in NZ 2.5 version.  I don't think it changed much since the 2.x rewrite.  The gdata folder gets unzipped into the blocks folder.  There will be settings to complete.  After the installation, you can hide the block if you don't use it.  Post back the results.


Average of ratings: Useful (2)
In reply to Rob Johnson

Re: Moodle and Google Apps for education

by Kevin Bruton -

Wow! After installing the Google Sync block it actually seems to work!

Thanks so much for your help Rob!

As you've noted, the block is quite buggy. The only thing that works on it is "Settings" and "Status". Trying to click on "Users being synced" or "Add users to sync" causes havoc (= a page of coding errors), but at least SSO is working. I'll keep testing Google-Moodle integration before introducing it into my production site, but at least it's on the way.

In reply to Kevin Bruton

Re: Moodle and Google Apps for education

by Rob Johnson -

That is good news.  Have you tried the Gmail block?  Over the past weekend, Google seems to have changed something that broke the blocks ability to pull a users Atom feed from Gmail.  I posted about it here.

In reply to Kevin Bruton

Re: Moodle and Google Apps for education

by Kevin Bruton -

I haven't had any luck with the Gmail block either. I set it up with the OAuth Consumer secret etc., and the block just displays "sorry couldn't obtain mail".
The stack trace reports the following:

Deprecated: Function split() is deprecated in /var/www/moodle/blocks/gmail/block_gmail.php on line 243

Gmail feed (for admin@... ) failed with:
Unauthorized
Error 401

  • line 267 of /blocks/gmail/block_gmail.php: call to debugging()
  • line 138 of /blocks/gmail/block_gmail.php: call to block_gmail->obtain_gmail_feed()
  • line 773 of /blocks/moodleblock.class.php: call to block_gmail->get_content()
  • line 236 of /blocks/moodleblock.class.php: call to block_list->formatted_contents()
  • line 993 of /lib/blocklib.php: call to block_base->get_content_for_output()
  • line 1045 of /lib/blocklib.php: call to block_manager->create_block_contents()
  • line 353 of /lib/blocklib.php: call to block_manager->ensure_content_created()
  • line 5 of /theme/nz_schools/layout/frontpage.php: call to block_manager->region_has_content()
  • line 877 of /lib/outputrenderers.php: call to include()
  • line 807 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
  • line 101 of /index.php: call to core_renderer->header()
In reply to Kevin Bruton

Re: Moodle and Google Apps for education

by Francesc Delis -

Hi!

I have a problem trying to use the google sync bloc

Authentication with Google Apps was successful

But when I want to add users to syncronize the message shown is not so successful

Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

More information about this error

Debug info: Argument 2 passed to html_writer::start_tag() must be of the type array, boolean given, called in [dirroot]/lib/outputrenderers.php on line 2753 and defined
Error code: codingerror
Stack trace:
line 393 of /lib/setuplib.php: coding_exception thrown
line 1027 of /lib/outputcomponents.php: call to default_error_handler()
line 2753 of /lib/outputrenderers.php: call to html_writer::start_tag()
line 544 of /blocks/gdata/block_gdata.php: call to core_renderer->box_start()
line 471 of /blocks/gdata/block_gdata.php: call to block_gdata->display_user_table()
line 276 of /blocks/gdata/block_gdata.php: call to block_gdata->addusers_display()
line ? of unknownfile: call to block_gdata::view()
line 1671 of /lib/blocklib.php: call to call_user_func()
line 35 of /blocks/gdata/index.php: call to block_method_result()
Output buffer: <form class="userform" id="userformid" action="http://xxx.yyy/blocks/gdata/index.php" method="post"><div class="paging">Page:  1  <a href="http://xxx.yyy/blocks/gdata/index.php?hook=addusers&amp;pagesize=50&amp;page=1">2</a> ...

Even more, I can see the inbox's message in the gmail block but when I try to acces another annoying message is shown

SAML Auth Code Failed turn debugging on for more information

The same message is also shown if I try to acces with the google apps block.

To achieve the google-moodle integration I have installed in my previous moodle 2.7 installation the part of the code from http://www.moodleinschools.org.nz/download regarding this feature, I mean, auth->gauth, gsaml, blocks->gaccess, gdata, gmail. Did I need anything else?

Please, any ideas about how I can solve it?

Thank you very much!

In reply to Francesc Delis

Re: Moodle and Google Apps for education

by Rob Johnson -

I notice in the stack trace there is a reference to calling output renderer.  This is just a guess, but does the error clear if you switch to another theme?

In reply to Rob Johnson

Re: Moodle and Google Apps for education

by Francesc Delis -

Hi Rob!

I only have the clean theme installed. I can install another one and try with it.

Any other ideas?

Thank you!

In reply to Francesc Delis

Re: Moodle and Google Apps for education

by Roger Pàmies -

Hello Francesc,

I has the same error, I found the line conflict in blocks/gdata/block_gdata.php line 544

print $OUTPUT->box_start('boxaligncenter boxwidthwide', '', true); //fail

print $OUTPUT->box_start();

I replaced these lines with:

print $OUTPUT->box(''); //change start_box call - new
print $OUTPUT->box_start();
print '<div class="boxaligncenter boxwidthwide">'; //insert div form container align - new

finally, I add "print '</div>';" before the line "print $OUTPUT->box_end(true);" 

Refresh and the form show ok.

roger.

Average of ratings: Useful (2)
In reply to Kevin Bruton

Re: Moodle and Google Apps for education

by Bob Puffer -

My github address is listed below. I can assure you my integration is VERY integrated -- syncing calendars, folder permissions with enrollments, etc.

In reply to Bob Puffer

Re: Moodle and Google Apps for education

by Rob Johnson -

Hi Bob,

Does your integration provide SSO and user provisioning?  If I remember from when this thread was more active, it is more of an integration with calendar and Drive.

In reply to Rob Johnson

Re: Moodle and Google Apps for education

by Bob Puffer -

It doesn't provide user provisioning or SSO. It creates a repo, a block, syncs calendar items and provides read-only and student-writeable folders for sharing docs. Also provides Sites for the course. Maintains enrollments synchronization. Haven't been interested in either SSO or user provisioning of Google accounts through Moodle.

In reply to Bob Puffer

Re: Moodle and Google Apps for education

by Kevin Bruton -

Hi Bob!

I've been trying out Morsle. The functionality it offers seems very interesting indeed, however I haven't been able to get it going  too well. I wasn't too sure how to install it. I installed mod_morsle, block_morsle and repository_morsle, but I'm not sure how the authentication works or if I'm missing some other modules a part from those, because it's obviously not working for me the way it should. I'm not sure if there's a particular document where the installation of Morsle is explained? Many thanks.

In reply to Kevin Bruton

Re: Moodle and Google Apps for education

by Bob Puffer -

Morsle currently requires admin account credentials to GAPPs domain. These are hashed and stored. In addition it requires two-legged OAuth to be enabled for the domain with the secret hashed and stored also. Am having a student worker upgrade auth to OAuth 2 because the current system will go away 7/2015.

Average of ratings: Useful (1)