You are here

public function LdapAuthorizationConsumerOG::convertToFriendlyAuthorizationIds in Lightweight Directory Access Protocol (LDAP) 7

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

*

Parameters

array authorization ids in "normalized" format of 2-2, 3-2, etc.: * @return array friendly authorization is names such as Bakers Groups Member, or Knitters Groups Admin Member

Overrides LdapAuthorizationConsumerAbstract::convertToFriendlyAuthorizationIds

File

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

Class

LdapAuthorizationConsumerOG

Code

public function convertToFriendlyAuthorizationIds($authorizations) {
  $authorization_ids_friendly = array();
  $this
    ->refreshConsumerIDs();
  foreach ($authorizations as $i => $authorization_id) {
    if ($this->ogVersion == 1) {
      list($gid, $rid) = explode('-', $authorization_id);
      $authorization_ids_friendly[] = 'Group: ' . $this->ogs[$gid]->label . ', Role: ' . $this->ogRoles[$rid] . " ({$authorization_id}) ";
    }
    else {

      // @todo make this fiendly authorization ids work\
      list($entity_type, $gid, $rid) = explode(':', $authorization_id);
      $authorization_ids_friendly[] = 'Group: ' . $this->ogs[$entity_type][$gid]['name'] . ', Role: ' . $this->ogs[$entity_type][$gid]['roles'][$rid] . " ({$authorization_id}) ";
    }
  }
  return $authorization_ids_friendly;
}