def process_organization(user_properties, organization_username=None, organization_key=None, private=False): if not "user_upload_token" in user_properties or not "MAPSettingsUserKey" in user_properties: print_error( "Error, can not authenticate to validate organization import, upload token or user key missing in the config." ) sys.exit(1) user_key = user_properties["MAPSettingsUserKey"] user_upload_token = user_properties["user_upload_token"] if not organization_key and organization_username: try: organization_key = uploader.get_organization_key( user_key, organization_username, user_upload_token) except: print_error("Error, could not obtain organization key, exiting...") sys.exit(1) # validate key try: uploader.validate_organization_key(user_key, organization_key, user_upload_token) except: print_error("Error, organization key validation failed, exiting...") sys.exit(1) # validate privacy try: uploader.validate_organization_privacy(user_key, organization_key, private, user_upload_token) except: print_error( "Error, organization privacy validation failed, exiting...") sys.exit(1) return organization_key
def process_organization(user_properties, organization_username=None, organization_key=None, private=False): if not "user_upload_token" in user_properties or not "MAPSettingsUserKey" in user_properties: print( "Error, can not authenticate to validate organization import, upload token or user key missing in the config.") sys.exit() user_key = user_properties["MAPSettingsUserKey"] user_upload_token = user_properties["user_upload_token"] if not organization_key and organization_username: try: organization_key = uploader.get_organization_key(user_key, organization_username, user_upload_token) except: print("Error, could not obtain organization key, exiting...") sys.exit() # validate key try: uploader.validate_organization_key(user_key, organization_key, user_upload_token) except: print("Error, organization key validation failed, exiting...") sys.exit() # validate privacy try: uploader.validate_organization_privacy(user_key, organization_key, private, user_upload_token) except: print("Error, organization privacy validation failed, exiting...") sys.exit() return organization_key