コード例 #1
0
ファイル: sram-sync.py プロジェクト: HarryKodden/sram-sync
 def create_for_ldap_entry(cls, ldap_entry):
     uid = read_ldap_attribute(ldap_entry, 'uid')
     mail = read_ldap_attribute(ldap_entry, 'mail')
     cn = read_ldap_attribute(ldap_entry, 'cn')
     display_name = read_ldap_attribute(ldap_entry, 'displayName')
     # TO DO: here we could decided whether to use the cn or uid as displayName...
     return LdapUser(uid, cn, mail, display_name)
コード例 #2
0
def get_ldap_co(ldap_entry):
    o = read_ldap_attribute(ldap_entry, 'o')
    if '.' in o:
        key = o #o.split(".")[1]
        displayName = read_ldap_attribute(ldap_entry, 'displayName')
        description = read_ldap_attribute(ldap_entry, 'description')
        return {"key": key, "o": o, "description": description, "display_name": displayName}
    else:
        # this could happen when searching for scope_subtree, then the 'ordered" organization is found, which doesnt comply with the naming schema
        return {"key": o, "o": o, "description": None, "display_name": None}
コード例 #3
0
ファイル: sram-sync.py プロジェクト: HarryKodden/sram-sync
 def create_for_ldap_entry(cls, ldap_entry):
     group_name = read_ldap_attribute(ldap_entry, 'cn')
     # get us an array of all member-attributes, which contains
     # DNs: [ b'cn=empty-membership-placeholder',  b'[email protected],ou=users,dc=datahubmaastricht,dc=nl', ...]
     group_member_dns = ldap_entry.get(LDAP_GROUP_MEMBER_ATTR, [b""])
     group_member_uids = list(
         filter(lambda x: x is not None,
                map(LdapGroup.get_group_member_uids, group_member_dns)))
     return LdapGroup(group_name, group_member_uids)
コード例 #4
0
 def create_for_ldap_entry(cls, ldap_entry):
     uid = read_ldap_attribute(ldap_entry, 'uid')
     unique_id = read_ldap_attribute(ldap_entry, 'eduPersonUniqueId')
     mail = read_ldap_attribute(ldap_entry, 'mail')
     cn = read_ldap_attribute(ldap_entry, 'cn')
     display_name = read_ldap_attribute(ldap_entry, 'displayName')
     external_id = read_ldap_attribute(ldap_entry, 'voPersonExternalID')
     external_affiliation = read_ldap_attribute(ldap_entry, 'voPersonExternalAffiliation')
     return LdapUser(uid, unique_id, cn, mail, display_name, external_id, external_affiliation)
コード例 #5
0
    def create_for_ldap_entry(cls, ldap_entry):
        cn = read_ldap_attribute(ldap_entry, 'cn')
        unique_id = read_ldap_attribute(ldap_entry, 'uniqueIdentifier')
        # Focus on CO groups only.
        # If we need to sync other groups as well, we need to adjust for the ':' character,
        # since iRODS will fail on groupnames with that character!

        cn_parts = cn.split('.')
        co_key = ".".join( cn_parts[0:2] )
        group_name = cn_parts[1]

        unique_id = read_ldap_attribute(ldap_entry, LDAP_GROUP_UNIQUE_ID)

        # get us an array of all member-attributes, which contains
        # DNs: [ b'cn=empty-membership-placeholder',  b'[email protected],ou=users,dc=datahubmaastricht,dc=nl', ...]
        group_member_dns = ldap_entry.get(LDAP_GROUP_MEMBER_ATTR, [b""])
        group_member_uids = list(
            filter(lambda x: x is not None, map(LdapGroup.get_group_member_uids, group_member_dns)))

        return LdapGroup(unique_id, cn, co_key, group_name, group_member_uids)