API16

JRule/allow

< API16:JRule

The "API16" 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

Checks that this action can be performed by an identity.



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;
}



Examples

Code Examples


Advertisement