local:shop:setup:handlers:std_assignroleoncontext

Role Assignment on Context (Implementation)

Product Automation Handler

Scenario

The main scenario of this handler, on purchase validation, is to assign a designated role in a designated Moodle context. Given the functional richness of role application in Moodle, it is difficult to anticipate all the applications of this handler, as there are so many business situations to cover.

Use cases

We can only cite here a few examples of use cases that could use this automation plugin:

  • Paid access to a “higher” status in the course: One can imagine a course globally open to guests and first-level students (MOOC type) but which can offer follow-up and access to finer and more powerful material through the acquisition of an additional role (e.g. StudentPlus). Additional activities and resources can then use conditional access principles to be filtered to simple enrollees only.
  • Paid access to badges: By acquiring a global role, itself triggering the delivery of badges, you can make some badges paid.
  • Paid access to a privileged buyer status: As the shop has discount mechanisms triggered on capability (and therefore on the roles that hold it), you can give a “subscriber” discount to people who paid an initial fee.

:!: Note that the notion of role assignment in Moodle is different from the notion of enrolment, which corresponds more to an “academic” definition.

If a course intended for user support exists, a secondary enrolment in customer support can be triggered.

Implementation

Data to prepare (prerequisites)

You must know:

  • The short name of the role to deliver (Site administration / Manage roles)

Date encoding

In a first version, “advanced” date input interfaces are not yet developed. Dates must be given as a number of seconds since the start of the universe date (for Linux fans, of course, this date is January 1st, 1970 at 00:00).

You can use an online tool such as http://www.timestamp.fr to find the integer that represents your date.

Parameter string encoding

local/shop/setup/handlers/std_assignroleoncontext.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki