Auto role assignment block

Z MoodleDocs
Skocz do:nawigacja, szukaj

Automation of role assignment process will enable permission managing for momentary cases and on “by user” basis. The main idea is to enable the system to reassign roles of participants based on actions they undertake. For example: the student passing the test is denied any communication options, but retains them upon completion. This approach would require significant effort from administrator with current manual-only role and permission management system.

Rule structure

Rule changes the permissions of the user depending on the event in the system.

Rules structure:

Required parameters:

  • Name of rule;
  • Type of rule;
  • A role that will be assigned to the user when the rule will trigger;
  • Roles that are permitted a transition;
  • Elements of the course for which the rule is triggered.

Optional parameters may be added depending on the type of rule.

Block appearance

The block contains three links:

  1. Link to add rule page
  2. Link to current rules page
  3. Link to active rules page
  4. Current role of user in course

block role assign.jpg

Add rule page

In this page you can add new rule: Step 1:

  • you must input name of rule
  • you must select type of rule

click 'next'.

new rule.jpg

Step 2:

  • you must select 'new role' (this role will receive a user when a rule is triggered)
  • you must select 'allow roles' (this user roles on this course, which allowed triggering rules)
  • you must select elements of course for this type of rule, which rule is triggered

click 'save'.

add edit rule.jpg

Current rules page

On this page you can see rules that already exist. On this page you can go to edit page of rule; delete rule (if you have the necessary permissions).

current rules.jpg

Active rules page

On this page you can see active rules.

active rules.jpg

DB structure

database.jpg

  • block_role_assign_rules - table for rules:
  • block_role_assign_instances - table with active rule
  • block_role_assign_values - table for optional parameters
  • block_role_assign_roles - table for allow roles
  • block_role_assign_types - table where sets type of rule
  • block_role_assign_tasks - table with types of rule

Capabilities

  • block/role_assign:addrule - ability add rule
  • block/role_assign:editrule - ability edit rule
  • block/role_assign:deleterule - ability delete rule
  • block/role_assign:viewactiverules - ability view page "active rules"
  • block/role_assign:viewcurrentrules - ability view page "current rules"