{= # # # convert_profile.cfv # # include "templates.util.base_util"; include "templates.util.rbac.rbac_util"; include "templates.util.encoding"; debug_message("\n\n#### convert_profile.cfv START \n\n"); # debug_message("\n" . node_as_string("v.fp") . "\n"); string session_id = volatile.session_id; bool is_root_admin = get_is_root_admin(); string page_token = v.fp.page_token; # # Check RBAC permissions (only root admin can convert profiles) # if (is_root_admin and get_is_valid_page_token(session_id, "profiles", page_token)) then ( string profile_name = v.fp.profile_name; # # # Convert the profile with -a cv8p via exec # # string cmd = ""; v.options.1 = "background"; v.options.2 = "-p"; v.options.3 = profile_name; v.options.4 = "-a"; v.options.5 = "cv8p"; string task_id = exec(cmd, "v.options", false); # # Save the task_id and profile_name in LAI/system.cfg so that we can # check for any active conversion later on. # "system.convert_version_80_profile.task_id" = task_id; "system.convert_version_80_profile.profile_name" = profile_name; save_node("system"); # # # Send response # # 'profiles.convertProfileResponse("' . task_id . '")'; ) else ( # No permission to view this resource (URL) display_no_permission_html(); ); =}