Ejemplo n.º 1
0
 def decorator(*args, **kwargs):
     user_data = get_current_user_data()
     if user_data is None:
         return not_logged_in(callback, *args, **kwargs)
     if not has_permission(user_data.get('role'), resource, action):
         if callback is None:
             return current_app.auth.not_permitted_callback(*args, **kwargs)
         else:
             return callback(*args, **kwargs)
         return callback(*args, **kwargs)
     return func(*args, **kwargs)
Ejemplo n.º 2
0
 def decorator(*args, **kwargs):
     user_data = get_current_user_data()
     if user_data is None:
         return not_logged_in(callback, *args, **kwargs)
     if not has_permission(user_data.get('role'), resource, action):
         if callback is None:
             return current_app.auth.not_permitted_callback(
                 *args, **kwargs)
         else:
             return callback(*args, **kwargs)
         return callback(*args, **kwargs)
     return func(*args, **kwargs)
Ejemplo n.º 3
0
 def load_current_user(cls, apply_timeout=True):
     data = get_current_user_data(apply_timeout)
     if not data:
         return None
     return cls.query.filter(cls.username==data['username']).one()
Ejemplo n.º 4
0
 def load_current_user(cls, apply_timeout=True):
     data = get_current_user_data(apply_timeout)
     if not data:
         return None
     return cls.query.filter(cls.username == data['username']).one()