drupal_is_denied

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/bootstrap.inc, строка 930

Версии
5 – 6
drupal_is_denied($type, $mask)

Perform an access check for a given mask and rule type. Rules are usually created via admin/user/rules page.

If any allow rule matches, access is allowed. Otherwise, if any deny rule matches, access is denied. If no rule matches, access is allowed.

Параметры

$type string Type of access to check: Allowed values are:

  • 'host': host name or IP address
  • 'mail': e-mail address
  • 'user': username
$mask string String or mask to test: '_' matches any character, '%' matches any number of characters.

Возвращаемое значение

bool TRUE if access is denied, FALSE if access is allowed.

▾ 7 функции вызывают drupal_is_denied()

user_admin_access_check_submit in modules/user/user.admin.inc
user_authenticate in modules/user/user.module
Try to log in the user locally.
user_login_name_validate in modules/user/user.module
A FAPI validate handler. Sets an error if supplied username has been blocked or denied access.
user_pass_reset in modules/user/user.pages.inc
Menu callback; process one time login link and redirects to the user page on success.
user_pass_validate in modules/user/user.pages.inc
_drupal_bootstrap in includes/bootstrap.inc
_user_edit_validate in modules/user/user.module

Код

<?php
function drupal_is_denied($type, $mask) {
  // Because this function is called for every page request, both cached
  // and non-cached pages, we tried to optimize it as much as possible.
  // We deny access if the only matching records in the {access} table have
  // status 0 (deny). If any have status 1 (allow), or if there are no
  // matching records, we allow access.
  $sql = "SELECT 1 FROM {access} WHERE type = '%s' AND LOWER('%s') LIKE LOWER(mask) AND status = %d";
  return db_result(db_query_range($sql, $type, $mask, 0, 0, 1)) && !db_result(db_query_range($sql, $type, $mask, 1, 0, 1));
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему