Esempio n. 1
0
def _resolve_identity_as_unique_user_id(identity_filter, organization):
    """Takes an identity name, email, alias, or id, and returns the unique_user_id.
    """
    if identity_filter.find(' ') > 0 or identity_filter.find('@') > 0:
        return identity_filter
    if identity_filter.lower() == ME:
        identity = get_current_identity(organization)
    else:
        # For alias
        identity = resolve_identity(identity_filter, organization)
    if identity is not None:
        return get_account_from_identity(identity)
    return None
Esempio n. 2
0
def _resolve_identity_as_unique_user_id(identity_filter, organization):
    """Takes an identity name, email, alias, or id, and returns the unique_user_id.
    """
    if identity_filter.lower() == ME:
        identity = get_current_identity(organization)
    else:
        identity = resolve_identity(identity_filter, organization)
    if identity is not None:
        descriptor = identity.descriptor
        semi_pos = identity.descriptor.find(';')
        if semi_pos >= 0:
            descriptor = descriptor[semi_pos + 1:]
        return descriptor
    return None