function _ldapgroups_deny_role in LDAP integration 6
Same name and namespace in other branches
- 5.2 ldapgroups.module \_ldapgroups_deny_role()
- 5 ldapgroups.module \_ldapgroups_deny_role()
Deny a user with a role.
Parameters
$account: A user object.
$rolename: A name of the role.
1 call to _ldapgroups_deny_role()
- ldapgroups_user_login in ./
ldapgroups.inc - Implements hook_user() login operation.
File
- ./
ldapgroups.inc, line 211 - ldapgroups include file.
Code
function _ldapgroups_deny_role($account, $rolename) {
$result = db_query("SELECT * FROM {role} WHERE LOWER(name) = LOWER('%s')", $rolename);
if ($row = db_fetch_object($result)) {
$result = db_query("SELECT * FROM {users_roles} WHERE uid = %d AND rid = %d", $account->uid, $row->rid);
if (db_fetch_object($result)) {
db_query("DELETE FROM {users_roles} WHERE uid = %d AND rid = %d", $account->uid, $row->rid);
}
}
}