API16

JRule/allow

From Joomla! Documentation

< API16:JRule
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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[edit]

Checks that this action can be performed by an identity.



Syntax[edit]

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

Returns[edit]

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

Defined in[edit]

libraries/joomla/access/rule.php

Importing[edit]

jimport( 'joomla.access.rule' );

Source Body[edit]

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[edit]

Code Examples[edit]