Here’s a handly little function called ldapgroups_roles_filter for drupal 4.7.+ and ldap_integration module. This function is called by ldap_integration (specifically, ldapgroups.module) to apply site-specific filters but does not supply any examples.
This specific filter will restrict the role creation to only those LDAP/Active Directory groups specified by ldap_group_role_mappings global var specified in the conf file
function ldapgroups_roles_filter($roles) {
global $ldap_group_role_mappings;
$newroles = array();
// this should take the roles array, pass it thru the filters and send a NEW set of roles back
// the filter
foreach ( $roles as $role ) {
if ( array_search($role, $ldap_group_role_mappings) != FALSE ) {;
// this role is specified -- grant
newroles[] = $role;
}
}
return $newroles;
}
I think mostly Active Directory establishments will find this useful. It is also submitted for review.
technorati tags:drupal, programming, ldap