{= # # # # save_data.cfv (report options) # # # include "templates.util.base_util"; include "templates.util.rbac.rbac_util"; string profile_name = internal.profile_name; string session_id = volatile.session_id; bool is_root_admin = get_is_root_admin(); string page_token = v.fp.page_token; # # Check RBAC permissions # if ((is_root_admin or get_config_feature_permission(session_id, profile_name, "report_options", "edit")) and get_is_valid_page_token(session_id, "report_options", page_token)) then ( debug_message("#### save_data.cfv\n" . node_as_string("v.fp") . "\n"); # remove page_token node so that it doesn't become saved in the profile delete_node("v.fp.page_token"); node profile = "profiles." . profile_name; subroutine(override_report_options_in_profile( node source_node, node profile), ( node item; string item_path; foreach item source_node ( if (num_subnodes(item) == 0) then ( # Override profile option profile . replace_first(item, "v.fp", "") = @item; ) else ( # Recursively call override_report_options_in_profile override_report_options_in_profile(item, profile); ); ); )); override_report_options_in_profile("v.fp", profile); # debug_message("\n" . node_as_string(profile{"statistics"}) . "\n"); # debug_message("\n" . node_as_string(profile{"output"}) . "\n"); save_node(profile); # # # Response # # "saveReportOptionsResponse()\n"; ) else ( # No permission to access this resource (URL) display_no_permission_html(); ); =}