def admin_get(admin_id=None): if settings.app.demo_mode: resp = utils.demo_get_cache() if resp: return utils.jsonify(resp) if not flask.g.administrator.super_user: return utils.jsonify({ 'error': REQUIRES_SUPER_USER, 'error_msg': REQUIRES_SUPER_USER_MSG, }, 400) if admin_id: return utils.jsonify(auth.get_by_id(admin_id).dict()) admins = [] for admin in auth.iter_admins(): admin = admin.dict() admin['audit'] = settings.app.auditing == ALL admins.append(admin) if settings.app.demo_mode: utils.demo_set_cache(admins) return utils.jsonify(admins)
def admin_get(admin_id=None): if settings.app.demo_mode: resp = utils.demo_get_cache() if resp: return utils.jsonify(resp) if not flask.g.administrator.super_user: return utils.jsonify( { 'error': REQUIRES_SUPER_USER, 'error_msg': REQUIRES_SUPER_USER_MSG, }, 400) if admin_id: return utils.jsonify(auth.get_by_id(admin_id).dict()) admins = [] for admin in auth.iter_admins(): admin = admin.dict() admin['audit'] = settings.app.auditing == ALL admins.append(admin) if settings.app.demo_mode: utils.demo_set_cache(admins) return utils.jsonify(admins)
def admin_get(admin_id=None): if admin_id: return utils.jsonify(auth.get_by_id(admin_id).dict()) admins = [] for admin in auth.iter_admins(): admins.append(admin.dict()) return utils.jsonify(admins)
def admin_get(admin_id=None): if not flask.g.administrator.super_user: return utils.jsonify({"error": REQUIRES_SUPER_USER, "error_msg": REQUIRES_SUPER_USER_MSG}, 400) if admin_id: return utils.jsonify(auth.get_by_id(admin_id).dict()) admins = [] for admin in auth.iter_admins(): admins.append(admin.dict()) return utils.jsonify(admins)
def admin_get(admin_id=None): if not flask.g.administrator.super_user: return utils.jsonify({ 'error': REQUIRES_SUPER_USER, 'error_msg': REQUIRES_SUPER_USER_MSG, }, 400) if admin_id: return utils.jsonify(auth.get_by_id(admin_id).dict()) admins = [] for admin in auth.iter_admins(): admins.append(admin.dict()) return utils.jsonify(admins)