API15

Difference between revisions of "JController/authorize"

From Joomla! Documentation

< API15:JController
(New page: ===Description=== Authorization check <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </sp...)
 
m (removing red link to edit, no existant pages)
(One intermediate revision by one other user not shown)
Line 3: Line 3:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JController/authorize|Edit Descripton]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
  
{{Description:JController/authorize}}
+
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 32: Line 32:
 
===Source Body===
 
===Source Body===
 
<source lang="php">
 
<source lang="php">
function authorize($task)
+
function authorize( $task )
 
{
 
{
 
         // Only do access check if the aco section is set
 
         // Only do access check if the aco section is set
         if ($this->_acoSection) {
+
         if ($this->_acoSection)
 +
        {
 
                 // If we have a section value set that trumps the passed task ???
 
                 // If we have a section value set that trumps the passed task ???
 
                 if ($this->_acoSectionValue) {
 
                 if ($this->_acoSectionValue) {
Line 43: Line 44:
 
                 // Get the JUser object for the current user and return the authorization boolean
 
                 // Get the JUser object for the current user and return the authorization boolean
 
                 $user = & JFactory::getUser();
 
                 $user = & JFactory::getUser();
                 return $user->authorize($this->_acoSection, $task);
+
                 return $user->authorize( $this->_acoSection, $task );
         } else {
+
         }
 +
        else
 +
        {
 
                 // Nothing set, nothing to check... so obviously its ok :)
 
                 // Nothing set, nothing to check... so obviously its ok :)
 
                 return true;
 
                 return true;
Line 52: Line 55:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JController/authorize|Edit See Also]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
{{SeeAlso:JController/authorize}}
+
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
Line 67: Line 70:
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API15]]

Revision as of 08:53, 12 May 2013

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Authorization check

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

authorize($task)
Parameter Name Default Value Description
$task $task The ACO Section Value to check access on

Returns[edit]

boolean True if authorized

Defined in[edit]

libraries/joomla/application/component/controller.php

Importing[edit]

jimport( 'joomla.application.component.controller' );

Source Body[edit]

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 edit link to red link >] <! removed transcluded page call, red link never existed >

Examples[edit]

<CodeExamplesForm />