2022-05-07 08:11:18 +02:00
|
|
|
from risotto.utils import multi_function as _multi_function
|
|
|
|
|
|
|
|
|
|
|
|
@_multi_function
|
2022-03-12 07:56:17 +01:00
|
|
|
def calc_oauth2_client_external(external, location, *extras):
|
|
|
|
if not external or not location or None in extras:
|
2022-08-18 10:19:43 +02:00
|
|
|
if isinstance(external, list):
|
|
|
|
return []
|
2022-03-12 07:56:17 +01:00
|
|
|
return
|
2022-05-07 08:11:18 +02:00
|
|
|
if isinstance(external, list):
|
|
|
|
return [f'https://{exter}{location[0]}' + ''.join(extras) for exter in external]
|
2022-03-12 07:56:17 +01:00
|
|
|
return f'https://{external}{location[0]}' + ''.join(extras)
|
2022-06-26 19:33:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
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]
|