From: rich Date: Wed, 26 Jul 2006 16:34:18 +0000 (+0000) Subject: Control of the can_edit_macros user permission. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=1814b0903af9c4c6c9f04b1f227f38a2a411e071;p=cocanwiki.git Control of the can_edit_macros user permission. --- diff --git a/scripts/create_user.ml b/scripts/create_user.ml index e8e136e..8cad0de 100644 --- a/scripts/create_user.ml +++ b/scripts/create_user.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: create_user.ml,v 1.7 2006/03/27 18:09:46 rich Exp $ + * $Id: create_user.ml,v 1.8 2006/07/26 16:34:18 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,6 +72,7 @@ let run r (q : cgi) dbh hostid _ _ = let can_manage_site = q#param_true "can_manage_site" in let can_edit_global_css = q#param_true "can_edit_global_css" in let can_import_mail = q#param_true "can_import_mail" in + let can_edit_macros = q#param_true "can_edit_macros" in let force_password_change = q#param_true "force_password_change" in (* Create the user account. *) @@ -80,10 +81,12 @@ let run r (q : cgi) dbh hostid _ _ = hostid, can_edit, can_manage_users, can_manage_contacts, can_manage_site, can_edit_global_css, can_import_mail, + can_edit_macros, force_password_change) values ($username, $password, $hostid, $can_edit, $can_manage_users, $can_manage_contacts, $can_manage_site, $can_edit_global_css, $can_import_mail, + $can_edit_macros, $force_password_change)"; PGOCaml.commit dbh; diff --git a/scripts/edit_user.ml b/scripts/edit_user.ml index bfbd191..12eea7f 100644 --- a/scripts/edit_user.ml +++ b/scripts/edit_user.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_user.ml,v 1.12 2006/03/27 19:10:29 rich Exp $ + * $Id: edit_user.ml,v 1.13 2006/07/26 16:34:18 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 @@ -73,6 +73,7 @@ let run r (q : cgi) dbh hostid _ self = let can_manage_site = q#param_true "can_manage_site" in let can_edit_global_css = q#param_true "can_edit_global_css" in let can_import_mail = q#param_true "can_import_mail" in + let can_edit_macros = q#param_true "can_edit_macros" in (* Trying to remove manage users permission from self? *) (match can_manage_users, self with @@ -91,7 +92,8 @@ let run r (q : cgi) dbh hostid _ self = can_manage_contacts = $can_manage_contacts, can_manage_site = $can_manage_site, can_edit_global_css = $can_edit_global_css, - can_import_mail = $can_import_mail + can_import_mail = $can_import_mail, + can_edit_macros = $can_edit_macros where hostid = $hostid and id = $userid"; (* Finish up. *) diff --git a/scripts/edit_user_form.ml b/scripts/edit_user_form.ml index 76caf6a..f9695a5 100644 --- a/scripts/edit_user_form.ml +++ b/scripts/edit_user_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_user_form.ml,v 1.10 2006/03/27 19:10:29 rich Exp $ + * $Id: edit_user_form.ml,v 1.11 2006/07/26 16:34:18 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,6 +38,7 @@ let run r (q : cgi) dbh hostid _ _ = "select u.name, u.email, u.registration_date, u.can_edit, u.can_manage_users, u.can_manage_contacts, u.can_manage_site, u.can_edit_global_css, u.can_import_mail, + u.can_edit_macros, (select count(*) from pages where logged_user = u.id)::int4, (select count(*) from pages where logged_user = u.id and url_deleted is null)::int4 @@ -45,16 +46,16 @@ let run r (q : cgi) dbh hostid _ _ = let name, email, registration_date, can_edit, can_manage_users, can_manage_contacts, can_manage_site, can_edit_global_css, - can_import_mail, nr_edits, nr_edits_live = + can_import_mail, can_edit_macros, nr_edits, nr_edits_live = match rows with | [name, email, registration_date, can_edit, can_manage_users, can_manage_contacts, can_manage_site, can_edit_global_css, - can_import_mail, + can_import_mail, can_edit_macros, nr_edits, nr_edits_live] -> name, email, registration_date, can_edit, can_manage_users, can_manage_contacts, can_manage_site, can_edit_global_css, - can_import_mail, nr_edits, nr_edits_live + can_import_mail, can_edit_macros, nr_edits, nr_edits_live | _ -> assert false in template#set "userid" (Int32.to_string userid); @@ -67,6 +68,7 @@ let run r (q : cgi) dbh hostid _ _ = template#conditional "can_manage_site" can_manage_site; template#conditional "can_edit_global_css" can_edit_global_css; template#conditional "can_import_mail" can_import_mail; + template#conditional "can_edit_macros" can_edit_macros; template#set "nr_edits" (Int32.to_string (Option.get nr_edits)); template#set "nr_edits_live" (Int32.to_string (Option.get nr_edits_live)); diff --git a/scripts/users.ml b/scripts/users.ml index 8a3fcec..651cbde 100644 --- a/scripts/users.ml +++ b/scripts/users.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: users.ml,v 1.10 2006/03/28 16:24:08 rich Exp $ + * $Id: users.ml,v 1.11 2006/07/26 16:34:18 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,14 +36,14 @@ let run r (q : cgi) dbh hostid _ _ = "select id, name, email, registration_date, invite is not null, can_edit, can_manage_users, can_manage_contacts, can_manage_site, can_edit_global_css, - can_import_mail + can_import_mail, can_edit_macros from users where hostid = $hostid order by name" in let table = List.map (fun (userid, name, email, registration_date, invite_pending, can_edit, can_manage_users, can_manage_contacts, can_manage_site, - can_edit_global_css, can_import_mail) -> + can_edit_global_css, can_import_mail, can_edit_macros) -> let email = match email with None -> "" | Some s -> s in let invite_pending = Option.get invite_pending in [ "userid", Template.VarString (Int32.to_string userid); @@ -61,7 +61,9 @@ let run r (q : cgi) dbh hostid _ _ = "can_edit_global_css", Template.VarConditional can_edit_global_css; "can_import_mail", - Template.VarConditional can_import_mail;] + Template.VarConditional can_import_mail; + "can_edit_macros", + Template.VarConditional can_edit_macros;] ) rows in template#table "users" table; diff --git a/templates/create_user_form.html b/templates/create_user_form.html index f11e82a..97e93dd 100644 --- a/templates/create_user_form.html +++ b/templates/create_user_form.html @@ -47,6 +47,8 @@
+
+ diff --git a/templates/edit_user_form.html b/templates/edit_user_form.html index dd82092..4156150 100644 --- a/templates/edit_user_form.html +++ b/templates/edit_user_form.html @@ -42,6 +42,8 @@
+
+ diff --git a/templates/users.html b/templates/users.html index 6d50aea..cf19b46 100644 --- a/templates/users.html +++ b/templates/users.html @@ -28,6 +28,7 @@ Manage site Edit global stylesheet Import mail + Edit macros ::table(users):: @@ -45,6 +46,7 @@ ::if(can_manage_site)::Can manage site::end:: ::if(can_edit_global_css)::Can edit global stylesheet::end:: ::if(can_import_mail)::Can import mail::end:: + ::if(can_edit_macros)::Can edit macros::end:: ::end:: @@ -142,6 +144,16 @@ If set, user may import e-mail. +
Edit global stylesheet
+
+ +

+If set, user may edit the {{macros}} which +can affect many pages. +

+ +
+ ::include(footer.html)::