public function LdapAuthorizationConsumerOG::og1Revokes in Lightweight Directory Access Protocol (LDAP) 8.2
1 call to LdapAuthorizationConsumerOG::og1Revokes()
- LdapAuthorizationConsumerOG::grantsAndRevokes in ldap_authorization/
ldap_authorization_og/ LdapAuthorizationConsumerOG.class.php
File
- ldap_authorization/
ldap_authorization_og/ LdapAuthorizationConsumerOG.class.php, line 652
Class
Code
public function og1Revokes($og_actions, &$user, &$user_auth_data) {
$group_audience_gids = empty($user->{OG_AUDIENCE_FIELD}[LANGUAGE_NONE]['gid']) ? array() : $user->{OG_AUDIENCE_FIELD}[LANGUAGE_NONE]['gid'];
foreach ($og_actions['revokes'] as $gid => $rids) {
$existing_roles = og_get_user_roles($gid, $user->uid);
if (in_array($this->defaultMembershipRid, array_values($existing_roles))) {
// ungroup and set audience
foreach ($group_audience_gids as $i => $_audience_gid) {
if ($_audience_gid == $gid) {
unset($user->{OG_AUDIENCE_FIELD}[LANGUAGE_NONE][$i]);
}
}
og_entity_presave($user, 'user');
$user = og_ungroup($gid, 'user', $user, TRUE);
foreach (array_values($existing_roles) as $rid) {
$consumer_id = ldap_authorization_og_authorization_id($gid, $rid);
if (isset($user_auth_data[$consumer_id])) {
unset($user_auth_data[$consumer_id]);
}
}
}
else {
foreach ($existing_roles as $rid) {
if ($rid != $this->defaultMembershipRid && $this->defaultMembershipRid != 1) {
og_role_revoke($gid, $user->uid, $rid);
unset($user_auth_data[ldap_authorization_og_authorization_id($gid, $rid)]);
}
}
}
}
}