27 lines
962 B
Python
27 lines
962 B
Python
from risotto.utils import multi_function as _multi_function
|
|
|
|
|
|
@_multi_function
|
|
def calc_oauth2_client_external(external, location, *extras):
|
|
if not external or not location or None in extras:
|
|
if isinstance(external, list):
|
|
return []
|
|
return
|
|
if isinstance(external, list):
|
|
return [f'https://{exter}{location[0]}' + ''.join(extras) for exter in external]
|
|
return f'https://{external}{location[0]}' + ''.join(extras)
|
|
|
|
|
|
def calc_oauth2_client_login(external, location, *extras):
|
|
if not external or not location or None in extras:
|
|
return
|
|
if isinstance(external, list):
|
|
return f'https://{external[0]}{location[0]}' + ''.join(extras)
|
|
return f'https://{external}{location[0]}' + ''.join(extras)
|
|
|
|
|
|
@_multi_function
|
|
def calc_oauth2_families(families: list) -> list:
|
|
def _calc_family(family):
|
|
return family if family else 'users'
|
|
return [_calc_family(family) for family in families]
|