def wrap(*args, **kwargs):
        """Decorator to check user is admin"""
        try:
            logger.debug('User authenticating {}'.format(current_user.username))
            if current_user.is_admin:
                return func(args, **kwargs)
        except AttributeError as err:
            logger.debug(err)
            logger.debug('Anonymous user cant be admin')
        return abort(401)
Decorator to check user is admin
crackq/cq_api.py