MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / mfa_user_registered

Function mfa_user_registered

web/pgadmin/authenticate/mfa/utils.py:197–219  ·  view source on GitHub ↗

A ternary method to enable calling either of the methods based on the condition - if the user is registed for any of the auth methods. When current user is registered for any of the supported auth method, then the 'registered' method is executed, otherwise - 'not_registered' method

(registered, not_registered)

Source from the content-addressed store, hash-verified

195
196
197def mfa_user_registered(registered, not_registered) -> None:
198 """
199 A ternary method to enable calling either of the methods based on the
200 condition - if the user is registed for any of the auth methods.
201
202 When current user is registered for any of the supported auth method, then
203 the 'registered' method is executed, otherwise - 'not_registered' method is
204 executed.
205
206 Args:
207 registered (Callable[[], None]) : Method to be executed when
208 registered.
209 not_registered (Callable[[], None]): Method to be executed when not
210 registered
211
212 Returns:
213 None: Expecting the methods to return None as it will not be consumed.
214
215 NOTE: Removed the typing anotation as it was giving errors.
216 """
217
218 return registered() if len(user_supported_mfa_methods()) > 0 else \
219 not_registered()
220
221
222def mfa_session_authenticated(authenticated, unauthenticated):

Callers 1

check_user_registeredFunction · 0.90

Calls 1

Tested by 1

check_user_registeredFunction · 0.72