Class: I2CE PermissionParser: Difference between revisions
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
*Extends the class: [[Class: I2CE_Fuzzy | I2CE_Fuzzy]]. | *Extends the class: [[Class: I2CE_Fuzzy | I2CE_Fuzzy]]. | ||
*Location: Part of the module [[I2CE Module List#pages|pages]] in the package [https://launchpad.net/i2ce I2CE] | *Location: Part of the module [[I2CE 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. | *Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L29 modules/Pages/lib/I2CE_PermissionParser.php] on line 29 | ||
==Variables== | ==Variables== | ||
===$user=== | ===$user=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L31 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 31 | |||
*Type: protected $user | *Type: protected $user | ||
===$template=== | ===$template=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L32 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 32 | |||
*Type: protected $template | *Type: protected $template | ||
===$has_get_data=== | ===$has_get_data=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L33 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 33 | |||
*Type: protected $has_get_data | *Type: protected $has_get_data | ||
===$has_get_display=== | ===$has_get_display=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L34 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 34 | |||
*Type: protected $has_get_display | *Type: protected $has_get_display | ||
==Methods== | ==Methods== | ||
===__construct()=== | ===__construct()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L37 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 37 | |||
*Signature: public function __construct($template,$user) | *Signature: public function __construct($template,$user) | ||
*Parameters: | *Parameters: | ||
Line 23: | Line 28: | ||
**$user | **$user | ||
===evaluateBooleans()=== | ===evaluateBooleans()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L644 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 644 | |||
*Signature: protected function evaluateBooleans($booleans) | *Signature: protected function evaluateBooleans($booleans) | ||
*Parameters: | *Parameters: | ||
Line 28: | Line 34: | ||
===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.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L242 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 242 | |||
*Signature: protected function getRoleTrickleUp($name) | *Signature: protected function getRoleTrickleUp($name) | ||
*Parameters: | *Parameters: | ||
Line 34: | Line 41: | ||
===getTaskTrickleDown()=== | ===getTaskTrickleDown()=== | ||
Returns the role trickle up from the shortname @param string $name the role shortname | Returns the role trickle up from the shortname @param string $name the role shortname | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L97 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 97 | |||
*Signature: protected function getTaskTrickleDown($task) | *Signature: protected function getTaskTrickleDown($task) | ||
*Parameters: | *Parameters: | ||
Line 40: | Line 48: | ||
===hasPermission()=== | ===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 | 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 | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L78 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 78 | |||
*Signature: public function hasPermission($permission,$node) | *Signature: public function hasPermission($permission,$node) | ||
*Parameters: | *Parameters: | ||
Line 47: | Line 56: | ||
*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.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L250 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 250 | |||
*Signature: protected function hasPermission_role($node,$roles) | *Signature: protected function hasPermission_role($node,$roles) | ||
*Parameters: | *Parameters: | ||
Line 52: | Line 62: | ||
**$roles | **$roles | ||
===hasPermission_task()=== | ===hasPermission_task()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L158 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 158 | |||
*Signature: protected function hasPermission_task($node,$tasks) | *Signature: protected function hasPermission_task($node,$tasks) | ||
*Parameters: | *Parameters: | ||
Line 57: | Line 68: | ||
**$tasks | **$tasks | ||
===hasPermsssion_module()=== | ===hasPermsssion_module()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L138 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 138 | |||
*Signature: protected function hasPermsssion_module($node,$args) | *Signature: protected function hasPermsssion_module($node,$args) | ||
*Parameters: | *Parameters: | ||
Line 62: | Line 74: | ||
**$args | **$args | ||
===hasRole()=== | ===hasRole()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L108 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 108 | |||
*Signature: public function hasRole($role,$node) | *Signature: public function hasRole($role,$node) | ||
*Parameters: | *Parameters: | ||
Line 68: | Line 81: | ||
***Default Value: null | ***Default Value: null | ||
===hasTask()=== | ===hasTask()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L122 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 122 | |||
*Signature: public function hasTask($task,$node) | *Signature: public function hasTask($task,$node) | ||
*Parameters: | *Parameters: | ||
Line 74: | Line 88: | ||
***Default Value: null | ***Default Value: null | ||
===parsePermissionsLogic()=== | ===parsePermissionsLogic()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Pages/lib/I2CE_PermissionParser.php#L324 i2ce/modules/Pages/lib/I2CE_PermissionParser.php] on line 324 | |||
*Signature: protected function parsePermissionsLogic($permission,$node) | *Signature: protected function parsePermissionsLogic($permission,$node) | ||
*Parameters: | *Parameters: |
Revision as of 08:52, 10 November 2009
This article describes the class I2CE_PermissionParser.
- Extends the class: I2CE_Fuzzy.
- Location: Part of the module pages in the package I2CE
- Source: Defined in the file modules/Pages/lib/I2CE_PermissionParser.php on line 29
Variables
$user
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 31
- Type: protected $user
$template
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 32
- Type: protected $template
$has_get_data
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 33
- Type: protected $has_get_data
$has_get_display
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 34
- Type: protected $has_get_display
Methods
__construct()
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 37
- Signature: public function __construct($template,$user)
- Parameters:
- $template
- $user
evaluateBooleans()
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 644
- Signature: protected function evaluateBooleans($booleans)
- Parameters:
- $booleans
getRoleTrickleUp()
Returns the role trickle up from the shortname
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 242
- Signature: protected function getRoleTrickleUp($name)
- Parameters:
- string $name
the role shortname
- string $name
- Returns: array
(an empty array if there is no such tag name)
getTaskTrickleDown()
Returns the role trickle up from the shortname @param string $name the role shortname
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 97
- Signature: protected function getTaskTrickleDown($task)
- Parameters:
- $task
- Returns: array
(an empty array if there is no such tag name)
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
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 78
- Signature: public function hasPermission($permission,$node)
- Parameters:
- $permission
- DOMNode $node
The node to get on set data from.- Default Value: null
- Returns: mixed.
True/false, or null on failure.
hasPermission_role()
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 250
- Signature: protected function hasPermission_role($node,$roles)
- Parameters:
- $node
- $roles
hasPermission_task()
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 158
- Signature: protected function hasPermission_task($node,$tasks)
- Parameters:
- $node
- $tasks
hasPermsssion_module()
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 138
- Signature: protected function hasPermsssion_module($node,$args)
- Parameters:
- $node
- $args
hasRole()
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 108
- Signature: public function hasRole($role,$node)
- Parameters:
- $role
- $node
- Default Value: null
hasTask()
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 122
- Signature: public function hasTask($task,$node)
- Parameters:
- $task
- $node
- Default Value: null
parsePermissionsLogic()
- Defined in i2ce/modules/Pages/lib/I2CE_PermissionParser.php on line 324
- Signature: protected function parsePermissionsLogic($permission,$node)
- Parameters:
- &$permission
- $node
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()