Пример #1
0
def delete_rulesets_sync_job(request):
    def after_check():
        request_json = get_post_request_json(request)
        sync_scheduler.delete_scheduler(request_json, request.user)
        result = ResponseBuilder().get_data()
        return JsonResponse(data=result)

    return action_permission_check(request, after_check)
Пример #2
0
def admin_console_git_country_path_edit(request):
    def after_check():
        request_json = get_post_request_json(request)
        result_data = update_git_country_path(request_json)
        result = ResponseBuilder(data=result_data).get_data()
        return JsonResponse(data=result)

    return action_permission_check(request, after_check)
Пример #3
0
def create_module(request):
    def after_check():
        request_json = get_post_request_json(request)
        serializer = ModuleSerializer(data=request_json)
        serializer.is_valid(raise_exception=True)
        serializer.save()

    return action_permission_check(request, after_check)
Пример #4
0
def update_rulesets_sync_job(request):
    def after_check():
        request_json = get_post_request_json(request)
        scheduler = sync_scheduler.update_scheduler(request_json, request.user)
        data = RulesetSyncSchedulerBuilder(request.user, scheduler).get_data()
        result = ResponseBuilder(data=data).get_data()
        return JsonResponse(data=result)

    return action_permission_check(request, after_check)
Пример #5
0
def run_rulesets_sync_job(request):
    def after_check():
        request_json = get_post_request_json(request)
        parser = CreateRulesetSyncSchedulerParser(request_json, request.user)
        run_in_background(sync.sync_up_rulesets_without_scheduler, parser)
        result = ResponseBuilder().get_data()
        return JsonResponse(data=result)

    return action_permission_check(request, after_check)
Пример #6
0
def run_ruleset_report_job(request):
    def after_check():
        request_json = get_post_request_json(request)
        run_in_background(report_scheduler.run_scheduler_now, request_json,
                          request.user)
        result = ResponseBuilder().get_data()
        return JsonResponse(data=result)

    return action_permission_check(request, after_check)
Пример #7
0
def apply_ruleset_to_server(request):
    def after_check():
        request_json = get_post_request_json(request)
        result_data = sync.sync_up_ruleset_from_backup(request_json,
                                                       request.user)
        result = ResponseBuilder(data=result_data).get_data()
        return JsonResponse(data=result)

    return action_permission_check(request, after_check)
Пример #8
0
def update_report_scheduler_status(request):
    def after_check():
        request_json = get_post_request_json(request)
        scheduler = report_scheduler_services.update_scheduler_status(
            request_json, request.user)
        data = SharedStorageReportSchedulerBuilder(request.user,
                                                   scheduler).get_data()
        result = ResponseBuilder(data=data).get_data()
        return JsonResponse(data=result)

    return action_permission_check(request, after_check)
Пример #9
0
def run_report_scheduler_job(request):
    def after_check():
        request_json = get_post_request_json(request)
        info_log(KEY_M_SHARED_STORAGE,
                 "run report scheduler, scheduler id =" + str(request_json))
        run_in_background(report_scheduler_services.run_scheduler_now,
                          request_json, request.user)
        result = ResponseBuilder().get_data()
        return JsonResponse(data=result)

    return action_permission_check(request, after_check)
Пример #10
0
def update_report_scheduler_job(request):
    def after_check():
        request_json = get_post_request_json(request)
        info_log(KEY_M_SHARED_STORAGE,
                 "update report scheduler, request json =" + str(request_json))
        scheduler_info = report_scheduler_services.update_scheduler(
            request_json, request.user, request.get_host())
        info_data = SharedStorageReportSchedulerBuilder(
            request.user, scheduler_info).get_data()
        result = ResponseBuilder(data=info_data).get_data()
        return JsonResponse(data=result)

    return action_permission_check(request, after_check)
Пример #11
0
def update_ruleset_report_job(request):
    def after_check():
        request_json = get_post_request_json(request)
        info_log(
            "API",
            "update report job scheduler, request json =" + str(request_json))
        scheduler_info = report_scheduler.update_report_scheduler(
            request_json, request.user)
        info_data = RulesetReportSchedulerBuilder(request.user,
                                                  scheduler_info).get_data()
        result = ResponseBuilder(data=info_data).get_data()
        return JsonResponse(data=result)

    return action_permission_check(request, after_check)