You are here

public function LdapAuthorizationConsumerOG::hasAuthorization in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7.2 ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php \LdapAuthorizationConsumerOG::hasAuthorization()

NOTE this is in mixed case, since we must rely on whatever module is storing the authorization id

Parameters

drupal user object $user:

string lowercase case $consumer_id such as drupal role name, og group name, etc.:

Return value

param boolean is user has authorization id, regardless of what module granted it.

Overrides LdapAuthorizationConsumerAbstract::hasAuthorization

File

ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php, line 357

Class

LdapAuthorizationConsumerOG

Code

public function hasAuthorization(&$user, $consumer_id) {
  if ($this->ogVersion == 1) {
    $result = FALSE;
    list($gid, $rid) = $this
      ->og1ConsumerIdParts($consumer_id);
    return ldap_authorization_og1_has_membership($gid, $user->uid) && ldap_authorization_og1_has_role($gid, $user->uid, $rid);
  }
  else {
    return ldap_authorization_og2_has_consumer_id($consumer_id, $user->uid);
  }
}