def admin_console_sync_scheduler_update_page(request, scheduler_id): def check_visibility(): check_function_visibility(request, KEY_F_AUTO_SYNC_TASK, KEY_M_RULESET) scheduler = RulesetSyncUpScheduler.objects.get(id=scheduler_id) check_scheduler_detail_visibility(request.user.id, scheduler.source_environment.id, scheduler.target_environment.id, scheduler.country_list.all(), KEY_F_AUTO_SYNC_TASK, KEY_M_RULESET) def get_visible_data(): enable_environment_list = enable_environments(request.user.id, KEY_F_AUTO_SYNC_TASK, KEY_M_RULESET) sync_from_environment_list = enable_sync_from_environments( KEY_M_RULESET) sync_to_environment_list = enable_sync_to_environments(KEY_M_RULESET) enable_sync_from_env_list = list( set(enable_environment_list).intersection( set(sync_from_environment_list))) enable_sync_to_env_list = list( set(enable_environment_list).intersection( set(sync_to_environment_list))) return [enable_sync_from_env_list, enable_sync_to_env_list] def after_check(visible_data): data = SyncSchedulerUpdatePageBuilder(request.user, scheduler_id, visible_data[0], visible_data[1]).get_data() return render(request, "sync_scheduler_update.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_git_country_path_list_page(request): def check_visibility(): pass check_function_visibility(request, KEY_F_GIT_PATH_MANGER, KEY_M_SETTING) def get_visible_data(): return GitCountryPath.objects.filter(module__name=KEY_M_RULESET).values() def after_check(visible_data): check_function_visibility(request, KEY_F_GIT_PATH_MANGER, KEY_M_SETTING) data = GitCountryPathListBuilder(request.user, visible_data).get_data() return render(request, "git_country_path_list.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_server_log_page(request, log_type=None): def check_visibility(): check_function_visibility(request, KEY_F_SERVER_LOG, KEY_M_RULESET) def get_visible_data(): pass def after_check(visible_data): check_function_visibility(request, KEY_F_SERVER_LOG, KEY_M_RULESET) data = server_log_page(request.user, log_type) return render(request, "server_log.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_ruleset_log_detail_page(request, log_id): def check_visibility(): check_function_visibility(request, KEY_F_RULESET_LOG, KEY_M_RULESET) check_ruleset_log_detail_visibility(request.user.id, log_id) def get_visible_data(): pass def after_check(visible_data): data = log.get_ruleset_log_detail(request.user, log_id) return render(request, "ruleset_log_detail.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_ruleset_log_list_page_change(request): def check_visibility(): check_function_visibility(request, KEY_F_RULESET_LOG, KEY_M_RULESET) def get_visible_data(): pass def after_check(visible_data): request_json = get_post_request_json(request) data = log.get_ruleset_log_list(request.user, request_json, False) return render(request, "ruleset_log_list.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_recover_ruleset_backup_list_page(request): def check_visibility(): check_function_visibility(request, KEY_F_RECOVERY, KEY_M_RULESET) def get_visible_data(): pass def after_check(visible_data): request_json = get_post_request_json(request) result_data = recover.filter_backup_list(request.user, request_json) return render(request, "backup_data_view.html", result_data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_report_scheduler_list_page(request): def check_visibility(): check_function_visibility(request, KEY_F_REPORT_TASK, KEY_M_RULESET) def get_visible_data(): return ReportSchedulerInfo.objects.get_visible_schedulers( request.user.id, KEY_M_RULESET) def after_check(visible_data): data = RulesetReportSchedulersBuilder(request.user, visible_data).get_data() return render(request, "scheduler_list.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_report_scheduler_create_page(request): def check_visibility(): check_function_visibility(request, KEY_F_REPORT_TASK, KEY_M_RULESET) def get_visible_data(): environments = enable_environments_data(request.user.id, KEY_F_REPORT_TASK, KEY_M_RULESET) return environments def after_check(visible_data): data = ReportSchedulerCreatePageBuilder(request.user, visible_data).get_data() return render(request, "scheduler_create.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_report_scheduler_update_page(request, scheduler_id): def check_visibility(): check_function_visibility(request, KEY_F_REPORT_TASK, KEY_M_SHARED_STORAGE) def get_visible_data(): regions = compare_services.get_active_region_list() return regions def after_check(visible_data): data = ReportSchedulerUpdatePageBuilder(request.user, visible_data, scheduler_id).get_data() return render(request, "shared_storage_report_scheduler_update.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_report_scheduler_list_page(request): def check_visibility(): check_function_visibility(request, KEY_F_REPORT_TASK, KEY_M_SHARED_STORAGE) def get_visible_data(): return SharedStorageReportScheduler.objects.get_visible_schedulers( request.user.id) def after_check(visible_data): data = SharedStorageSchedulersBuilder(request.user, visible_data).get_data() return render(request, "shared_storage_report_scheduler_list.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_sync_scheduler_list_page(request): def check_visibility(): check_function_visibility(request, KEY_F_AUTO_SYNC_TASK, KEY_M_RULESET) def get_visible_data(): environment_list = enable_environments(request.user.id, KEY_F_AUTO_SYNC_TASK, KEY_M_RULESET) return RulesetSyncUpScheduler.objects.filter_environments_and_countries( request.user.id, environment_list) def after_check(visible_data): data = RulesetSyncSchedulersBuilder(request.user, visible_data).get_data() return render(request, "sync_scheduler_list.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_recover_ruleset_filtered_environment_page(request): def check_visibility(): check_function_visibility(request, KEY_F_RECOVERY, KEY_M_RULESET) def get_visible_data(): request_json = get_post_request_json(request) environment_id = request_json.get(key.RULE_KEY_ENVIRONMENT_ID) countries = recover.filter_country(environment_id) enable_country_list = enable_countries(request.user.id, environment_id) union_list = get_union(countries, enable_country_list) return union_list def after_check(visible_data): data = RecoveryPageFilterCountriesBuilder(request.user, visible_data).get_data() return render(request, "select_country_dropdown.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_recover_ruleset_filtered_page(request): def check_visibility(): check_function_visibility(request, KEY_F_RECOVERY, KEY_M_RULESET) def get_visible_data(): environment_list = recover.filter_environment() enable_environment_list = enable_environments(request.user.id, KEY_F_RECOVERY, KEY_M_RULESET) union_list = get_union(environment_list, enable_environment_list) return union_list def after_check(visible_data): data = RecoveryPageFilterEnvironmentsBuilder(request.user, visible_data).get_data() return render(request, "recovery.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_sync_scheduler_create_page(request): def check_visibility(): check_function_visibility(request, KEY_F_AUTO_SYNC_TASK, KEY_M_RULESET) enable_environment_list = enable_environments(request.user.id, KEY_F_AUTO_SYNC_TASK, KEY_M_RULESET) sync_from_environment_list = enable_sync_from_environments( KEY_M_RULESET) sync_to_environment_list = enable_sync_to_environments(KEY_M_RULESET) # check data visibility if len(sync_from_environment_list) == 0 and len( sync_to_environment_list) == 0: raise NoAvailableDataError if len(get_union(enable_environment_list, sync_from_environment_list)) == 0 or \ len(get_union(enable_environment_list, sync_to_environment_list)) == 0: raise PermissionDeniedError def get_visible_data(): enable_environment_list = enable_environments(request.user.id, KEY_F_AUTO_SYNC_TASK, KEY_M_RULESET) sync_from_environment_list = enable_sync_from_environments( KEY_M_RULESET) sync_to_environment_list = enable_sync_to_environments(KEY_M_RULESET) enable_sync_from_env_list = list( set(enable_environment_list).intersection( set(sync_from_environment_list))) enable_sync_to_env_list = list( set(enable_environment_list).intersection( set(sync_to_environment_list))) return [enable_sync_from_env_list, enable_sync_to_env_list] def after_check(visible_data): data = SyncSchedulerCreatePageBuilder(request.user, visible_data[0], visible_data[1]).get_data() return render(request, "sync_scheduler_create.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)
def admin_console_report_scheduler_update_page(request, scheduler_id): def check_visibility(): check_function_visibility(request, KEY_F_REPORT_TASK, KEY_M_RULESET) scheduler = ReportSchedulerInfo.objects.get(id=scheduler_id) check_scheduler_detail_visibility(request.user.id, scheduler.base_environment.id, scheduler.compare_environment.id, scheduler.country_list.all(), KEY_F_REPORT_TASK, KEY_M_RULESET) def get_visible_data(): environments = enable_environments_data(request.user.id, KEY_F_REPORT_TASK, KEY_M_RULESET) return environments def after_check(visible_data): data = ReportSchedulerUpdatePageBuilder(request.user, visible_data, scheduler_id).get_data() return render(request, "report_scheduler_update.html", data) return page_permission_check(request, check_visibility, get_visible_data, after_check)