You are here

public function RulesPlugin::access in Rules 7.2

Whether the currently logged in user has access to all configured elements.

Note that this only checks whether the current user has permission to all configured elements, but not whether a user has access to configure Rule configurations in general. Use rules_config_access() for that.

Use this to determine access permissions for configuring or triggering the execution of certain configurations independent of the Rules UI.

See also

rules_config_access()

1 call to RulesPlugin::access()
RulesAbstractPlugin::access in includes/rules.core.inc
Whether the currently logged in user has access to all configured elements.
2 methods override RulesPlugin::access()
RulesAbstractPlugin::access in includes/rules.core.inc
Whether the currently logged in user has access to all configured elements.
RulesContainerPlugin::access in includes/rules.core.inc
Whether the currently logged in user has access to all configured elements.

File

includes/rules.core.inc, line 822
Rules base classes and interfaces needed for any rule evaluation.

Class

RulesPlugin
Base class for rules plugins.

Code

public function access() {
  $this
    ->processSettings();
  foreach ($this
    ->pluginParameterInfo() as $name => $info) {
    if (isset($this->settings[$name . ':select']) && ($wrapper = $this
      ->applyDataSelector($this->settings[$name . ':select']))) {
      if ($wrapper
        ->access('view') === FALSE) {
        return FALSE;
      }
    }

    // Incorporate access checks for data processors and input evaluators.
    if (isset($this->settings[$name . ':process']) && $this->settings[$name . ':process'] instanceof RulesDataProcessor && !$this->settings[$name . ':process']
      ->editAccess()) {
      return FALSE;
    }
  }
  return TRUE;
}