Class: I2CE PermissionParser (Development): Difference between revisions

From IHRIS Wiki
(Created page with '{{otherversions|Class: I2CE_PermissionParser}} This article describes the class ''I2CE_PermissionParser'' . *Extends the class: I2CE_Fuzzy. …')
 
No edit summary
Line 29: Line 29:
**$user  
**$user  
===evaluateBooleans()===
===evaluateBooleans()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L644 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 644
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L652 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 652
*Signature: protected function evaluateBooleans($booleans)
*Signature: protected function evaluateBooleans($booleans)
*Parameters:
*Parameters:
Line 35: Line 35:
===getRoleTrickleUp()===
===getRoleTrickleUp()===
Returns the role trickle up from the shortname
Returns the role trickle up from the shortname
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L242 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 242
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L250 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 250
*Signature: protected function getRoleTrickleUp($name)
*Signature: protected function getRoleTrickleUp($name)
*Parameters:
*Parameters:
Line 57: Line 57:
*Returns: mixed.<br/>True/false, or null on failure.
*Returns: mixed.<br/>True/false, or null on failure.
===hasPermission_role()===
===hasPermission_role()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L250 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 250
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L258 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 258
*Signature: protected function hasPermission_role($node,$roles)
*Signature: protected function hasPermission_role($node,$roles)
*Parameters:
*Parameters:
Line 89: Line 89:
***Default Value: null
***Default Value: null
===parsePermissionsLogic()===
===parsePermissionsLogic()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L324 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 324
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L332 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 332
*Signature: protected function parsePermissionsLogic($permission,$node)
*Signature: protected function parsePermissionsLogic($permission,$node)
*Parameters:
*Parameters:

Revision as of 07:55, 27 May 2010


This article describes the class I2CE_PermissionParser .

Variables

$user

$template

$has_get_data

$has_get_display

Methods

__construct()

evaluateBooleans()

getRoleTrickleUp()

Returns the role trickle up from the shortname

getTaskTrickleDown()

Returns the role trickle up from the shortname @param string $name the role shortname

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

hasPermission_role()

hasPermission_task()

hasPermsssion_module()

hasRole()

hasTask()

parsePermissionsLogic()

Inherited Methods

_hasMethod()

This public method is inherited from I2CE_Fuzzy->_hasMethod()

Inherited Fuzzy Methods

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()

Fuzzy Methods

hasPermission_form()

This method is implemented by I2CE_Module_Forms->hasPermission_form()