{= # # # evaluate_param_conditions.cfv # This evaluates one or more snapon parameter conditions send from the client # and responds with the result. # include "templates.util.rbac.rbac_util"; include "templates.util.encoding"; include "templates.util.snapon_parameters.evaluate_param_cond_util"; debug_message("#### evaluate_param_conditions.cfv \n"); string session_id = volatile.session_id; bool is_root_admin = get_is_root_admin(); string page_token = v.fp.page_token; string profile_name = v.fp.profile_name; # # Check RBAC permissions # if (is_root_admin or (get_admin_feature_permission(session_id, "profiles", "add") and get_is_valid_page_token(session_id, "new_profile_wizard", page_token)) or (get_config_feature_permission(session_id, profile_name, "log_source", "view") and get_is_valid_page_token(session_id, "log_source", page_token))) then ( debug_message("\n" . node_as_string("v.fp") . "\n"); node the_conditions = "v.fp.conditions"; node item; string element_id_of_parameter_with_condition; string item_dat; string condition_value; string dat = "["; foreach item the_conditions ( element_id_of_parameter_with_condition = @item{"element_id_of_parameter_with_condition"}; condition_value = get_snapon_parameter_item_condition_value(item); item_dat = "{"; item_dat .= add_json("elementIdOfParameterWithCondition", element_id_of_parameter_with_condition, "string"); item_dat .= add_json("conditionValue", condition_value, "bool"); item_dat = close_json(item_dat); dat .= item_dat . ","; ); dat = replace_last(dat, ",", "]"); # # Response # 'snaponParameters.evaluateConditionsResponse(' . dat . ')\n'; ) else ( # No permission to view this resource (URL) display_no_permission_html(); ); =}