You are here

function ldap_authorization_og_rid_from_role_name in Lightweight Directory Access Protocol (LDAP) 7

Same name and namespace in other branches
  1. 8.2 ldap_authorization/ldap_authorization_og/ldap_authorization_og.module \ldap_authorization_og_rid_from_role_name()
  2. 7.2 ldap_authorization/ldap_authorization_og/ldap_authorization_og.module \ldap_authorization_og_rid_from_role_name()

Derive og role id from role name

Parameters

string $role_name as og role name:

Return value

int og role id

2 calls to ldap_authorization_og_rid_from_role_name()
LdapAuthorizationConsumerOG::normalizeMappings in ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php
function to normalize mappings should be overridden when mappings are not stored as map|authorization_id format where authorization_id is the format returned by LdapAuthorizationConsumerAbstract::usersAuthorizations()
ldap_authorization_og1_has_role in ldap_authorization/ldap_authorization_og/ldap_authorization_og.module
Test if a user has a particular group role

File

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

Code

function ldap_authorization_og_rid_from_role_name($role_name) {
  $roles = og_roles(0);
  $rids = array_flip($roles);
  return isset($rids[$role_name]) ? $rids[$role_name] : FALSE;
}