Share and be happy!

Developing/programming plugins can be done quickly and, of course, it’s needed. But if you want to make it available to the world, it is necessary to observe some rules, it’s like writing diploma or thesis at university — you seem to understand what it was about and can explain the fingers on your research, but we need to keep a lot of formalities, and this is true. So one of our Moodle plugins were able to show the world. It is now available for download in the official repository of plugins Moodle.

Development history

LenAuth module was developed long time ago for one of our clients and all there runs like clockwork, so it was clear about understanding plugin work, writing a detailed documentation was unnecessary. In the summer of 2014 it was decided to make a number of improvements to connect some of the international social network with the popularity of the world (before this was Mail.Ru, Google and Facebook). And we started…

Difficulties that we encountered

Looking similar plugins we saw a lot of different web services, which established OAuth-authorizations, such as Linked-in, Windows Live, and even GitHub, indeed, a data connection to social services is easy enough, but whether it is, if your students are ordinary people, that have, as a rule, accounts in 1-2 popular rather than specialized social networks. At the same time, a feature was that we never found authenticate via Yahoo and Twitter, but then it became clear why. The fact that these social networks rather complicated system OAuth-authorization, which differs from the standard system (OAuth version 1): two redirect instead of one and, consequently, a larger number of requests, in general, we have assigned the responsibility “to meet” Moodle with OAuth-authorization methods Yahoo and Twitter. It was difficult, the hardest part was tested when surfaced more and more nuances, but we did it. With Twitter had similar problems as with Yahoo, but suddenly, for us, it was found that their web service does not return the correct information to us: name, family name, e-mail, but from useful returns only internal Social ID. Then we decided to make the following:

The plugin automatically creates additional profile fields of as much and services, that is, seven of them and each is tied to the owm social network, and writes back the value of their web service social ID. For example, you can be authorized by Yandex and authenticate through Twitter — the system will automatically record your ID on Twitter and do not have to enter the name and e-mail, as they have to load from the web service Yandex.

The process of plugin uploading to Moodle repository

All the nuances of plugin uploading and approval process to Moodle repository we will describe in a future article, but now we describe specific errors, which we pointed by administrators of Moodle plugins repository (much respect and thanks to David Mudrák).

  1. It must be remembered that Moodle, as a database, can use MySQL and PostgreSQL, respectively, request rules a little different, we pointed that, so little fix for that.
  2. Everything inside plugins php-files need to be protected from intruders calls by a special code at the beginning of the file defined('MOODLE_INTERNAL') || die();, one file was unprotected.
  3. Moodle core-programmers love when internal variables (configs) functions and classes used in its name the style Frankenstyle. This is not a requirement, but keep in mind!
  4. Then we ourselves have noticed that people are deprived Yandex.com and authenticate them offered through the Russian Yandex.ru.
  5. Almost all of the plugins store their data in the config Moodle database and can be pre-defined and resave, they must necessarily predetermine.
  6. To avoid errors when the plugin has been integrated, and then it was removed — added documentation check for the existence of files plugin.
  7. Recently in function get_string() was added a third option — to pass variables in the output string translation. In some cases, we had declared this variable explicitly, as are all changing rapidly.

Full list of changes you can see in the upgraded repository GitHub. The result had such a plugin LenAuth.

Comments 2
  • Dan Strutt
      

    Hi, guys!
    You’re great, i tried to install Lenauth at Moodle 2.5 and it works! I know, i need to upgrade my Moodle to 2.8)))
    Can you translate the plugin to Spanish language?

    • LMS Service
        

      Hi, Dan! Sure, the plugin works great with Moodle 2.5 and, may be, lower ones, but we didnt post these versions as approved/supported by LenAuth because the ones are not supported by Moodle team, so no reason to add all versions as supported. Some languages are coming, but not so clear)

Write a comment

Your email address will not be published. Required fields are marked *

Waiting feedback for mutually beneficial cooperation

Our services are b2b-oriented. We strive for high-quality Moodle services supply as it leads to higher income and satisfaction of our clients. If you have any questions or desires, please contact us.

A pop-up window

Contact us
Programming technologies Moodle: CSS3, AngularJS, Bootstrap

© 2014–2016, «LMS-Service». All rights reserved.