JController/authorize: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Authorization check
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</sp... |
m preparing for archive only |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
Authorization check | Authorization check | ||
<! removed transcluded page call, red link never existed > | |||
===Syntax=== | ===Syntax=== | ||
| Line 51: | Line 49: | ||
</source> | </source> | ||
<! removed transcluded page call, red link never existed > | |||
< | |||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=authorize | category=authorize | ||
category=JController | category=JController | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
[[Category:Archived pages API16]] | |||
Latest revision as of 01:24, 25 March 2017
Description
Authorization check
<! removed transcluded page call, red link never existed >
Syntax
authorize($task)
| Parameter Name | Default Value | Description |
|---|---|---|
| $task | $task The ACO Section Value to check access on |
Returns
boolean True if authorized
Defined in
libraries/joomla/application/component/controller.php
Importing
jimport( 'joomla.application.component.controller' );
Source Body
function authorize($task)
{
// Only do access check if the aco section is set
if ($this->_acoSection) {
// If we have a section value set that trumps the passed task ???
if ($this->_acoSectionValue) {
// We have one, so set it and lets do the check
$task = $this->_acoSectionValue;
}
// Get the JUser object for the current user and return the authorization boolean
$user = & JFactory::getUser();
return $user->authorize($this->_acoSection, $task);
} else {
// Nothing set, nothing to check... so obviously its ok :)
return true;
}
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples