def outbound_group_filter(sawtooth_group, provider): """Takes in a group dict from queue_outbound and formats it to a provider's specs :param: group > dict > a dictionary representing a group :param: provider > str > inbound provider type (azure, ldap) """ if provider != "azure" and provider != "ldap": raise TypeError("Provider must be specified with a valid option.") group = {} for key, value in GROUP_TRANSFORM.items(): if key in sawtooth_group: group[value[provider]] = sawtooth_group[key] return group
def inbound_group_filter(group, provider): """Takes in a group dict from a provider,standardizes and then returns it. :param: group > dict > dictionary with group payload from provider :param: provider > str """ if provider not in ("azure", "ldap"): raise TypeError("Provider must be specified with a valid option.") standardized_group = {} for key, value in GROUP_TRANSFORM.items(): if value[provider] in group: value = inbound_value_filter(group[value[provider]]) standardized_group[key] = value return standardized_group
def inbound_group_filter(group, provider): """Takes in a group dict from a provider and standardizes the dict and returns it. :param: group > dict > a dictionary representing a group :param: provider > str > inbound provider type (azure, ldap) """ if provider != "azure" and provider != "ldap": raise TypeError("Provider must be specified with a valid option.") clean_group = {} for key, value in GROUP_TRANSFORM.items(): if value[provider] in group: clean_group[key] = group[value[provider]] else: clean_group[key] = None return clean_group
def inbound_group_filter(entry, provider): """Takes in a group dict from a provider and standardizes the dict and returns it. :param: group > dict > a dictionary representing a group :param: provider > str > inbound provider type (azure, ldap) """ if provider not in ("azure", "ldap"): raise TypeError("Provider must be specified with a valid option.") standard_entry = {} for key, alias in GROUP_TRANSFORM.items(): if alias[provider] in entry: value = inbound_value_filter(entry[alias[provider]]) if value: standard_entry[key] = value return standard_entry