Class: I2CE PermissionParser: Difference between revisions

From IHRIS Wiki
No edit summary
 
(22 intermediate revisions by the same user not shown)
Line 1: Line 1:
This article desrcibes the class '''I2CE_PermissionParser'''.
#REDIRECT [[Class: I2CE_PermissionParser (4.1.7)]]
*Extends the class: [[Class: I2CE_Fuzzy | I2CE_Fuzzy]].
*Location: Part of the module [[iHRIS Module List#pages|pages]] in the package [https://launchpad.net/i2ce I2CE]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.0-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php modules/Pages/lib/I2CE_PermissionParser.php]
 
==Variables==
===$user===
*Type: protected $user
 
===$template===
*Type: protected $template
 
===$has_get_data===
*Type: protected $has_get_data
 
===$has_get_display===
*Type: protected $has_get_display
 
==Methods==
===__construct()===
*Signature: public function __construct($template,$user)
Parameters:
*$template
*$user
===evaluateBooleans()===
*Signature: protected function evaluateBooleans($booleans)
Parameters:
*$booleans
===getRoleTrickleUp()===
Returns the role trickle up from the shortname
*Signature: protected function getRoleTrickleUp($name)
*Returns: [http://www.php.net/manual/en/language.types.array.php array ] (an empty array if there is no such tag name)
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $name<br/>the role shortname
===getTaskTrickleDown()===
Returns the role trickle up from the shortname
@param string $name the role shortname
*Signature: protected function getTaskTrickleDown($task)
*Returns: [http://www.php.net/manual/en/language.types.array.php array ] (an empty array if there is no such tag name)
Parameters:
*$task
===hasPermission()===
Check to see if a user has permission for a given role/task whatever
@param string $permissions The permisisions string.
Example: "role(admin) or task(can_view_page) or task(can_edit_page)"
Exmaple: "role(admin|staff)" is the same as "role(admin,staff)" which is the same as "role(admin) role(staff)"
which is the same as "role(admin) | role(staff)" which is the same as "role(admin) or role(staff)"
Example: "role(admin) or task(can_view_page) and role(staff)" is the same as
"(role(admin) or task(can_view_page)) and role(staff)"  i.e. parenthesis are grouped left.
Note: You may reference variables, which is really template data, as a function argument or in a double quoted string.
When referencing varaibles, you are allowed to include types, such as ${T1}z, but you are not allowed to
do so in a doulbe quoted string.  Variable names may consit of alpha-numeric character, '_', and '-'.
You may protect a variable by surrounding it in {}'s
Example: "func1($a,"x$a", '\' "'  "x{$a}y" , "x{$ay} ${T1}z )"  causes the (possbily fuzzy) method
hasPermission_func1() with the following arguments:
array( $this->template->getDisplayData('a',$node),
'x' . $this->template->getDisplayData('a',$node),
'\' "',
'x' . $this->template->getDisplayData('ay',$node) ,
'x' . $this->template->getDisplayData('a',$node) . 'y',
'x' . $this->template->getData('T1',z,$node,true,true))
There are special argument you can pass to the function which are  <TEMPLATE>, <USER> and <NODE> which will be
the template, user and calling node  associated with this permission.
Note: spaces provide an implicit comma to split arguments.
Example functions: role, task which take a list or roles and task repsectively.
Example function:  form('person' method <USER>) -- finds the person form,relative to $node and calls $form->method(array($user))
Example function:  form(person , 'weird method;',<USER>10) -- finds the person form,relative to $node and calls $form->$method(array($user,10))
where $method='weird method;'
Example function: module('mod_name',method,arg1,...,argn) works like form but for modules
*Signature: public function hasPermission($permission,$node)
*Returns: mixed.  True/false, or null on failure.
Parameters:
*$permission
* [http://www.php.net/manual/en/class.domnode.php DOMNode ] $node<br/>The node to get on set data from.
**Default Value: null
===hasPermission_role()===
*Signature: protected function hasPermission_role($node,$roles)
Parameters:
*$node
*$roles
===hasPermission_task()===
*Signature: protected function hasPermission_task($node,$tasks)
Parameters:
*$node
*$tasks
===hasPermsssion_module()===
*Signature: protected function hasPermsssion_module($node,$args)
Parameters:
*$node
*$args
===hasRole()===
*Signature: public function hasRole($role,$node)
Parameters:
*$role
*$node
**Default Value: null
===hasTask()===
*Signature: public function hasTask($task,$node)
Parameters:
*$task
*$node
**Default Value: null
===parsePermissionsLogic()===
*Signature: protected function parsePermissionsLogic($permission,$node)
Parameters:
*&$permission
*$node
==Inherited Fuzzy Methods==
===userMessage()===
This method is inherited from [[Class: I2CE_Fuzzy#userMessage() | I2CE_Fuzzy->userMessage()]]
==Fuzzy Methods==
===hasPermission_form()===
This method is implemented by [[Class: I2CE_Module_Forms#hasPermission_form() | I2CE_Module_Forms->hasPermission_form() ]]
 
 
[[Category:Class Documentation]]

Latest revision as of 08:49, 23 August 2013