Beispiel #1
0
 def check_roles(handler, *args, **kwargs):
     principal = handler.principal
     if principal:
         principal_roles = principal.roles
         for role in roles:
             if role in principal_roles:
                 break
         else:
             return unauthorized()
         return func(handler, *args, **kwargs)
     else:
         return unauthorized()
Beispiel #2
0
 def check_authenticated(handler, *args, **kwargs):
     if handler.principal:
         return func(handler, *args, **kwargs)
     else:
         return unauthorized()