You are here

public function field_validation_validator::bypass_validation in Field Validation 7.2

Bypass validation.

File

./field_validation_validator.inc, line 192
Basic class for field validation validator.

Class

field_validation_validator

Code

public function bypass_validation() {
  global $user;
  if (!empty($this->rule->settings['bypass']) && !empty($this->rule->settings['roles'])) {
    $roles = array_filter($this->rule->settings['roles']);
    $user_roles = array_keys($user->roles);
    foreach ($roles as $role) {
      if (in_array($role, $user_roles)) {
        return TRUE;
      }
    }
  }
  return FALSE;
}