Example #1
0
 def get_roles(self):
     try:
         if current_user.is_superuser():
             return super().get_roles()
     except AttributeError:
         pass
     user_roles = current_user.get_roles()
     roles = super().get_roles()
     return {
         key: list(set(values) & set(user_roles))
         for key, values in roles.items()
     }
Example #2
0
 def is_accessible(self):
     return (
         not AUTHENTICATE or
         (not current_user.is_anonymous() and current_user.is_superuser())
     )
Example #3
0
 def is_accessible(self):
     return (not AUTHENTICATE or (not current_user.is_anonymous
                                  and current_user.is_superuser()))
Example #4
0
 def endpoints(self):
     if current_user.is_superuser():
         return super().endpoints()
     user_roles = current_user.get_roles()
     endpoints = super().endpoints()
     return self._filter(endpoints, user_roles)
Example #5
0
 def is_superuser():
     return current_user.is_superuser()
Example #6
0
 def wrapper(*args, **kwargs):
     if not current_user.is_superuser():
         abort(401)
     return func(*args, **kwargs)
Example #7
0
 def is_accessible(self):
     return not current_user.is_anonymous() and current_user.is_superuser()