Created
December 4, 2013 12:37
-
-
Save bogsio/7786811 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def restricted(f): | |
def decorated_f(user): | |
if user is None or not user.is_admin: | |
return None | |
return f(user) | |
return decorated_f | |
[...] | |
@restricted | |
def userlist(user): | |
return 'This is the whole registered user list. [Sensitive data]' | |
@restricted | |
def inventory(user): | |
return 'This is the inventory resource. [Sensitive data]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment