Пример #1
0
def entitytype_name_from_dn(dn):
    """
    Return the entitytype name from a Distinguished Name
    """
    parts = explode(dn)

    return parts[-1][0]
Пример #2
0
def entitytype_name_from_dn(dn):
    """
    Return type of last component of distinguished name
    """
    try:
        return explode(dn)[-1][0]
    except IndexError:
        raise InvalidDistinguishedNameError
Пример #3
0
def get_parent_ids(conn, base_entity, entitytype):
    """
    Return parent ids for entitytype related to base_entity.
    """
    dn_parts = explode(base_entity.dn)

    indexes = type_indexes(dn_parts, entitytype.name)

    res = []
    for index in indexes:
        if index < len(dn_parts) - 1:  # I want parents! not base_entity.
            res.append(get_entity(conn, implode(dn_parts[:index + 1])).id)

    return res