You are here

function LdapAuthorizationOg1Tests::manualOgGroup in Lightweight Directory Access Protocol (LDAP) 8.2

1 call to LdapAuthorizationOg1Tests::manualOgGroup()
LdapAuthorizationOg1Tests::testLogons in ldap_authorization/tests/Og1Tests.test
authorization configuration flags tests clumped together

File

ldap_authorization/tests/Og1Tests.test, line 135

Class

LdapAuthorizationOg1Tests

Code

function manualOgGroup($user, $gid, $extra_rids = array()) {
  $values = array(
    'entity' => $user,
    'entity_type' => 'user',
  );
  $user->{OG_AUDIENCE_FIELD}[LANGUAGE_NONE][] = array(
    'gid' => $gid,
  );
  og_entity_presave($user, 'user');
  $user = user_save($user);
  foreach ($extra_rids as $rid) {
    og_role_grant($gid, $user->uid, $rid);
  }
  return user_load($user->uid, TRUE);
}