* serialization/deserialization of the profile file implemented (write-through
semantics)
* cloning of a profile fixed
let debug_print s = if debug then prerr_endline s ;;
Http_common.debug := false ;;
let debug_print s = if debug then prerr_endline s ;;
Http_common.debug := false ;;
+let configuration_file = "/projects/helm/etc/uwobo.conf.xml";;
(* First of all we load the configuration *)
let _ =
(* First of all we load the configuration *)
let _ =
- let configuration_file = "/projects/helm/etc/uwobo.conf.xml" in
Helm_registry.load_from configuration_file
;;
Helm_registry.load_from configuration_file
;;
+let save_configuration () =
+ if not (Helm_registry.has "uwobo.cloned") then
+ Helm_registry.save_to configuration_file
+;;
+
(* other settings *)
let daemon_name = "UWOBO OCaml" ;;
let default_media_type = "text/html" ;;
(* other settings *)
let daemon_name = "UWOBO OCaml" ;;
let default_media_type = "text/html" ;;
let environment =
(* Here I am loosing the current value of port_env_var; *)
(* this should not matter *)
let environment =
(* Here I am loosing the current value of port_env_var; *)
(* this should not matter *)
- Unix.putenv "UWOBO__PORT" (string_of_int port) ;
+ Unix.putenv "uwobo__port" (string_of_int port) ;
+ Unix.putenv "uwobo__cloned" "1" ;
Unix.environment ()
in
(* 4. We exec a new copy of uwobo *)
Unix.environment ()
in
(* 4. We exec a new copy of uwobo *)
(string_of_param_option req "password")
in
short_circuit_grandfather_and_client ~cmd ~cmd_pipe ~res_pipe outchan
(string_of_param_option req "password")
in
short_circuit_grandfather_and_client ~cmd ~cmd_pipe ~res_pipe outchan
- | "/setprofileparam" ->
let cmd = sprintf "setprofileparam %s,%s,%s,%s"
(string_of_param_option req "id")
(string_of_param_option req "password")
let cmd = sprintf "setprofileparam %s,%s,%s,%s"
(string_of_param_option req "id")
(string_of_param_option req "password")
+ save_configuration () ;
output_string res_pipe ("Profile " ^ pid ^ " created. Hi " ^ pid) ;
raise Restart_HTTP_daemon
| _ -> assert false
output_string res_pipe ("Profile " ^ pid ^ " created. Hi " ^ pid) ;
raise Restart_HTTP_daemon
| _ -> assert false
| _ -> assert false
in
Uwobo_profiles.remove pid ?password () ;
| _ -> assert false
in
Uwobo_profiles.remove pid ?password () ;
+ save_configuration () ;
output_string res_pipe "Done" ;
raise Restart_HTTP_daemon
| line when Pcre.pmatch ~rex:setprofileparam_cmd_RE line -> (* /setprofileparam *)
output_string res_pipe "Done" ;
raise Restart_HTTP_daemon
| line when Pcre.pmatch ~rex:setprofileparam_cmd_RE line -> (* /setprofileparam *)
| _ -> assert false
in
Uwobo_profiles.set_param pid ?password ~key ~value () ;
| _ -> assert false
in
Uwobo_profiles.set_param pid ?password ~key ~value () ;
+ save_configuration () ;
output_string res_pipe "Done" ;
raise Restart_HTTP_daemon
| line when Pcre.pmatch ~rex:setpassword_cmd_RE line -> (* /setpassword *)
output_string res_pipe "Done" ;
raise Restart_HTTP_daemon
| line when Pcre.pmatch ~rex:setpassword_cmd_RE line -> (* /setpassword *)
| _ -> assert false
in
Uwobo_profiles.set_password pid ?old_password password ;
| _ -> assert false
in
Uwobo_profiles.set_password pid ?old_password password ;
+ save_configuration () ;
output_string res_pipe "Done" ;
raise Restart_HTTP_daemon
| line when Pcre.pmatch ~rex:setpermission_cmd_RE line -> (* /setpermission *)
output_string res_pipe "Done" ;
raise Restart_HTTP_daemon
| line when Pcre.pmatch ~rex:setpermission_cmd_RE line -> (* /setpermission *)
| _ -> assert false
in
Uwobo_profiles.set_permission pid ?password forwhat value ;
| _ -> assert false
in
Uwobo_profiles.set_permission pid ?password forwhat value ;
+ save_configuration () ;
output_string res_pipe "Done" ;
raise Restart_HTTP_daemon
| cmd -> (* invalid interprocess command received *)
output_string res_pipe "Done" ;
raise Restart_HTTP_daemon
| cmd -> (* invalid interprocess command received *)
is set to false.
</p>
<p>
is set to false.
</p>
<p>
- <b><kbd>setprofileparam?id=id[&password=password]&key=key[&value=value]</kbd></b><br />
+ <b><kbd>setparam?id=id[&password=password]&key=key[&value=value]</kbd></b><br />
sets the property <em>key</em> to <em>value</em>, if <em>value</em> is provided; otherwise
the parameter is unset. The password is required if the profile writing permission is set to
false.
sets the property <em>key</em> to <em>value</em>, if <em>value</em> is provided; otherwise
the parameter is unset. The password is required if the profile writing permission is set to
false.
check_permission pid clone_password `Read ;
to_list_rel ~prefix:(params_key pid) ()
in
check_permission pid clone_password `Read ;
to_list_rel ~prefix:(params_key pid) ()
in
- List.iter (fun (key, value) -> Helm_registry.set_string key value) params ;
+ List.iter (fun (key, value) -> Helm_registry.set_string (params_key pid ^ "." ^ key) value) params ;
Helm_registry.set_bool (read_permission_key pid) read_perm ;
Helm_registry.set_bool (write_permission_key pid) write_perm ;
Helm_registry.set_bool (admin_permission_key pid) admin_perm ;
Helm_registry.set_bool (read_permission_key pid) read_perm ;
Helm_registry.set_bool (write_permission_key pid) write_perm ;
Helm_registry.set_bool (admin_permission_key pid) admin_perm ;