Back to Rules class

Method getAllowed

public \Joomla\CMS\Object\CMSObject
getAllowed
(mixed $identity)
Get the allowed actions for an identity.
Parameters
  • mixed $identity An integer representing the identity or an array of identities
Returns
  • \Joomla\CMS\Object\CMSObject Allowed actions for the identity or identities
Since
  • 1.7.0
Class: Rules
Project: Joomla

Method getAllowed - Source code

/**
 * Get the allowed actions for an identity.
 *
 * @param   mixed  $identity  An integer representing the identity or an array of identities
 *
 * @return  CMSObject  Allowed actions for the identity or identities
 *
 * @since   1.7.0
 */
public function getAllowed($identity)
{
    // Sweep for the allowed actions.
    $allowed = new CMSObject();
    foreach ($this->data as $name => &$action) {
        if ($action->allow($identity)) {
            $allowed->set($name, true);
        }
    }
    return $allowed;
}