#262 LDAP roles to groups (ldapAuthorization)

오픈
mrzootzooty3 년 전을 오픈 · 0개의 코멘트
mrzootzooty 코멘트됨, 3 년 전

when you use this with openldap, the userDN does not match what the memberID will be.

the userDn is "uid=abc.abc,dc=example,dc=com" but the memberID within the group is abc.abc

i needed to change plugins/LdapCommon/LdapCommon.php and the function is_dn_member_of_group to be

function is_dn_member_of_group($userDn, $groupDn)
{
    $ldap = $this->get_ldap_connection();
    $link = $ldap->getLink();

just get the username and remove the rest

    $spos = strpos($userDn, "=");
    if ($spos == true) { $spos = strpos($userDn, ","); $userDn = substr($userDn, 4, $spos-4); }

now do the compare

    $r = @ldap_compare($link, $groupDn, $this->uniqueMember_attribute, $userDn);

but i suppose that changing LdapAuthorizationPlugin.php and the function hasRole to check both the full userDn and just the username would be better

when you use this with openldap, the userDN does not match what the memberID will be. the userDn is "uid=abc.abc,dc=example,dc=com" but the memberID within the group is abc.abc i needed to change plugins/LdapCommon/LdapCommon.php and the function is_dn_member_of_group to be function is_dn_member_of_group($userDn, $groupDn) { $ldap = $this->get_ldap_connection(); $link = $ldap->getLink(); # just get the username and remove the rest $spos = strpos($userDn, "="); if ($spos == true) { $spos = strpos($userDn, ","); $userDn = substr($userDn, 4, $spos-4); } # now do the compare $r = @ldap_compare($link, $groupDn, $this->uniqueMember_attribute, $userDn); but i suppose that changing LdapAuthorizationPlugin.php and the function hasRole to check both the full userDn and just the username would be better
로그인하여 이 대화에 참여
마일스톤 없음
담당자 없음
참여자 1명
로딩중...
취소
저장
아직 콘텐츠가 없습니다.