JRule/allow

From Joomla! Documentation

Jump to: navigation, search

Contents

Description

Checks that this action can be performed by an identity.

Syntax

JRule::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;
        }
Personal tools