public static function LdapAuthorizationConsumerOG::og2Groups in Lightweight Directory Access Protocol (LDAP) 7
4 calls to LdapAuthorizationConsumerOG::og2Groups()
- LdapAuthorizationConsumerOG::_setConsumerIDs in ldap_authorization/
ldap_authorization_og/ LdapAuthorizationConsumerOG.class.php - LdapAuthorizationOg2Tests::testBasicFunctionsAndApi in ldap_authorization/
tests/ Og/ Og2.test - just make sure install succeeds and
- ldap_authorization_og2_get_group in ldap_authorization/
ldap_authorization_og/ ldap_authorization_og.module - Generic function to convert between query values and organic groups structures and attributes
- ldap_authorization_og2_rid_from_role_name in ldap_authorization/
ldap_authorization_og/ ldap_authorization_og.module - Derive og role id from role name
File
- ldap_authorization/
ldap_authorization_og/ LdapAuthorizationConsumerOG.class.php, line 73
Class
Code
public static function og2Groups() {
$ogs = array();
$availableConsumerIDs = array();
foreach (og_get_all_group_bundle() as $entity_type => $bundles) {
$group_entity_ids = og_get_all_group($entity_type);
$group_entities = entity_load($entity_type, $group_entity_ids);
$ogs[$entity_type] = $group_entities;
foreach ($group_entities as $entity_id => $group_entity) {
$roles = og_roles($entity_type, isset($group_entity->type) ? $group_entity->type : NULL, $entity_id);
$ogs[$entity_type][$entity_id] = array(
'roles' => $roles,
'entity' => $group_entity,
'name' => isset($group_entity->title) ? $group_entity->title : '',
);
foreach ($roles as $rid => $role) {
$auth_id = ldap_authorization_og_authorization_id($entity_id, $rid, $entity_type);
$availableConsumerIDs[$auth_id] = $ogs[$entity_type][$entity_id]['name'] . " - {$role}";
}
}
}
return array(
$ogs,
$availableConsumerIDs,
);
}