Added a new global permission for viewing the site anonymously.
authorrich <rich>
Mon, 4 Oct 2004 15:19:56 +0000 (15:19 +0000)
committerrich <rich>
Mon, 4 Oct 2004 15:19:56 +0000 (15:19 +0000)
Added code to use and manage this permission.

Fixed certain scripts which are "CanView"-only.

28 files changed:
cocanwiki.sql
scripts/cocanwiki.ml
scripts/contact.ml
scripts/dead_ends.ml
scripts/edit_host_css.ml
scripts/edit_host_css_form.ml
scripts/edit_host_settings.ml
scripts/edit_host_settings_form.ml
scripts/file.ml
scripts/host_menu.ml
scripts/image.ml
scripts/largest_pages.ml
scripts/mailing_list_confirm.ml
scripts/mailing_list_form.ml
scripts/mailing_list_send.ml
scripts/page.ml
scripts/page_email_confirm.ml
scripts/page_email_form.ml
scripts/page_email_send.ml
scripts/preview.ml
scripts/rss.ml
scripts/search.ml
scripts/send_feedback.ml
scripts/send_feedback_form.ml
scripts/sitemap.ml
scripts/what_links_here.ml
templates/edit_host_settings_form.html
templates/host_menu.html

index 247f915..d4b9514 100644 (file)
@@ -104,7 +104,8 @@ CREATE TABLE hosts (
     feedback_email text,
     mailing_list boolean DEFAULT false NOT NULL,
     is_template boolean DEFAULT false NOT NULL,
-    search_box boolean DEFAULT true NOT NULL
+    search_box boolean DEFAULT true NOT NULL,
+    view_anon boolean DEFAULT true NOT NULL
 );
 
 
index 037c654..981379f 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: cocanwiki.ml,v 1.13 2004/09/27 12:37:54 rich Exp $
+ * $Id: cocanwiki.ml,v 1.14 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -34,13 +34,18 @@ module Pool = DbiPool (Dbi_postgres)
  *)
 let _get_dbh r = Pool.get r "cocanwiki"
 
+(* The "host object". *)
+type host_t = { hostname : string;
+               edit_anon : bool;
+               view_anon : bool }
+
 (* Permissions and restrictions.
  *
  * Use the optional ~restrict parameter to register_script to restrict
  * who can use the script.  For example:
  *   register_script ~restrict:[CanEdit ; CanManageUsers] run
  *)
-type permissions_t = CanEdit | CanManageUsers | CanManageContacts
+type permissions_t = CanView | CanEdit | CanManageUsers | CanManageContacts
                   | CanManageSite | CanEditGlobalCSS
 
 (* The "user object". *)
@@ -48,21 +53,18 @@ type user_t = Anonymous                     (* Not logged in. *)
            | User of int * string * permissions_t list
                                        (* Userid, name, permissions. *)
 
-let test_permission edit_anon perm user =
+let test_permission {edit_anon = edit_anon; view_anon = view_anon} perm user =
   if perm = CanEdit && edit_anon then true
+  else if perm = CanView && view_anon then true
   else match user with
       Anonymous -> false
     | User (_, _, perms) -> List.mem perm perms
 
-let can_edit edit_anon = test_permission edit_anon CanEdit
-let can_manage_users = test_permission false CanManageUsers
-let can_manage_contacts = test_permission false CanManageContacts
-let can_manage_site = test_permission false CanManageSite
-let can_edit_global_css = test_permission false CanEditGlobalCSS
-
-(* The "host object". *)
-type host_t = { hostname : string;
-               edit_anon : bool; }
+let can_edit host = test_permission host CanEdit
+let can_manage_users host = test_permission host CanManageUsers
+let can_manage_contacts host = test_permission host CanManageContacts
+let can_manage_site host = test_permission host CanManageSite
+let can_edit_global_css host = test_permission host CanEditGlobalCSS
 
 (* Our wrapper around the standard [register_script] function.
  *
@@ -92,22 +94,23 @@ let register_script ?(restrict = []) ?(anonymous = true) run =
        (* Get the host ID, by comparing the Host: header with the hostnames
        * table in the database.
        *)
-       let hostid, hostname, edit_anon =
+       let hostid, hostname, edit_anon, view_anon =
         let hostname = try Request.hostname r
         with Not_found -> failwith "No ``Host:'' header in request" in
         let hostname = String.lowercase hostname in
 
         let sth =
           dbh#prepare_cached
-            "select h.id, h.canonical_hostname, h.edit_anon
+            "select h.id, h.canonical_hostname, h.edit_anon, h.view_anon
                 from hostnames hn, hosts h
                where hn.name = ? and hn.hostid = h.id" in
         sth#execute [`String hostname];
 
         try
           (match sth#fetch1 () with
-               [ `Int id; `String hostname; `Bool edit_anon ] ->
-                 id, hostname, edit_anon
+               [ `Int id; `String hostname;
+                 `Bool edit_anon; `Bool view_anon ] ->
+                 id, hostname, edit_anon, view_anon
              | _ -> assert false)
         with
             Not_found ->
@@ -115,7 +118,9 @@ let register_script ?(restrict = []) ?(anonymous = true) run =
                         "the hosts/hostnames tables in the database.") in
 
        (* Create the host object. *)
-       let host = { hostname = hostname; edit_anon = edit_anon; } in
+       let host = { hostname = hostname;
+                   edit_anon = edit_anon;
+                   view_anon = view_anon } in
 
        (* Look for the user's cookie, and determine from this the user
        * object.
@@ -154,7 +159,11 @@ let register_script ?(restrict = []) ?(anonymous = true) run =
                  `Bool can_edit; `Bool can_manage_users;
                  `Bool can_manage_contacts; `Bool can_manage_site;
                  `Bool can_edit_global_css ] ->
-                 let perms = if can_edit then [ CanEdit ] else [] in
+                 (* Every logged in user can view. *)
+                 let perms = [CanView] in
+                 let perms =
+                   if can_edit then CanEdit :: perms
+                   else perms in
                  let perms =
                    if can_manage_users then CanManageUsers :: perms
                    else perms in
@@ -183,15 +192,19 @@ let register_script ?(restrict = []) ?(anonymous = true) run =
               [] -> true               (* empty list = no restrictions *)
             | rs ->
                 List.fold_left (||) false
-                  (List.map (fun r -> test_permission edit_anon r user) rs) in
+                  (List.map (fun r -> test_permission host r user) rs) in
 
        if permitted then (
         (* Call the actual CGI script. *)
         run r q dbh hostid host user
-       ) else
-        error ~back_button:true
-          ~title:"Access denied"
-          q "You do not have permission to access this part of the site."
+       ) else (
+        if user = Anonymous then
+          q#redirect ("http://" ^ hostname ^ "/_login")
+        else
+          error ~back_button:true
+            ~title:"Access denied"
+            q "You do not have permission to access this part of the site."
+       )
     )
 
 (* Convert a section name into something valid for use in <a name="...">
index 7cf8ac5..584e3f3 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: contact.ml,v 1.5 2004/09/27 12:37:54 rich Exp $
+ * $Id: contact.ml,v 1.6 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -157,4 +157,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user =
     q "An email was sent and you should receive a reply shortly."
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index c2623a9..1fe5d04 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: dead_ends.ml,v 1.1 2004/09/28 11:51:38 rich Exp $
+ * $Id: dead_ends.ml,v 1.2 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -54,4 +54,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   q#template template
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 4f036e7..b1a0b5c 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_host_css.ml,v 1.1 2004/09/22 11:41:03 rich Exp $
+ * $Id: edit_host_css.ml,v 1.2 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -54,4 +54,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
        "Note: You must RELOAD the page to see changes to stylesheets.")
 
 let () =
-  register_script run
+  register_script ~restrict:[CanEdit] run
index 7a673c6..3a51d28 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_host_css_form.ml,v 1.1 2004/09/22 11:41:03 rich Exp $
+ * $Id: edit_host_css_form.ml,v 1.2 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -44,4 +44,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   q#template template
 
 let () =
-  register_script run
+  register_script ~restrict:[CanEdit] run
index fd85e17..0e2ffde 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_host_settings.ml,v 1.4 2004/09/27 16:21:09 rich Exp $
+ * $Id: edit_host_settings.ml,v 1.5 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -42,6 +42,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ =
   let feedback_email = q#param "feedback_email" in
   let mailing_list = q#param_true "mailing_list" in
   let search_box = q#param_true "search_box" in
+  let view_anon = q#param_true "view_anon" in
 
   let theme_css = if theme_css = "" then `Null else `String theme_css in
   let feedback_email =
@@ -51,10 +52,11 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ =
   let sth = dbh#prepare_cached "update hosts set edit_anon = ?,
                                   create_account_anon = ?, theme_css = ?,
                                   feedback_email = ?, mailing_list = ?,
-                                  search_box = ?
+                                  search_box = ?, view_anon = ?
                                 where id = ?" in
   sth#execute [`Bool edit_anon; `Bool create_account_anon;
               theme_css; feedback_email; `Bool mailing_list; `Bool search_box;
+              `Bool view_anon;
               `Int hostid];
 
   dbh#commit ();
index ce92f53..3da216e 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_host_settings_form.ml,v 1.3 2004/09/27 16:21:09 rich Exp $
+ * $Id: edit_host_settings_form.ml,v 1.4 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -44,24 +44,24 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   let sth =
     dbh#prepare_cached
       "select canonical_hostname, edit_anon, create_account_anon, theme_css,
-              feedback_email, mailing_list, search_box
+              feedback_email, mailing_list, search_box, view_anon
          from hosts where id = ?" in
   sth#execute [`Int hostid];
 
   let canonical_hostname, edit_anon, create_account_anon, theme_css,
-      feedback_email, mailing_list, search_box =
+      feedback_email, mailing_list, search_box, view_anon =
     match sth#fetch1 () with
        [ `String canonical_hostname;
          `Bool edit_anon; `Bool create_account_anon;
          (`String _ | `Null) as theme_css;
          (`String _ | `Null) as feedback_email;
-         `Bool mailing_list; `Bool search_box ] ->
+         `Bool mailing_list; `Bool search_box; `Bool view_anon ] ->
          let theme_css =
            match theme_css with `String s -> s | `Null -> "" in
          let feedback_email =
            match feedback_email with `String s -> s | `Null -> "" in
          canonical_hostname, edit_anon, create_account_anon, theme_css,
-         feedback_email, mailing_list, search_box
+         feedback_email, mailing_list, search_box, view_anon
       | _ -> assert false in
 
   template#set "canonical_hostname" canonical_hostname;
@@ -70,6 +70,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   template#set "feedback_email" feedback_email;
   template#conditional "mailing_list" mailing_list;
   template#conditional "search_box" search_box;
+  template#conditional "view_anon" view_anon;
 
   (* Themes table. *)
   let table =
index 0084d12..d495f80 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: file.ml,v 1.6 2004/09/27 12:37:54 rich Exp $
+ * $Id: file.ml,v 1.7 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -58,4 +58,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   print_string r data
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index ee67282..8dd3462 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: host_menu.ml,v 1.3 2004/09/27 16:21:09 rich Exp $
+ * $Id: host_menu.ml,v 1.4 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -36,21 +36,21 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
       "select h.canonical_hostname, h.css is not null, h.edit_anon,
               h.create_account_anon, h.theme_css is not null,
               t.name, t.description, h.feedback_email, h.mailing_list,
-              h.search_box
+              h.search_box, h.view_anon
          from hosts h left outer join themes t on h.theme_css = t.theme_css
         where h.id = ?" in
   sth#execute [`Int hostid];
 
   let canonical_hostname, has_global_css, edit_anon, create_account_anon,
       has_theme_css, theme_name, theme_description, has_feedback_email,
-      feedback_email, mailing_list, search_box =
+      feedback_email, mailing_list, search_box, view_anon =
     match sth#fetch1 () with
        [ `String canonical_hostname; `Bool has_global_css;
          `Bool edit_anon; `Bool create_account_anon; `Bool has_theme_css;
          (`String _ | `Null) as theme_name;
          (`String _ | `Null) as theme_description;
          (`String _ | `Null) as feedback_email;
-         `Bool mailing_list; `Bool search_box ] ->
+         `Bool mailing_list; `Bool search_box; `Bool view_anon ] ->
          let theme_name =
            match theme_name with `String s -> s | `Null -> "" in
          let theme_description =
@@ -61,7 +61,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
              | `Null -> "", false in
          canonical_hostname, has_global_css, edit_anon, create_account_anon,
          has_theme_css, theme_name, theme_description, has_feedback_email,
-         feedback_email, mailing_list, search_box
+         feedback_email, mailing_list, search_box, view_anon
       | _ -> assert false in
 
   template#set "canonical_hostname" canonical_hostname;
@@ -75,6 +75,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   template#set "feedback_email" feedback_email;
   template#conditional "mailing_list" mailing_list;
   template#conditional "search_box" search_box;
+  template#conditional "view_anon" view_anon;
 
   q#template template
 
index 2515dcd..e569d44 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: image.ml,v 1.6 2004/09/27 12:37:54 rich Exp $
+ * $Id: image.ml,v 1.7 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -61,4 +61,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   print_string r data
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 2b7fd72..f47d8b3 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: largest_pages.ml,v 1.2 2004/09/28 11:51:38 rich Exp $
+ * $Id: largest_pages.ml,v 1.3 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -72,4 +72,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   q#template template
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 4c181ce..c1308e6 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: mailing_list_confirm.ml,v 1.2 2004/09/24 16:45:02 rich Exp $
+ * $Id: mailing_list_confirm.ml,v 1.3 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -58,4 +58,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
        "You are now on our mailing list.")
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 041c451..d2c4a1e 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: mailing_list_form.ml,v 1.1 2004/09/24 16:41:16 rich Exp $
+ * $Id: mailing_list_form.ml,v 1.2 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -33,4 +33,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   q#template template
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 6fd1a19..5974e13 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: mailing_list_send.ml,v 1.3 2004/09/24 17:11:57 rich Exp $
+ * $Id: mailing_list_send.ml,v 1.4 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -97,4 +97,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ =
        "first link in that email to confirm.")
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index a98e688..52debcc 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: page.ml,v 1.24 2004/09/27 18:08:02 rich Exp $
+ * $Id: page.ml,v 1.25 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -53,7 +53,10 @@ let split_qs_re = Pcre.regexp "\\?"
 
 let xhtml_re = Pcre.regexp "<.*?>|[^<>]+"
 
-let run r (q : cgi) (dbh : Dbi.connection) hostid {edit_anon=edit_anon} user =
+let run r (q : cgi) (dbh : Dbi.connection) hostid
+    ({ edit_anon = edit_anon;
+       view_anon = view_anon } as host)
+    user =
   let template_page = get_template dbh hostid "page.html" in
   let template_404  = get_template dbh hostid "page_404.html" in
 
@@ -74,11 +77,11 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {edit_anon=edit_anon} user =
       | _ -> assert false in
 
   (* Can the user edit?  Manage users?  etc. *)
-  let can_edit = can_edit edit_anon user in
-  let can_manage_users = can_manage_users user in
-  let can_manage_contacts = can_manage_contacts user in
-  let can_manage_site = can_manage_site user in
-  let can_edit_global_css = can_edit_global_css user in
+  let can_edit = can_edit host user in
+  let can_manage_users = can_manage_users host user in
+  let can_manage_contacts = can_manage_contacts host user in
+  let can_manage_site = can_manage_site host user in
+  let can_edit_global_css = can_edit_global_css host user in
 
   (* Do we have a stats page set up? *)
   let has_stats = server_settings_stats_page dbh <> None in
@@ -381,4 +384,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {edit_anon=edit_anon} user =
   loop page 0
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 67adf66..8eea8d6 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: page_email_confirm.ml,v 1.1 2004/09/24 15:53:57 rich Exp $
+ * $Id: page_email_confirm.ml,v 1.2 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -60,4 +60,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
        "an email whenever that page is updated.")
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 53c51ae..cb9188f 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: page_email_form.ml,v 1.1 2004/09/24 15:53:57 rich Exp $
+ * $Id: page_email_form.ml,v 1.2 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -44,4 +44,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   q#template template
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 9fa7318..f2726d7 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: page_email_send.ml,v 1.1 2004/09/24 15:53:57 rich Exp $
+ * $Id: page_email_send.ml,v 1.2 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -98,4 +98,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ =
        "first link in that email to confirm.")
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index b1b65af..6fd0a2b 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: preview.ml,v 1.4 2004/09/09 12:21:22 rich Exp $
+ * $Id: preview.ml,v 1.5 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -37,4 +37,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   print_string r xhtml
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 5d35898..379c36a 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: rss.ml,v 1.1 2004/09/20 15:34:36 rich Exp $
+ * $Id: rss.ml,v 1.2 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -86,4 +86,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} _ =
   q#template ~content_type:"text/xml" template
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 2022cdb..bf27600 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: search.ml,v 1.4 2004/09/09 12:21:22 rich Exp $
+ * $Id: search.ml,v 1.5 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -38,4 +38,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ =
   q#redirect query
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 6841b71..682b8f6 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: send_feedback.ml,v 1.2 2004/09/23 11:56:47 rich Exp $
+ * $Id: send_feedback.ml,v 1.3 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -89,4 +89,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user =
     q "An email has been sent to the site administrators."
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 8b0803d..7d09410 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: send_feedback_form.ml,v 1.2 2004/09/26 17:49:46 rich Exp $
+ * $Id: send_feedback_form.ml,v 1.3 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -37,4 +37,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   q#template template
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index c5df858..4db9ed0 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: sitemap.ml,v 1.6 2004/09/09 12:21:22 rich Exp $
+ * $Id: sitemap.ml,v 1.7 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -72,4 +72,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ =
   q#template template
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 0202ee9..f05994c 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: what_links_here.ml,v 1.2 2004/09/28 11:56:52 rich Exp $
+ * $Id: what_links_here.ml,v 1.3 2004/10/04 15:19:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -69,4 +69,4 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   q#template template
 
 let () =
-  register_script run
+  register_script ~restrict:[CanView] run
index 415c05b..3ad8626 100644 (file)
@@ -17,6 +17,7 @@
 <tr>
 <th> Global permissions: </th>
 <td>
+<input type="checkbox" name="view_anon" value="1" ::if(view_anon)::checked="checked"::end:: id="view_anon"/><label for="view_anon">Allow anyone to see the site</label> <br/>
 <input type="checkbox" name="edit_anon" value="1" ::if(edit_anon)::checked="checked"::end:: id="edit_anon"/><label for="edit_anon">Allow anonymous edits</label> <br/>
 <input type="checkbox" name="create_account_anon" value="1" ::if(create_account_anon)::checked="checked"::end:: id="create_account_anon"/><label for="create_account_anon">Allow anyone to create accounts</label>
 </td>
index 61f448b..f44337e 100644 (file)
 <a href="/_bin/edit_host_css_form.cmo">Edit global stylesheet ...</a> </td>
 </tr>
 <tr>
+<th> Allow anyone to see the site: </th>
+<td> ::if(view_anon)::Yes::else::No (private / intranet site)::end:: </td>
+</tr>
+<tr>
 <th> Allow anonymous edits: </th>
 <td> ::if(edit_anon)::Yes::else::No::end:: </td>
 </tr>