You are here

function ldap_authorization_og1_has_role in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7 ldap_authorization/ldap_authorization_og/ldap_authorization_og.module \ldap_authorization_og1_has_role()

Test if a user has a particular group role

Parameters

int $gid as og group id:

int $uid as user id:

string $rid as og role id:

Return value

boolean signifying if user has group x role

2 calls to ldap_authorization_og1_has_role()
LdapAuthorizationConsumerOG::hasAuthorization in ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php
NOTE this is in mixed case, since we must rely on whatever module is storing the authorization id
LdapAuthorizationOg1Tests::testBasicFunctionsAndApi in ldap_authorization/tests/Og1Tests.test
just make sure install succeeds and og and ldap_authorization_og functions work as designed

File

ldap_authorization/ldap_authorization_og/ldap_authorization_og.module, line 183
controls organic group membership based on LDAP values

Code

function ldap_authorization_og1_has_role($gid, $uid, $rid) {
  $roles = og_get_user_roles($gid, $uid);
  return is_array($roles) && in_array($rid, array_values($roles));
}