You are here

function _password_policy_policy_excludes_authentication_module_of_user in Password Policy 7

Whether policy excludes an authentication module used to authenticate user.

Parameters

array $policy: Policy array.

object $account: User object.

Return value

bool TRUE if the policy excludes authentication module used to authenticate user; otherwise, FALSE.

1 call to _password_policy_policy_excludes_authentication_module_of_user()
_password_policy_load_active_policy in ./password_policy.module
Loads the first enabled policy that matches the specified roles.

File

./password_policy.authmap.inc, line 20
Functions to support excluding authentication modules from policies.

Code

function _password_policy_policy_excludes_authentication_module_of_user(array $policy, $account) {
  $excluded_authentication_modules = $policy['excluded_authentication_modules'];
  if (empty($excluded_authentication_modules)) {
    return FALSE;
  }
  $user_authentication_modules = _password_policy_get_authentication_modules_for_user($account);
  $user_excluded_authentication_modules = array_intersect($excluded_authentication_modules, $user_authentication_modules);
  return !empty($user_excluded_authentication_modules);
}