function ldap_authorization_og1_entity_id_to_gid in Lightweight Directory Access Protocol (LDAP) 7
Same name and namespace in other branches
- 8.2 ldap_authorization/ldap_authorization_og/ldap_authorization_og.module \ldap_authorization_og1_entity_id_to_gid()
Convert entity id to group id
Parameters
int $entity_id as id of entity associated with organic group:
Return value
int og group id
1 call to ldap_authorization_og1_entity_id_to_gid()
- LdapAuthorizationConsumerOG::normalizeMappings in ldap_authorization/
ldap_authorization_og/ LdapAuthorizationConsumerOG.class.php - function to normalize mappings should be overridden when mappings are not stored as map|authorization_id format where authorization_id is the format returned by LdapAuthorizationConsumerAbstract::usersAuthorizations()
File
- ldap_authorization/
ldap_authorization_og/ ldap_authorization_og.module, line 64 - controls organic group membership based on LDAP values
Code
function ldap_authorization_og1_entity_id_to_gid($entity_id) {
$gid = db_select('og', 'og')
->fields('og', array(
'gid',
))
->condition('og.etid', $entity_id, '=')
->range(0, 1)
->execute()
->fetchField();
return $gid && is_scalar($gid) ? $gid : FALSE;
}