Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- user = {"username ": "joesey", "access_level" : "admin"}
- def make_secure(func):
- def secure_function():
- if user["access_level"] == "admin":
- return func()
- else:
- return f"No admin permission for {user['username']}"
- return secure_function()
- @make_secure # get_admin_password = make_secure(get_admin_password)
- def get_admin_password():
- return 1234
- print(get_admin_password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement