Skip to content

Instantly share code, notes, and snippets.

@bogsio
Created December 4, 2013 12:37
Show Gist options
  • Save bogsio/7786811 to your computer and use it in GitHub Desktop.
Save bogsio/7786811 to your computer and use it in GitHub Desktop.
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