Difference between revisions of "Role extensions"

From Catglobe Wiki
Jump to: navigation, search
(Documentation)
(Tag: visualeditor)
(Documentation)
(Tag: visualeditor)
Line 11: Line 11:
 
When the role extension is called with zero parameters, it should return some documentation for itself.
 
When the role extension is called with zero parameters, it should return some documentation for itself.
  
The documentation consists of a [[RoleExtensionDocumentation]] class instance:
+
The documentation consists of a [[RoleExtensionDocumentation]] class instance.
  
"name" where the value is a [[LocalizedString class|LocalizedString]] must contain the name of the functionality provided for an admin user to see. e.g. "Reset password".
+
Depending of the role extension works on users or roles, the actual value returned may be a [[RoleExtensionUserDocumentation]], or a [[RoleExtensionRoleDocumentation]]. It is also possible to return a [[RoleExtensionEventDocumentation]] for those extensions that are event on changes to membership of a role, these are called automatically so documentation makes little sense.
 
 
"description" where the value is a [[LocalizedString class|LocalizedString]] must contain a short description of the functionality for an admin user to better understand what it actually does. e.g. "Sets a new random password for the user and emails it to the address registered for the user".
 
 
 
Optionally "permissionRequired": 2 = read, 4 = write, 6 = full control. Default, if not given, is "write". This is the minimum permission required to run this role extension on a user.
 
 
 
Optionally "toggleable": true or false. Default is false. If true, a user can either has a given status or not, which can be toggled.
 
 
 
Optionally "informsUser": true or false. Default is false. If true, this script will send a notification to the user about the change.
 
  
 
== Inheritance ==
 
== Inheritance ==
Line 29: Line 21:
 
== Discovery of role extensions ==
 
== Discovery of role extensions ==
 
Role extensions are discovered in the following order:
 
Role extensions are discovered in the following order:
# Workflow scripts that are children of roles in parent folders with same name. I.E. if the current role is named R1, and is located in the Path \Products\Dashboard1\Company A\Dept B, then it will look for role extensions in
+
# Workflow scripts may be defined in folders named "Role exts" anywhere in the system.
#* \Products\Dashboard1\Company A\Dept B\R1
 
#* \Products\Dashboard1\Company A\R1
 
#* \Products\Dashboard1\R1
 
#* \Products\R1
 
#* \R1
 
# Generic scripts may be defined in folders named "Role exts" in any of the parents. I.E. following the example from above the following folders are examined:
 
#* \Products\Dashboard1\Company A\Dept B\Role exts
 
#* \Products\Dashboard1\Company A\Role exts
 
#* \Products\Dashboard1\Role exts
 
#* \Products\Role exts
 
#* \Role exts
 
 
# If the current user does not have read access to the role extension itself, then the extension is ignored.
 
# If the current user does not have read access to the role extension itself, then the extension is ignored.
# If multiple role extensions are found with the same name, then only the first one found is "discovered". But it is possible inside a role extension to call the "parent" version of the role extension.
+
# If the documentation has LimitToPath, then that is examined to filter out if not applicable to current role.
 
[[Category:Roles]]
 
[[Category:Roles]]

Revision as of 10:19, 18 December 2019

Role extensions are extensions points for a role.

Parameters

The parameter given is either an instance of the RoleExtensionParameter class or zero parameters.

If called with zero parameters, the script should return documentation for itself.

If the script is called with other parameters, then the script is not called via the Role framework, which can be useful if scripts can be utilized for other functions.

Documentation

When the role extension is called with zero parameters, it should return some documentation for itself.

The documentation consists of a RoleExtensionDocumentation class instance.

Depending of the role extension works on users or roles, the actual value returned may be a RoleExtensionUserDocumentation, or a RoleExtensionRoleDocumentation. It is also possible to return a RoleExtensionEventDocumentation for those extensions that are event on changes to membership of a role, these are called automatically so documentation makes little sense.

Inheritance

Helper functions/classes

Discovery of role extensions

Role extensions are discovered in the following order:

  1. Workflow scripts may be defined in folders named "Role exts" anywhere in the system.
  2. If the current user does not have read access to the role extension itself, then the extension is ignored.
  3. If the documentation has LimitToPath, then that is examined to filter out if not applicable to current role.