function _ldapgroups_deny_role in LDAP integration 5
Same name and namespace in other branches
- 5.2 ldapgroups.module \_ldapgroups_deny_role()
- 6 ldapgroups.inc \_ldapgroups_deny_role()
1 call to _ldapgroups_deny_role()
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}");
}
}
}