caps: Fix cap_check when unauthenticated

authlib
informatic 2018-04-07 10:35:44 +02:00
parent 4dd1c63912
commit 80c74deded
1 changed files with 5 additions and 2 deletions

View File

@ -7,7 +7,9 @@ import time
def cap_check(capability, user=None):
if not current_user.is_authenticated:
'''Checks if specified user (or current user) has desired capacifier
capability'''
if not user and not current_user.is_authenticated:
return False
user = user or current_user.get_id()
@ -38,7 +40,8 @@ def caps_cleanup(app, user):
def cap_required(capability):
'''Checks if user has desired capacifier capability'''
'''Decorator to check if user has desired capacifier capability, returns
403 otherwise'''
def inner(func):
@functools.wraps(func)