Auto role assignment block: Difference between revisions

From MoodleDocs
(New page: 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 participant...)
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
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.
=== Why this block ===
Consider the situation. In the course the student has role of "student", he has permission to pass tests, viewing lectures, correspondence with other course participants, etc. When a student, for example, gives examination test it should be out some rights such as viewing the lectures and correspondence. If it is done manually, as is done now, it will take a lot of time, because group usually more than 10 people, moreover after the end of the test must return the user to the previous permission.


===User interface===
This block will automatically change the user's role on the events in the system (in this case the beginning of the test and the end of the test).
====Block appearance====
 
The block contains two links:
=== Rules ===
# Link to settings page  
Rule - is a term used to describe the process of checking the current state of the user and the ability to change the role by event in system.
# Link to block help page
 
====Settings page====
For the example above:
The settings page contains:
*Event in system: the beginning of passing the test;
# List of existing rules, each represented with:
*Current state: role of "student";
## Link to corresponding rule's editing form
*New state:  role of  "students taking examination test".
## Option to disable
 
## Option to mark the rule for removing
Rule works as follows:
# Option to add new rule
# The system event is triggered - the student began to take the test
# Option to delete rules marked for deletion
# If for this event find rule, then
====Rule settings====
## Check the user's current role (in this case "student"), if the role needs to change (in this case "students taking examination test"), then
Rule settings consist of:
### Change user role (in this case role "student" change on role "student taking examination test")
# Rule name
 
# Event, upon which the rule takes effect (note: this is not the “event” developers are familiar with, but the events, understandable by users)
Role returns of the same principle, only handling the event of the "student finished the test".
# List of roles, to which this rule is applicable
 
# New role being set for user as a result of event
=== Parameters of rules ===
# Recurrence flag – set if default role is to be returned upon completion of activity (if possible).
* ''id of the course'' - a specific course for which the rule is intended
* ''type rule'' -  modules of Moodle for which should work rule, now realized work rules for two types of module quiz and block supervised, planned to implement for the module poasasssignment.
* ''user Group'' - rule is triggered (depending on type) for:
** One user
** User groups on the course
** All users on the course
* ''allowed roles'' - roles of users who are allowed to change in the rule
 
=== 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:
# Link to current rules page
# Link to active rules page
# Current role of user in course
[[Image:block_role_assign.jpg]]
 
=== Current rules page ===
On this page you can see rules that already exist. On this page you can go to add/edit page of rule; delete rule (if you have the necessary permissions).
 
[[Image:current_rules.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'.
 
[[Image: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'.
 
[[Image:add_edit_rule.jpg]]
 
=== Active rules page ===
 
On this page you can see active rules.
 
[[Image:active_rules.jpg]]
 
=== DB structure ===
 
[[Image: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"

Latest revision as of 10:42, 6 January 2014

Why this block

Consider the situation. In the course the student has role of "student", he has permission to pass tests, viewing lectures, correspondence with other course participants, etc. When a student, for example, gives examination test it should be out some rights such as viewing the lectures and correspondence. If it is done manually, as is done now, it will take a lot of time, because group usually more than 10 people, moreover after the end of the test must return the user to the previous permission.

This block will automatically change the user's role on the events in the system (in this case the beginning of the test and the end of the test).

Rules

Rule - is a term used to describe the process of checking the current state of the user and the ability to change the role by event in system.

For the example above:

  • Event in system: the beginning of passing the test;
  • Current state: role of "student";
  • New state: role of "students taking examination test".

Rule works as follows:

  1. The system event is triggered - the student began to take the test
  2. If for this event find rule, then
    1. Check the user's current role (in this case "student"), if the role needs to change (in this case "students taking examination test"), then
      1. Change user role (in this case role "student" change on role "student taking examination test")

Role returns of the same principle, only handling the event of the "student finished the test".

Parameters of rules

  • id of the course - a specific course for which the rule is intended
  • type rule - modules of Moodle for which should work rule, now realized work rules for two types of module quiz and block supervised, planned to implement for the module poasasssignment.
  • user Group - rule is triggered (depending on type) for:
    • One user
    • User groups on the course
    • All users on the course
  • allowed roles - roles of users who are allowed to change in the rule

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 current rules page
  2. Link to active rules page
  3. Current role of user in course

block role assign.jpg

Current rules page

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

current rules.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

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"