From 50799fee9a4c3906fe0ab9988df83af2109fa269 Mon Sep 17 00:00:00 2001 From: rich Date: Mon, 4 Oct 2004 15:19:56 +0000 Subject: [PATCH] Added a new global permission for viewing the site anonymously. Added code to use and manage this permission. Fixed certain scripts which are "CanView"-only. --- cocanwiki.sql | 3 +- scripts/cocanwiki.ml | 59 +++++++++++++++++++++------------- scripts/contact.ml | 4 +-- scripts/dead_ends.ml | 4 +-- scripts/edit_host_css.ml | 4 +-- scripts/edit_host_css_form.ml | 4 +-- scripts/edit_host_settings.ml | 6 ++-- scripts/edit_host_settings_form.ml | 11 ++++--- scripts/file.ml | 4 +-- scripts/host_menu.ml | 11 ++++--- scripts/image.ml | 4 +-- scripts/largest_pages.ml | 4 +-- scripts/mailing_list_confirm.ml | 4 +-- scripts/mailing_list_form.ml | 4 +-- scripts/mailing_list_send.ml | 4 +-- scripts/page.ml | 19 ++++++----- scripts/page_email_confirm.ml | 4 +-- scripts/page_email_form.ml | 4 +-- scripts/page_email_send.ml | 4 +-- scripts/preview.ml | 4 +-- scripts/rss.ml | 4 +-- scripts/search.ml | 4 +-- scripts/send_feedback.ml | 4 +-- scripts/send_feedback_form.ml | 4 +-- scripts/sitemap.ml | 4 +-- scripts/what_links_here.ml | 4 +-- templates/edit_host_settings_form.html | 1 + templates/host_menu.html | 4 +++ 28 files changed, 110 insertions(+), 84 deletions(-) diff --git a/cocanwiki.sql b/cocanwiki.sql index 247f915..d4b9514 100644 --- a/cocanwiki.sql +++ b/cocanwiki.sql @@ -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 ); diff --git a/scripts/cocanwiki.ml b/scripts/cocanwiki.ml index 037c654..981379f 100644 --- a/scripts/cocanwiki.ml +++ b/scripts/cocanwiki.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/contact.ml b/scripts/contact.ml index 7cf8ac5..584e3f3 100644 --- a/scripts/contact.ml +++ b/scripts/contact.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/dead_ends.ml b/scripts/dead_ends.ml index c2623a9..1fe5d04 100644 --- a/scripts/dead_ends.ml +++ b/scripts/dead_ends.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/edit_host_css.ml b/scripts/edit_host_css.ml index 4f036e7..b1a0b5c 100644 --- a/scripts/edit_host_css.ml +++ b/scripts/edit_host_css.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/edit_host_css_form.ml b/scripts/edit_host_css_form.ml index 7a673c6..3a51d28 100644 --- a/scripts/edit_host_css_form.ml +++ b/scripts/edit_host_css_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/edit_host_settings.ml b/scripts/edit_host_settings.ml index fd85e17..0e2ffde 100644 --- a/scripts/edit_host_settings.ml +++ b/scripts/edit_host_settings.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 (); diff --git a/scripts/edit_host_settings_form.ml b/scripts/edit_host_settings_form.ml index ce92f53..3da216e 100644 --- a/scripts/edit_host_settings_form.ml +++ b/scripts/edit_host_settings_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 = diff --git a/scripts/file.ml b/scripts/file.ml index 0084d12..d495f80 100644 --- a/scripts/file.ml +++ b/scripts/file.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/host_menu.ml b/scripts/host_menu.ml index ee67282..8dd3462 100644 --- a/scripts/host_menu.ml +++ b/scripts/host_menu.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/image.ml b/scripts/image.ml index 2515dcd..e569d44 100644 --- a/scripts/image.ml +++ b/scripts/image.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/largest_pages.ml b/scripts/largest_pages.ml index 2b7fd72..f47d8b3 100644 --- a/scripts/largest_pages.ml +++ b/scripts/largest_pages.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/mailing_list_confirm.ml b/scripts/mailing_list_confirm.ml index 4c181ce..c1308e6 100644 --- a/scripts/mailing_list_confirm.ml +++ b/scripts/mailing_list_confirm.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/mailing_list_form.ml b/scripts/mailing_list_form.ml index 041c451..d2c4a1e 100644 --- a/scripts/mailing_list_form.ml +++ b/scripts/mailing_list_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/mailing_list_send.ml b/scripts/mailing_list_send.ml index 6fd1a19..5974e13 100644 --- a/scripts/mailing_list_send.ml +++ b/scripts/mailing_list_send.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/page.ml b/scripts/page.ml index a98e688..52debcc 100644 --- a/scripts/page.ml +++ b/scripts/page.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/page_email_confirm.ml b/scripts/page_email_confirm.ml index 67adf66..8eea8d6 100644 --- a/scripts/page_email_confirm.ml +++ b/scripts/page_email_confirm.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/page_email_form.ml b/scripts/page_email_form.ml index 53c51ae..cb9188f 100644 --- a/scripts/page_email_form.ml +++ b/scripts/page_email_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/page_email_send.ml b/scripts/page_email_send.ml index 9fa7318..f2726d7 100644 --- a/scripts/page_email_send.ml +++ b/scripts/page_email_send.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/preview.ml b/scripts/preview.ml index b1b65af..6fd0a2b 100644 --- a/scripts/preview.ml +++ b/scripts/preview.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/rss.ml b/scripts/rss.ml index 5d35898..379c36a 100644 --- a/scripts/rss.ml +++ b/scripts/rss.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/search.ml b/scripts/search.ml index 2022cdb..bf27600 100644 --- a/scripts/search.ml +++ b/scripts/search.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/send_feedback.ml b/scripts/send_feedback.ml index 6841b71..682b8f6 100644 --- a/scripts/send_feedback.ml +++ b/scripts/send_feedback.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/send_feedback_form.ml b/scripts/send_feedback_form.ml index 8b0803d..7d09410 100644 --- a/scripts/send_feedback_form.ml +++ b/scripts/send_feedback_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/sitemap.ml b/scripts/sitemap.ml index c5df858..4db9ed0 100644 --- a/scripts/sitemap.ml +++ b/scripts/sitemap.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/scripts/what_links_here.ml b/scripts/what_links_here.ml index 0202ee9..f05994c 100644 --- a/scripts/what_links_here.ml +++ b/scripts/what_links_here.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 diff --git a/templates/edit_host_settings_form.html b/templates/edit_host_settings_form.html index 415c05b..3ad8626 100644 --- a/templates/edit_host_settings_form.html +++ b/templates/edit_host_settings_form.html @@ -17,6 +17,7 @@ Global permissions: +

diff --git a/templates/host_menu.html b/templates/host_menu.html index 61f448b..f44337e 100644 --- a/templates/host_menu.html +++ b/templates/host_menu.html @@ -19,6 +19,10 @@
Edit global stylesheet ... + Allow anyone to see the site: + ::if(view_anon)::Yes::else::No (private / intranet site)::end:: + + Allow anonymous edits: ::if(edit_anon)::Yes::else::No::end:: -- 1.8.3.1