You are here

function LdapAuthorizationConsumerOG::__construct 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::__construct()
  2. 7 ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php \LdapAuthorizationConsumerOG::__construct()

Constructor Method

Parameters

string $consumer_type e.g. drupal_role, og_group:

array $params as associative array of default properties:

Overrides LdapAuthorizationConsumerAbstract::__construct

File

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

Class

LdapAuthorizationConsumerOG

Code

function __construct($consumer_type) {
  $this->ogVersion = ldap_authorization_og_og_version();
  if ($this->ogVersion == 1) {
    $this->defaultMembershipRid = ldap_authorization_og1_role_name_to_role_id(OG_AUTHENTICATED_ROLE);
    $this->anonymousRid = ldap_authorization_og1_role_name_to_role_id(OG_ANONYMOUS_ROLE);
  }
  else {

    //@todo these properties are not used in ldap og 2, but when they are their derivation needs to be examined and tested

    // as they may be per entity rids, not global.
    $this->defaultMembershipRid = NULL;

    // ldap_authorization_og_rid_from_role_name(OG_AUTHENTICATED_ROLE);
    $this->anonymousRid = NULL;

    //ldap_authorization_og_rid_from_role_name(OG_ANONYMOUS_ROLE);
  }
  $params = ldap_authorization_og_ldap_authorization_consumer();
  parent::__construct('og_group', $params['og_group']);
}