Пример #1
0
 def get(self, right_name):
     """
     Get a specific right
     """
     right = Right.from_db(right_name)
     if not right:
         api.abort(404, 'No such right')
     return right, 200
Пример #2
0
 def wrapped(*args, **kwargs):
     from kovaak_stats.models.right import Right
     right = Right.from_db(rightname)
     if not right:
         abort(403, '{} right doesn\'t exist'.format(rightname))
     if right not in get_current_user().rights:
         abort(403, 'You don\'t have the right {} required to do the request'.format(rightname))
     return f(*args, **kwargs)
Пример #3
0
 def delete(self, right_name):
     """
     Delete a specific right
     """
     right = Right.from_db(right_name)
     if not right:
         api.abort(404, 'No such right')
     right.delete()
     db.session.commit()
     return '', 204
Пример #4
0
def check_right(name):
    right = Right.from_db(name)
    if not right:
        print('Right {} doesn\'t exist'.format(name), file=sys.stderr)
        sys.exit(1)
    return right