You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# When we ran `secure_function`, we checked the user's access level. Because at that point the user was not an admin, the function did not `return func`. Therefore `get_admin_password` is set to `None`.
# We want to delay overwriting until we run the function
defget_admin_password():
return"1234"
defmake_secure(func):
defsecure_function():
ifuser["access_level"] =="admin":
returnfunc()
returnsecure_function
get_admin_password=make_secure(
get_admin_password
) # `get_admin_password` is now `secure_func` from above