]> matita.cs.unibo.it Git - helm.git/commitdiff
Added matitaweb administration panel.
authorWilmer Ricciotti <ricciott@cs.unibo.it>
Thu, 23 Jun 2011 14:03:05 +0000 (14:03 +0000)
committerWilmer Ricciotti <ricciott@cs.unibo.it>
Thu, 23 Jun 2011 14:03:05 +0000 (14:03 +0000)
matitaB/matita/admin.html [new file with mode: 0644]
matitaB/matita/matitaAuthentication.ml
matitaB/matita/matitaAuthentication.mli
matitaB/matita/matitaFilesystem.ml
matitaB/matita/matitaFilesystem.mli
matitaB/matita/matitadaemon.ml

diff --git a/matitaB/matita/admin.html b/matitaB/matita/admin.html
new file mode 100644 (file)
index 0000000..a10a4a5
--- /dev/null
@@ -0,0 +1,13 @@
+<html>
+       <head>
+       </head>
+       <body>
+               <H1>Matitaweb Administration Panel</H1>
+               <p>
+               <FORM action="reset" method="post">
+               Reset user tables, delete user libraries
+               <input type="SUBMIT" value="Reset"/>
+               </FORM>
+               </p>
+       </body>
+</html>
index ad6bec47d6915bad556bc737660a4e723ce7e49b..a183bc42033d8ed14ef487c86a79e68043ba978b 100644 (file)
@@ -120,3 +120,10 @@ let add_user uid pw =
     user_tbl := (uid,(pw,None))::!user_tbl;
     serialize ()
 ;;
+
+let reset () =
+  user_tbl := [];
+  session_tbl := [];
+  MatitaFilesystem.reset_lib ();
+  serialize ();
+;;
index e47df783c1ca36adf5517572ba28d0fd52e5a694..41f0304af736c5ae49cfd5f1f99b09f5ae4f320e 100644 (file)
@@ -52,3 +52,5 @@ val serialize : unit -> unit
 val deserialize : unit -> unit
 
 val add_user : string -> string -> unit
+
+val reset : unit -> unit
index 4abdf6c28a8d56dba1d0d3b19b107786a9371816..aef55c3b6428247e68c9d404af45a5c3421612b7 100644 (file)
@@ -108,3 +108,8 @@ let html_of_library uid =
   prerr_endline "BEGIN TREE";prerr_endline res;prerr_endline "END TREE";
   res
 ;;
+
+let reset_lib () =
+  let to_be_removed = (Helm_registry.get "matita.rt_base_dir") ^ "/users/*" in
+  Sys.command ("rm -rf " ^ to_be_removed)
+;;
index e04500e284e0e7c8840a3b1debb12945db2ad8c6..275ebff5b1661771b6a4196d03b77146ffa73305 100644 (file)
@@ -3,3 +3,5 @@ exception SvnError of string;;
 val checkout : string -> unit
 
 val html_of_library : string -> string
+
+val reset_lib : unit -> unit
index 92b1ce45c76267f66575ebb8671461a10035e9a4..c1bcab0d7bffbdbe394a9406a2f3c6b70ecb4fe7 100644 (file)
@@ -431,6 +431,20 @@ let viewLib (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
   
 ;;
 
+let resetLib (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
+  let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
+  MatitaAuthentication.reset ();
+    cgi # set_header 
+      ~cache:`No_cache 
+      ~content_type:"text/html; charset=\"utf-8\""
+      ();
+    
+    cgi#out_channel#output_string
+      ("<html><head>\n" ^
+       "<title>Matitaweb Reset</title>\n" ^
+       "<body><H1>Reset completed</H1></body></html>");
+    cgi#out_channel#commit_work()
+
 open Netcgi1_compat.Netcgi_types;;
 
 (**********************************************************************)