GRANT ALL ON TABLE pages TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
--- TOC entry 25 (OID 536004)
+-- TOC entry 29 (OID 536004)
-- Name: pages_id_seq; Type: ACL; Schema: public; Owner: rich
--
GRANT ALL ON TABLE pages_id_seq TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
-- TOC entry 7 (OID 536021)
-- Name: contents; Type: TABLE; Schema: public; Owner: rich
GRANT ALL ON TABLE contents TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
--- TOC entry 26 (OID 536021)
+-- TOC entry 30 (OID 536021)
-- Name: contents_id_seq; Type: ACL; Schema: public; Owner: rich
--
GRANT ALL ON TABLE contents_id_seq TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
-- TOC entry 9 (OID 536371)
-- Name: hosts; Type: TABLE; Schema: public; Owner: rich
GRANT ALL ON TABLE hosts TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
--- TOC entry 27 (OID 536371)
+-- TOC entry 31 (OID 536371)
-- Name: hosts_id_seq; Type: ACL; Schema: public; Owner: rich
--
GRANT ALL ON TABLE hosts_id_seq TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
-- TOC entry 11 (OID 536379)
-- Name: hostnames; Type: TABLE; Schema: public; Owner: rich
GRANT ALL ON TABLE hostnames TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
-- TOC entry 13 (OID 536915)
-- Name: email_notify; Type: TABLE; Schema: public; Owner: rich
GRANT ALL ON TABLE email_notify TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
-- TOC entry 15 (OID 537151)
-- Name: images; Type: TABLE; Schema: public; Owner: rich
GRANT ALL ON TABLE images TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
--- TOC entry 28 (OID 537151)
+-- TOC entry 32 (OID 537151)
-- Name: images_id_seq; Type: ACL; Schema: public; Owner: rich
--
GRANT ALL ON TABLE images_id_seq TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
-- TOC entry 17 (OID 537166)
-- Name: files; Type: TABLE; Schema: public; Owner: rich
GRANT ALL ON TABLE files TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
--- TOC entry 29 (OID 537166)
+-- TOC entry 33 (OID 537166)
-- Name: files_id_seq; Type: ACL; Schema: public; Owner: rich
--
GRANT ALL ON TABLE files_id_seq TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
-- TOC entry 19 (OID 540816)
-- Name: users; Type: TABLE; Schema: public; Owner: rich
email text,
registration_date date DEFAULT ('now'::text)::date NOT NULL,
can_edit boolean DEFAULT true NOT NULL,
- can_manage_users boolean DEFAULT false NOT NULL
+ can_manage_users boolean DEFAULT false NOT NULL,
+ can_manage_contacts boolean DEFAULT false NOT NULL
);
GRANT ALL ON TABLE users TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
--- TOC entry 30 (OID 540816)
+-- TOC entry 34 (OID 540816)
-- Name: users_id_seq; Type: ACL; Schema: public; Owner: rich
--
GRANT ALL ON TABLE users_id_seq TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
-- TOC entry 21 (OID 540832)
-- Name: usercookies; Type: TABLE; Schema: public; Owner: rich
GRANT ALL ON TABLE usercookies TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
-- TOC entry 23 (OID 540961)
-- Name: sitemenu; Type: TABLE; Schema: public; Owner: rich
GRANT ALL ON TABLE sitemenu TO "www-data";
+SET SESSION AUTHORIZATION 'rich';
+
--
--- TOC entry 35 (OID 536388)
+-- TOC entry 25 (OID 542605)
+-- Name: contacts; Type: TABLE; Schema: public; Owner: rich
+--
+
+CREATE TABLE contacts (
+ id serial NOT NULL,
+ hostid integer NOT NULL,
+ name text NOT NULL,
+ subject text NOT NULL
+);
+
+
+--
+-- TOC entry 26 (OID 542605)
+-- Name: contacts; Type: ACL; Schema: public; Owner: rich
+--
+
+REVOKE ALL ON TABLE contacts FROM PUBLIC;
+GRANT ALL ON TABLE contacts TO "www-data";
+
+
+SET SESSION AUTHORIZATION 'rich';
+
+--
+-- TOC entry 35 (OID 542605)
+-- Name: contacts_id_seq; Type: ACL; Schema: public; Owner: rich
+--
+
+REVOKE ALL ON TABLE contacts_id_seq FROM PUBLIC;
+GRANT ALL ON TABLE contacts_id_seq TO "www-data";
+
+
+SET SESSION AUTHORIZATION 'rich';
+
+--
+-- TOC entry 27 (OID 542617)
+-- Name: contact_emails; Type: TABLE; Schema: public; Owner: rich
+--
+
+CREATE TABLE contact_emails (
+ contactid integer NOT NULL,
+ email text NOT NULL
+);
+
+
+--
+-- TOC entry 28 (OID 542617)
+-- Name: contact_emails; Type: ACL; Schema: public; Owner: rich
+--
+
+REVOKE ALL ON TABLE contact_emails FROM PUBLIC;
+GRANT ALL ON TABLE contact_emails TO "www-data";
+
+
+SET SESSION AUTHORIZATION 'rich';
+
+--
+-- TOC entry 40 (OID 536388)
-- Name: hostnames_hostid_name_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 36 (OID 536389)
+-- TOC entry 41 (OID 536389)
-- Name: hostnams_name_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 32 (OID 536419)
+-- TOC entry 37 (OID 536419)
-- Name: pages_url_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 37 (OID 536924)
+-- TOC entry 42 (OID 536924)
-- Name: email_notify_email_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 38 (OID 540251)
+-- TOC entry 43 (OID 540251)
-- Name: images_name_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 40 (OID 540252)
+-- TOC entry 45 (OID 540252)
-- Name: files_name_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 43 (OID 540831)
+-- TOC entry 48 (OID 540831)
-- Name: users_name_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 42 (OID 540946)
+-- TOC entry 47 (OID 540946)
-- Name: users_id_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 45 (OID 540970)
+-- TOC entry 50 (OID 540970)
-- Name: sitemenu_ordering_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 46 (OID 540971)
+-- TOC entry 51 (OID 540971)
-- Name: sitemenu_url_uq; Type: INDEX; Schema: public; Owner: rich
--
--
--- TOC entry 31 (OID 536012)
+-- TOC entry 53 (OID 542626)
+-- Name: contact_emails_uq; Type: INDEX; Schema: public; Owner: rich
+--
+
+CREATE UNIQUE INDEX contact_emails_uq ON contact_emails USING btree (contactid, email);
+
+
+--
+-- TOC entry 36 (OID 536012)
-- Name: pages_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 33 (OID 536027)
+-- TOC entry 38 (OID 536027)
-- Name: contents_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 34 (OID 536377)
+-- TOC entry 39 (OID 536377)
-- Name: hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 39 (OID 537158)
+-- TOC entry 44 (OID 537158)
-- Name: images_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 41 (OID 537173)
+-- TOC entry 46 (OID 537173)
-- Name: files_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 44 (OID 540825)
+-- TOC entry 49 (OID 540825)
-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 51 (OID 536029)
+-- TOC entry 52 (OID 542611)
+-- Name: contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
+--
+
+ALTER TABLE ONLY contacts
+ ADD CONSTRAINT contacts_pkey PRIMARY KEY (id);
+
+
+--
+-- TOC entry 58 (OID 536029)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 53 (OID 536384)
+-- TOC entry 60 (OID 536384)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 52 (OID 536394)
+-- TOC entry 59 (OID 536394)
-- Name: hosts_hostname_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 47 (OID 536404)
+-- TOC entry 54 (OID 536404)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 54 (OID 536920)
+-- TOC entry 61 (OID 536920)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 55 (OID 537160)
+-- TOC entry 62 (OID 537160)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 56 (OID 537175)
+-- TOC entry 63 (OID 537175)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 48 (OID 539155)
+-- TOC entry 55 (OID 539155)
-- Name: pages_redirect_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 57 (OID 540827)
+-- TOC entry 64 (OID 540827)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 58 (OID 540837)
+-- TOC entry 65 (OID 540837)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 49 (OID 540942)
+-- TOC entry 56 (OID 540942)
-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 50 (OID 540947)
+-- TOC entry 57 (OID 540947)
-- Name: pages_user_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 59 (OID 540966)
+-- TOC entry 66 (OID 540966)
-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
--
--- TOC entry 60 (OID 540972)
+-- TOC entry 67 (OID 540972)
-- Name: sitemenu_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
--
ADD CONSTRAINT sitemenu_url_cn FOREIGN KEY (hostid, url) REFERENCES pages(hostid, url) DEFERRABLE;
+--
+-- TOC entry 68 (OID 542613)
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
+--
+
+ALTER TABLE ONLY contacts
+ ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
+
+
+--
+-- TOC entry 69 (OID 542622)
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
+--
+
+ALTER TABLE ONLY contact_emails
+ ADD CONSTRAINT "$1" FOREIGN KEY (contactid) REFERENCES contacts(id);
+
+
SET SESSION AUTHORIZATION 'postgres';
--
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_user_form.ml,v 1.4 2004/09/09 12:21:22 rich Exp $
+ * $Id: edit_user_form.ml,v 1.5 2004/09/17 15:24:54 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
let sth =
dbh#prepare_cached
"select u.name, u.email, u.registration_date,
- u.can_edit, u.can_manage_users,
+ u.can_edit, u.can_manage_users, u.can_manage_contacts,
(select count(*) from pages where logged_user = u.id),
(select count(*) from pages
where logged_user = u.id and url_deleted is null)
from users u where u.hostid = ? and u.id = ?" in
sth#execute [`Int hostid; `Int userid];
- let name, email, registration_date, can_edit, can_manage_users, nr_edits,
- nr_edits_live =
+ let name, email, registration_date, can_edit, can_manage_users,
+ can_manage_contacts, nr_edits, nr_edits_live =
match sth#fetch1 () with
[`String name; (`Null | `String _) as email;
`Date registration_date;
- `Bool can_edit; `Bool can_manage_users;
+ `Bool can_edit; `Bool can_manage_users; `Bool can_manage_contacts;
`Int nr_edits; `Int nr_edits_live] ->
name, email, registration_date, can_edit, can_manage_users,
- nr_edits, nr_edits_live
+ can_manage_contacts, nr_edits, nr_edits_live
| _ -> assert false in
template#set "userid" (string_of_int userid);
template#set "registration_date" (printable_date' registration_date);
template#conditional "can_edit" can_edit;
template#conditional "can_manage_users" can_manage_users;
+ template#conditional "can_manage_contacts" can_manage_contacts;
template#set "nr_edits" (string_of_int nr_edits);
template#set "nr_edits_live" (string_of_int nr_edits_live);