You are here

function _ldapgroups_deny_role in LDAP integration 5

Same name and namespace in other branches
  1. 5.2 ldapgroups.module \_ldapgroups_deny_role()
  2. 6 ldapgroups.inc \_ldapgroups_deny_role()
1 call to _ldapgroups_deny_role()
ldapgroups_user_login in ./ldapgroups.module

File

./ldapgroups.module, line 406

Code

function _ldapgroups_deny_role($user, $rolename) {
  $drupal_role = _ldapgroups_translate_role($rolename);
  $result = db_query("SELECT * FROM {role} WHERE name = '{$drupal_role}'");
  $role_exists = db_num_rows($result);
  if ($role_exists) {
    $role = db_fetch_object($result);
    $result = db_query("SELECT * FROM {users_roles} WHERE uid = {$user->uid} AND rid = {$role->rid}");
    $role_present = db_num_rows($result);
    if ($role_present) {
      db_query("DELETE FROM {users_roles} WHERE uid = {$user->uid} AND rid = {$role->rid}");
    }
  }
}