Created
August 6, 2020 15:06
-
-
Save r3dm1ke/e8cb5cea874f2536fcfc4a3cf80058a1 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 permission_decorator(permission): | |
def _permission_decorator(func): | |
def permission_wrapper(*args, **kwargs): | |
if someUserApi.hasPermission(permission): | |
result = func(*args, **kwargs) | |
return result | |
return None | |
return permission wrapper | |
return _permission_decorator | |
@permission_decorator('admin') | |
def delete_user(user): | |
someUserApi.deleteUser(user) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment