Actions

API16

JRule/allow

From Joomla! Documentation

< API16:JRule
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Checks that this action can be performed by an identity.

[Edit Descripton]

Description:JRule/allow

Syntax

allow($identities)
Parameter Name Default Value Description
$identities An integer or array of integers representing the identities to check.

Returns

mixed True if allowed, false for an explicit deny, null for an implicit deny.

Defined in

libraries/joomla/access/rule.php

Importing

jimport( 'joomla.access.rule' );

Source Body

public function allow($identities)
{
        // Implicit deny by default.
        $result = null;
 
        // Check that the inputs are valid.
        if (!empty($identities))
        {
                if (!is_array($identities)) {
                        $identities = array($identities);
                }
 
                foreach ($identities as $identity)
                {
                        // Technically the identity just needs to be unique.
                        $identity = (int) $identity;
 
                        // Check if the identity is known.
                        if (isset($this->_data[$identity]))
                        {
                                $result = (boolean) $this->_data[$identity];
 
                                // An explicit deny wins.
                                if ($result === false) {
                                        break;
                                }
                        }
 
                }
        }
 
        return $result;
}

[Edit See Also] SeeAlso:JRule/allow

Examples

<CodeExamplesForm />