/masonsql_dojo1.6/utility/sql/roles.sql |
---|
0,0 → 1,5 |
CREATE ROLE masonsql LOGIN PASSWORD 'password' NOSUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE; |
CREATE ROLE report LOGIN PASSWORD 'password' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE; |
/masonsql_dojo1.6/utility/sql/create_database.sql |
---|
0,0 → 1,0 |
create database masonsql ENCODING = 'UTF8' LC_COLLATE = 'it_IT.UTF-8' LC_CTYPE = 'it_IT.UTF-8' TEMPLATE=template0; |
/masonsql_dojo1.6/utility/sql/pg_dump.masonsql.template.sql |
---|
0,0 → 1,1638 |
-- |
-- PostgreSQL database dump |
-- |
SET statement_timeout = 0; |
SET client_encoding = 'UTF8'; |
SET standard_conforming_strings = off; |
SET check_function_bodies = false; |
SET client_min_messages = warning; |
SET escape_string_warning = off; |
-- |
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres |
-- |
CREATE PROCEDURAL LANGUAGE plpgsql; |
ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres; |
SET search_path = public, pg_catalog; |
SET default_tablespace = ''; |
SET default_with_oids = false; |
-- |
-- Name: anagrafiche; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE anagrafiche ( |
id integer NOT NULL, |
nome character varying(20), |
cognome character varying(25), |
descrizione character varying(60), |
indirizzo character varying(60), |
provincia character varying(2), |
citta character varying(20), |
tel1 character varying(20), |
tel2 character varying(20), |
codice_fiscale character(16), |
login character varying(10), |
password character(32), |
session character varying(60), |
email character varying(60), |
session_time timestamp without time zone, |
previus_session_time timestamp without time zone |
); |
ALTER TABLE public.anagrafiche OWNER TO postgres; |
-- |
-- Name: TABLE anagrafiche; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON TABLE anagrafiche IS 'Anagrafiche persone'; |
-- |
-- Name: COLUMN anagrafiche.session_time; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN anagrafiche.session_time IS 'Istante di login dell''utente'; |
-- |
-- Name: COLUMN anagrafiche.previus_session_time; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN anagrafiche.previus_session_time IS 'Istante della precedente login dell''utente'; |
-- |
-- Name: anagrafiche_gruppi; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE anagrafiche_gruppi ( |
id integer NOT NULL, |
id_anagrafiche integer NOT NULL, |
id_gruppi integer NOT NULL |
); |
ALTER TABLE public.anagrafiche_gruppi OWNER TO postgres; |
-- |
-- Name: TABLE anagrafiche_gruppi; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON TABLE anagrafiche_gruppi IS 'Relazioni di appartenenza delle anagrafiche ai gruppi'; |
-- |
-- Name: anagrafiche_gruppi_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE anagrafiche_gruppi_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.anagrafiche_gruppi_id_seq OWNER TO postgres; |
-- |
-- Name: anagrafiche_gruppi_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE anagrafiche_gruppi_id_seq OWNED BY anagrafiche_gruppi.id; |
-- |
-- Name: anagrafiche_gruppi_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('anagrafiche_gruppi_id_seq', 3, true); |
-- |
-- Name: anagrafiche_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE anagrafiche_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.anagrafiche_id_seq OWNER TO postgres; |
-- |
-- Name: anagrafiche_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE anagrafiche_id_seq OWNED BY anagrafiche.id; |
-- |
-- Name: anagrafiche_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('anagrafiche_id_seq', 3, true); |
-- |
-- Name: autorizzazioni; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE autorizzazioni ( |
id integer NOT NULL, |
nome character varying(16) NOT NULL, |
descrizione character varying(60), |
commento character varying(240) |
); |
ALTER TABLE public.autorizzazioni OWNER TO postgres; |
-- |
-- Name: autorizzazioni_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE autorizzazioni_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.autorizzazioni_id_seq OWNER TO postgres; |
-- |
-- Name: autorizzazioni_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE autorizzazioni_id_seq OWNED BY autorizzazioni.id; |
-- |
-- Name: autorizzazioni_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('autorizzazioni_id_seq', 10, true); |
-- |
-- Name: funzioni; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE funzioni ( |
id integer NOT NULL, |
descrizione character varying(60), |
commento character varying(240), |
nome character varying(16) NOT NULL, |
menu_contents character varying(24), |
menu_status character varying(64), |
menu_ord smallint, |
menu_command character varying(1024), |
menu_cmdtype character(1), |
menu_father_id integer, |
help character varying |
); |
ALTER TABLE public.funzioni OWNER TO postgres; |
-- |
-- Name: funzioni_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE funzioni_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.funzioni_id_seq OWNER TO postgres; |
-- |
-- Name: funzioni_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE funzioni_id_seq OWNED BY funzioni.id; |
-- |
-- Name: funzioni_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('funzioni_id_seq', 19, true); |
-- |
-- Name: gruppi; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE gruppi ( |
id integer NOT NULL, |
nome character varying(16), |
descrizione character varying(60), |
commento character varying(240) |
); |
ALTER TABLE public.gruppi OWNER TO postgres; |
-- |
-- Name: gruppi_and_anagrafiche; Type: VIEW; Schema: public; Owner: postgres |
-- |
CREATE VIEW gruppi_and_anagrafiche AS |
SELECT (- gruppi.id) AS id, gruppi.nome AS descrizione FROM gruppi UNION SELECT anagrafiche.id, (COALESCE(((anagrafiche.nome)::text || ' '::text), ''::text) || COALESCE((anagrafiche.cognome)::text, ''::text)) AS descrizione FROM anagrafiche WHERE (anagrafiche.login IS NOT NULL) ORDER BY 1; |
ALTER TABLE public.gruppi_and_anagrafiche OWNER TO postgres; |
-- |
-- Name: gruppi_funzioni; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE gruppi_funzioni ( |
id integer NOT NULL, |
id_funzioni integer NOT NULL, |
id_gruppi integer NOT NULL, |
id_autorizzazioni integer NOT NULL |
); |
ALTER TABLE public.gruppi_funzioni OWNER TO postgres; |
-- |
-- Name: gruppi_funzioni_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE gruppi_funzioni_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.gruppi_funzioni_id_seq OWNER TO postgres; |
-- |
-- Name: gruppi_funzioni_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE gruppi_funzioni_id_seq OWNED BY gruppi_funzioni.id; |
-- |
-- Name: gruppi_funzioni_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('gruppi_funzioni_id_seq', 396, true); |
-- |
-- Name: gruppi_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE gruppi_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.gruppi_id_seq OWNER TO postgres; |
-- |
-- Name: gruppi_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE gruppi_id_seq OWNED BY gruppi.id; |
-- |
-- Name: gruppi_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('gruppi_id_seq', 4, true); |
-- |
-- Name: gruppi_modifica; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE gruppi_modifica ( |
id integer NOT NULL, |
id_gruppo integer NOT NULL, |
id_gruppo_modifica integer NOT NULL |
); |
ALTER TABLE public.gruppi_modifica OWNER TO postgres; |
-- |
-- Name: gruppi_modifica_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE gruppi_modifica_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.gruppi_modifica_id_seq OWNER TO postgres; |
-- |
-- Name: gruppi_modifica_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE gruppi_modifica_id_seq OWNED BY gruppi_modifica.id; |
-- |
-- Name: gruppi_modifica_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('gruppi_modifica_id_seq', 1, false); |
-- |
-- Name: logs; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE logs ( |
id integer NOT NULL, |
"timestamp" timestamp without time zone DEFAULT now(), |
table_name character varying(63), |
old_value character varying, |
new_value character varying, |
id_anagrafiche integer, |
field character varying(63), |
id_record integer |
); |
ALTER TABLE public.logs OWNER TO postgres; |
-- |
-- Name: TABLE logs; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON TABLE logs IS 'Log operazioni di inserimento, modifica e cancellazione effettuati dall''interfaccia Web |
'; |
-- |
-- Name: COLUMN logs.id; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN logs.id IS 'Primary key'; |
-- |
-- Name: COLUMN logs."timestamp"; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN logs."timestamp" IS 'Data e ora della modifica'; |
-- |
-- Name: COLUMN logs.table_name; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN logs.table_name IS 'Nome della tabella'; |
-- |
-- Name: COLUMN logs.old_value; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN logs.old_value IS 'Valore del campo prima della modifica'; |
-- |
-- Name: COLUMN logs.new_value; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN logs.new_value IS 'Valore del campo dopo la modifica'; |
-- |
-- Name: COLUMN logs.id_anagrafiche; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN logs.id_anagrafiche IS 'Utente responsabile della modifica'; |
-- |
-- Name: COLUMN logs.field; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN logs.field IS 'Nome del campo'; |
-- |
-- Name: logs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE logs_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.logs_id_seq OWNER TO postgres; |
-- |
-- Name: logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE logs_id_seq OWNED BY logs.id; |
-- |
-- Name: logs_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('logs_id_seq', 1, true); |
SET default_with_oids = true; |
-- |
-- Name: messages; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE messages ( |
id integer NOT NULL, |
message character varying NOT NULL, |
owner integer NOT NULL, |
modification_time timestamp without time zone NOT NULL, |
transmission_time timestamp without time zone |
); |
ALTER TABLE public.messages OWNER TO postgres; |
-- |
-- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE messages_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.messages_id_seq OWNER TO postgres; |
-- |
-- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE messages_id_seq OWNED BY messages.id; |
-- |
-- Name: messages_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('messages_id_seq', 1, false); |
SET default_with_oids = false; |
-- |
-- Name: messages_users; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE messages_users ( |
id integer NOT NULL, |
id_messages integer NOT NULL, |
id_anagrafiche integer NOT NULL, |
notification_time timestamp without time zone |
); |
ALTER TABLE public.messages_users OWNER TO postgres; |
-- |
-- Name: messages_users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE messages_users_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.messages_users_id_seq OWNER TO postgres; |
-- |
-- Name: messages_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE messages_users_id_seq OWNED BY messages_users.id; |
-- |
-- Name: messages_users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('messages_users_id_seq', 1, false); |
-- |
-- Name: recordset; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE recordset ( |
id integer NOT NULL, |
id_anagrafiche integer, |
name character varying(64) NOT NULL, |
size integer, |
block integer, |
query_numrec character varying, |
query_records character varying, |
query_where character varying, |
query_find_records character varying |
); |
ALTER TABLE public.recordset OWNER TO postgres; |
-- |
-- Name: TABLE recordset; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON TABLE recordset IS 'Tabella per rendere persistenti i recordset utilizzati sul browser. |
Le righe precaricate (con la chiave del record) sono inserite nella tabella recordset_rows.'; |
-- |
-- Name: COLUMN recordset.name; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN recordset.name IS 'Nome del recordset. |
Corrisponde a .prefix indicato nell''oggetto databinding corrispondente che a sua volta corrisponde a $Recordset nel framework MasonSql'; |
-- |
-- Name: COLUMN recordset.block; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN recordset.block IS 'Dimensione del blocco utilizzato per il caricamento delle chiavi.'; |
-- |
-- Name: recordset_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE recordset_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.recordset_id_seq OWNER TO postgres; |
-- |
-- Name: recordset_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE recordset_id_seq OWNED BY recordset.id; |
-- |
-- Name: recordset_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('recordset_id_seq', 1, true); |
-- |
-- Name: recordset_rows; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE recordset_rows ( |
id integer NOT NULL, |
id_recordset integer NOT NULL, |
num_row integer NOT NULL, |
id_record integer |
); |
ALTER TABLE public.recordset_rows OWNER TO postgres; |
-- |
-- Name: TABLE recordset_rows; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON TABLE recordset_rows IS 'Chiavi recordset (vedi tabella recordset). |
Utilizzata nella gestione dei recordset persistenti. |
'; |
-- |
-- Name: COLUMN recordset_rows.num_row; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN recordset_rows.num_row IS 'Riga nel recordset'; |
-- |
-- Name: COLUMN recordset_rows.id_record; Type: COMMENT; Schema: public; Owner: postgres |
-- |
COMMENT ON COLUMN recordset_rows.id_record IS 'Chiave del record'; |
-- |
-- Name: recordset_rows_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE recordset_rows_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.recordset_rows_id_seq OWNER TO postgres; |
-- |
-- Name: recordset_rows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE recordset_rows_id_seq OWNED BY recordset_rows.id; |
-- |
-- Name: recordset_rows_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('recordset_rows_id_seq', 1, true); |
-- |
-- Name: report_id; Type: TABLE; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE TABLE report_id ( |
id integer NOT NULL, |
key integer NOT NULL, |
group_id integer NOT NULL |
); |
ALTER TABLE public.report_id OWNER TO postgres; |
-- |
-- Name: report_id_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
-- |
CREATE SEQUENCE report_id_id_seq |
START WITH 1 |
INCREMENT BY 1 |
NO MAXVALUE |
NO MINVALUE |
CACHE 1; |
ALTER TABLE public.report_id_id_seq OWNER TO postgres; |
-- |
-- Name: report_id_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres |
-- |
ALTER SEQUENCE report_id_id_seq OWNED BY report_id.id; |
-- |
-- Name: report_id_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
-- |
SELECT pg_catalog.setval('report_id_id_seq', 1, true); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE anagrafiche ALTER COLUMN id SET DEFAULT nextval('anagrafiche_id_seq'::regclass); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE anagrafiche_gruppi ALTER COLUMN id SET DEFAULT nextval('anagrafiche_gruppi_id_seq'::regclass); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE autorizzazioni ALTER COLUMN id SET DEFAULT nextval('autorizzazioni_id_seq'::regclass); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE funzioni ALTER COLUMN id SET DEFAULT nextval('funzioni_id_seq'::regclass); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE gruppi ALTER COLUMN id SET DEFAULT nextval('gruppi_id_seq'::regclass); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE gruppi_funzioni ALTER COLUMN id SET DEFAULT nextval('gruppi_funzioni_id_seq'::regclass); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE gruppi_modifica ALTER COLUMN id SET DEFAULT nextval('gruppi_modifica_id_seq'::regclass); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE logs ALTER COLUMN id SET DEFAULT nextval('logs_id_seq'::regclass); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE messages_users ALTER COLUMN id SET DEFAULT nextval('messages_users_id_seq'::regclass); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE recordset ALTER COLUMN id SET DEFAULT nextval('recordset_id_seq'::regclass); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE recordset_rows ALTER COLUMN id SET DEFAULT nextval('recordset_rows_id_seq'::regclass); |
-- |
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres |
-- |
ALTER TABLE report_id ALTER COLUMN id SET DEFAULT nextval('report_id_id_seq'::regclass); |
-- |
-- Data for Name: anagrafiche; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY anagrafiche (id, nome, cognome, descrizione, indirizzo, provincia, citta, tel1, tel2, codice_fiscale, login, password, session, email, session_time, previus_session_time) FROM stdin; |
3 Guest Guest \N \N \N \N \N \N \N guest 19ad89bc3e3c9d7ef68b89523eff1987 \N \N \N \N |
1 admin \N \N \N \N \N \N \N \N admin 8c31523d0c7e79c2594854a2fe62d3b5 172009872beb234c8bac09961375b8b4 10.115.1.2 21228904 \N 2010-05-13 08:52:34.868345 2010-05-13 07:51:40.19512 |
\. |
-- |
-- Data for Name: anagrafiche_gruppi; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY anagrafiche_gruppi (id, id_anagrafiche, id_gruppi) FROM stdin; |
1 1 1 |
3 3 4 |
\. |
-- |
-- Data for Name: autorizzazioni; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY autorizzazioni (id, nome, descrizione, commento) FROM stdin; |
8 Xls Download dati in formato XLS L'autorizzazione se concessa permette all'utente di scaricare i dati in formato XLS |
4 Delete Cancellazione dei dati \N |
2 Select Lettura dei dati \N |
7 Insert Inserimento nuovi valori \N |
1 Menu Menu attivo La voce di menù viene resa disponibile |
5 Print Stampa record corrente \N |
6 PrintSel Stampa selezione dei record \N |
3 Update Modifica dei dati \N |
9 Dbms Interfaccia scambio dati /dbms L'autorizzazione se concessa permette all'utente di scambiare dati attraverso l'interfaccia /dbms |
10 Log Visualizzazione delle modifiche nel tempo Visualizza le modifiche apportate nel tempo con indicazione dell'utente |
\. |
-- |
-- Data for Name: funzioni; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY funzioni (id, descrizione, commento, nome, menu_contents, menu_status, menu_ord, menu_command, menu_cmdtype, menu_father_id, help) FROM stdin; |
3 Help \N Help ? Help 900 \N \N \N Menu principale Help. |
7 Home Page \N HomePage Home Page Ricarica Home Page 10 "pageLoad('home.html?Ver=$Ver', '')" J 14 Home Page. |
12 Ricarica form corrente \N Reload Ricarica Ricarica form corrente 30 divReload(CurrentMenu); divReload(CurrentBody); j 3 Viene ricaricata dal server la funzione corrente. |
4 Cambio password \N ChangePass Cambio password \N 90 "pageLoad('change_password.html?Ver=$Ver', '')" J 14 Help funzione Cambio password |
8 Autorizzazioni \N ListAuth Tipi autorizzazioni Autorizzazioni 20 "pageLoad('table.html?Ver=$Ver&from=autorizzazioni', '')" J 17 Classificazione delle autorizzazioni attribuibili ai gruppi a cui appartengono gli utenti.<br />\n<br />\n<ul>\n <li>\n <p align="left"><strong>Nome autorizzazione: </strong><span style=""></span></p>\n </li>\n <li>\n <p align="left"><strong>Descrizione: </strong>Descrizione autorizzazione<br />\n </p>\n </li>\n <li>\n <p align="left"><strong>Commento: </strong>Commento di utilizzo libero</p>\n </li>\n</ul> |
9 Tabella funzioni \N Funzioni Funzioni e autorizz. Tabella funzioni dell'applicazione e autorizzazioni applicate 30 "pageLoad('table.html?Ver=$Ver&from=funzioni&children=TABLE&rows_child=10', '')" J 17 Definizione dei menù dell'applicazione e relativi permessi e documentazione.<br />\n<br />\n<ul>\n <li>\n <p align="left"><strong>Nome: </strong>Nome univoco della funzione. Al nome vengono associati i profili dei permessi usati anche nel codice. E' quindi importante non modificare il codice se non si è in grado di modificare anche i riferimenti nel codice dell'applicazione<span style=""></span></p>\n </li>\n <li>\n <p align="left"><strong>Descrizione: </strong>Descrizione della funzione</p>\n </li>\n <li>\n <p align="left"><strong>Commento: </strong>Commento di utilizzo libero</p>\n </li>\n <li>\n <p align="left"><strong>Ord: </strong>Numero che determina l'ordine con cui le varie voci di menù compaiono<br />\n </p>\n </li>\n <li>\n <p align="left"><strong>Menu: </strong>Nome del menù che appare nell'applicazione<strong><br />\n </strong></p>\n </li>\n <li>\n <p align="left"><strong>Menu padre: </strong>Nome della funziona padre. La voce comparirà nel menù sotto la voce del padre indicato. E' possibile indicare come padre delle voci di menù che a voro volta hanno un padre.<br />\n </p>\n </li>\n <li>\n <p align="left"><strong>Menu avviso: </strong>Titolo del menù<strong><br />\n </strong></p>\n </li>\n <li>\n <p align="left"><strong>Tipo comando: </strong></p>\n <ul>\n <li><strong>Link WEB: </strong>Il contenuto del campo <em>Comando Menu</em> verrà interpretato come link ad una pagina HTML<br />\n </li>\n <li><strong>Link WEB - applicando eval Perl: </strong>Al contenuto del campo viene applicata la funzione eval sul Server; utile per elaborare dei valori <em>(es. la variabile $Ver verrà sostituita con il numero di versione)</em><br />\n </li>\n <li><strong>Client Javascript: </strong>Il contenuto del campo <em>Comando Menu</em> verrà interpretato come codice javascript sul browser.<br />\n </li>\n <li><strong>Client Javascript</strong><strong> - applicando eval Perl: </strong>Al contenuto del campo viene applicata la funzione eval sul Server.</li>\n </ul>\n </li>\n <li>\n <p align="left"><strong>Comando Menu: </strong>Il comando, intepretato in funzione del campo <em>Tipo comando</em>.<strong><br />\n </strong></p>\n </li>\n <li>\n <p align="left"><strong>Permessi: </strong>Tabella di assegnazione dei permessi. In colonna vengono inseriti i vari tipi di autorizzazioni, mentre in riga troviamo le definizioni dei vari gruppi.<br />\n </p>\n </li>\n <li>\n <p align="left"><strong>Help: </strong>Documentazione della funzione a disposizione dell'utente. L'help dell'applicazione viene costruito assemblando la documentazione delle funzioni a cui l'utente ha accesso in base ai gruppi a cui appartiene.<strong><br />\n </strong></p>\n </li>\n</ul> |
1 Modifiche nel database Registrazione modifiche nel database da parte degli Utenti Logs Log database Registrazione modifiche nel database da parte degli Utenti 999 "pageLoad('table.html?Ver=$Ver&from=logs', '')" J 17 Visualizza il registro delle mondifiche effettuate dagli utenti nel database. |
14 Home Raggruppamento homed Home Home Home page applicazione SIDAL 1 \N \N \N <h1 align="center">Introduzione</h1>\n<p>Questo programma permette la gestione integrata ....<br />\n</p>\n<span style="font-size: 10pt; font-family: Symbol;"></span> |
2 Chiusura sessione \N CloseSession Esci Chiude sessione di lavoro 999 "logout.html?Ver=$Ver" U 14 Chiusura sessione. |
16 Tabella anagrafiche persone \N Anagrafiche Anagrafica utenti Tabella anagrafiche utenti 10 "pageLoad('/table.html?Ver=$Ver&from=anagrafiche&form=FORM&children=TABLE&rows_child=5', '')" J 17 <h1 align="center">Anagrafica utenti</h1>\n<p align="justify">Archivio degli Utenti che accedono all'applicazione.</p>\n<p align="justify">Solo l'Utente con diritti di amministratore è in grado di modificare i dati degli Utenti.</p>\n<p align="justify">I campi dell'archivio, visualizzati nel “form”, sono:</p>\n<ul>\n <li>\n <p align="justify"><strong>Nome:</strong> Nome di battesimo dell'utente </p>\n </li>\n <li>\n <p align="left"><strong>Cognome:</strong> Cognome dell'Utente</p>\n </li>\n <li>\n <p align="left"><strong>C.F.:</strong> Codice fiscale; necessario se l'Utente è abilitato a firmare i Rapporti di prova, infatti viene utilizzato per la verifica del certificato di firma che deve quindi combaciare, assieme al Nome e Cognome.</p>\n </li>\n <li>\n <p align="left"><strong>Indirizzo:</strong> Indirizzo di reperibilità</p>\n </li>\n <li>\n <p align="left"><strong>Provincia:</strong></p>\n </li>\n <li>\n <p align="left"><strong>Città:</strong></p>\n </li>\n <li>\n <p align="left"><strong>Telefono:</strong></p>\n </li>\n <li>\n <p align="left"><strong>2° Telefono:</strong></p>\n </li>\n <li>\n <p align="left"><strong>Indirizzo e-mail:</strong></p>\n </li>\n <li>\n <p align="left"><strong>Login:</strong> codice di accesso all'applicazione; Deve essere un codice univoco diverso quindi per ciascun Utente</p>\n </li>\n <li>\n <p align="left"><strong>Password: </strong>password di almeno 8 caratteri. La password viene salvata nel database cifrata in modo da impedire la lettura anche all'Amministratore che può eventualmente cambiarla se l'Utente dovesse dimenticarla</p>\n </li>\n <li>\n <p align="left"><strong>parametri su:</strong> Numero di righe da visualizzare della tabella dei parametri del form dei campioni prelevati</p>\n </li>\n <li>\n <p align="left"><strong>in tabella:</strong> Se selezionato, i dati dei parametri dei Campioni prelevati, verranno allineati in formato tabella</p>\n </li>\n <li>\n <p align="left" style="margin-bottom: 0cm;"><strong>Gruppi a cui appartiene l'utente: </strong>Lista dei gruppi a cui l'utente può appartenere:<br />\n </p>\n <ul>\n <li><strong>Admins: </strong>Amministratori dell'applicazione</li>\n <li><strong>Guesti</strong>: Utenti ospiti (sol alettura)</li>\n </ul>\n </li>\n</ul> |
13 Manuale di riferimento Visualizza un Help dell'applicazione HelpMain Help Help Analisi Chimiche 1 "pageLoad('/help.html?F=Home&Ver=$Ver', '/help.html?Ver=$Ver')" J 3 <span style="cursor: auto;" id="Father_FORM_funzioni">L'help dell'applicazione viene costruito assemblando la documentazione delle funzioni a cui l'utente ha accesso in base ai gruppi a cui appartiene.<br />\nLe varie funzioni vengono organizzate in un menù ad albero visibile a sinistra, con il dettaglio visualizzato sulla destra.<br />\nLa documentazione è modificabile dagli utenti abilitati dalla funzione <em>Funzioni e autorizz.</em></span> |
17 Impostazione delle autorizzazioni \N Autorizzazioni Autorizzazioni Impostazione delle autorizzazioni 5 \N \N \N <div align="center"><font size="5"><span style="cursor: auto;" id="Father_autorizzazioni"><strong><strong>Autorizzazioni<br />\n<br />\n</strong></strong></span></font>\n<div align="left">\n<ul>\n <li><font size="5"><span style="cursor: auto;" id="Father_autorizzazioni"><strong><strong><font size="2">Nome autorizzazione: </font></strong></strong><font size="2">Nome dell'autorizzazione</font><strong><strong><font size="2"> <br />\n </font></strong></strong></span></font></li>\n</ul>\n<ul>\n <li><font size="5"><span style="cursor: auto;" id="Father_autorizzazioni"><strong><strong><font size="2">Descrizione: </font></strong></strong><font size="2">Descrizione dell'autorizzazione<br />\n </font></span></font></li>\n</ul>\n<ul>\n <li><font size="5"><span style="cursor: auto;" id="Father_autorizzazioni"><strong><strong><font size="2">Commento: </font></strong></strong><font size="2">Eventuale commento<br />\n </font></span></font></li>\n</ul>\n<font size="5"><span style="cursor: auto;" id="Father_autorizzazioni"></span></font></div>\n</div> |
6 Note di release e Copyright \N Release Release Note di release e Copyright 20 "pageLoad('release_notes.html?Ver=$Ver', '')" J 3 Note di release: ................<br />\n<br />\n<br />\n<br />\n<br />\n<div align="center"><br />\nFramework MasonSQL<br />\nCopyright (©):<br />\nGuido Brugnara <gdo@leader.it><br />\nLicenza G.P.L. Rel.2 <br />\n</div>\n<strong></strong> |
10 Tabella gruppi \N Gruppi Gruppi Tabella gruppi 10 "pageLoad('/table.html?Ver=$Ver&from=gruppi&children=TABLE&rows_child=10', '')" J 17 <div align="center"><font size="4"><font size="5">GRUPPI</font><strong><br />\n<br />\n</strong></font></div>\nDefinizione dei gruppi a cui possono appartenere gli utenti che accedono all'applicazione.<br />\n<br />\n<ul>\n <li>\n <p align="left"><strong>Nome: </strong>Nome del gruppo<span style=""></span></p>\n </li>\n <li>\n <p align="left"><strong>Descrizione: </strong>Descrizione del gruppo</p>\n </li>\n <li>\n <p align="left"><strong>Commento: </strong>Commento di utilizzo libero</p>\n </li>\n <li>\n <p align="left"><strong>Utenti del gruppo:</strong> Elenco degli utenti che appartengono al gruppo<span style="cursor: auto;" id="Child_gruppi_modifica"></span></p>\n </li>\n <li>\n <p align="left"><span style="cursor: auto;" id="Child_gruppi_modifica"><strong><strong>Gruppi modificabili: </strong></strong>Elenco dei gruppi che utenti appartenenti al gruppo in testata possono attribuire ad altri utenti.</span></p>\n </li>\n</ul>\n<br />\n<span style="cursor: auto;" id="Child_gruppi_anagrafiche"><strong><strong>Utenti del gruppo</strong></strong></span><br />\nL'ambiente di base codifica i seguenti gruppi che non devono essere alterati:<br />\n<ul>\n <li>\n <p align="left"><strong>Admins:</strong> Gruppo <em>admin</em> di base dell'applicazione. E' un gruppo speciale che ha tutti i diritti.</p>\n </li>\n</ul>\n<br />\n<span style="cursor: auto;" id="Child_gruppi_modifica"><strong><strong>Gruppi modificabili<br />\n</strong></strong></span>\n<ul>\n <li>EnteAccett: Gruppo Accettazione Ente</li>\n</ul>\n<ul>\n <li>EnteAdmin: Gruppo Amministratore ditta gestione</li>\n</ul>\n<ul>\n <li>EnteChimico: Gruppo Chimico ditta gestione</li>\n</ul>\n<ul>\n <li>EntePrelievo: Gruppo Tecnico prelievo ditta gestione</li>\n</ul>\n<ul>\n <li>EnteResp: Gruppo Responsabile ditta gestione</li>\n</ul>\n<ul>\n <li>EnteUser: Utente ditta gestione</li>\n</ul>\n<ul>\n <li>PatAdmin: Gruppo Amministratore PAT</li>\n</ul>\n<ul>\n <li>PatChimico: Chimico PAT</li>\n</ul>\n<ul>\n <li>PatUser: Utente PAT</li>\n</ul>\n<br />\n<br />\n<br />\n<span style="cursor: auto;" id="Child_gruppi_modifica"><strong><strong></strong></strong></span> |
18 Messaggi ed avvisi di sistema \N Messages Messaggi Messaggi ed avvisi di sistema \N "pageLoad('table.html?Ver=$Ver&from=messages&form=FORM', '')" J 17 Gestione messaggi agli utenti |
19 Messaggi inviati all'utente \N User_messages Messaggi Messaggi inviati all'utente \N "pageLoad('table.html?Ver=$Ver&from=user_messages&form=DIVS', '')" J 14 Messaggi inviati all'utente |
\. |
-- |
-- Data for Name: gruppi; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY gruppi (id, nome, descrizione, commento) FROM stdin; |
1 Admins Amministratori Utenti amministratori |
4 Guest Utenti ospiti (sola lettura) \N |
\. |
-- |
-- Data for Name: gruppi_funzioni; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY gruppi_funzioni (id, id_funzioni, id_gruppi, id_autorizzazioni) FROM stdin; |
331 13 1 1 |
332 13 4 1 |
333 14 1 1 |
334 14 4 1 |
335 17 1 1 |
336 17 4 1 |
337 7 1 1 |
338 7 4 1 |
339 10 1 4 |
340 10 1 7 |
341 10 1 1 |
342 10 1 5 |
343 10 1 6 |
344 10 1 2 |
345 10 1 3 |
346 10 1 8 |
347 10 4 1 |
348 10 4 2 |
349 16 1 4 |
350 16 1 7 |
351 16 1 1 |
352 16 1 5 |
353 16 1 6 |
354 16 1 2 |
355 16 1 3 |
356 16 4 1 |
357 16 4 2 |
360 8 1 4 |
361 8 1 7 |
362 8 1 1 |
363 8 1 2 |
364 8 1 3 |
365 8 1 8 |
366 9 1 4 |
367 9 1 7 |
368 9 1 1 |
369 9 1 2 |
370 9 1 3 |
371 9 1 8 |
372 12 1 1 |
373 12 4 1 |
374 4 1 1 |
375 4 4 1 |
376 3 1 1 |
377 3 4 1 |
381 2 1 1 |
382 2 4 1 |
383 1 1 1 |
384 1 1 2 |
385 1 1 8 |
386 18 1 4 |
387 18 1 7 |
388 18 1 1 |
389 18 1 2 |
390 18 1 3 |
391 19 1 1 |
392 19 1 2 |
393 19 4 1 |
394 19 4 2 |
395 6 1 1 |
396 6 4 1 |
\. |
-- |
-- Data for Name: gruppi_modifica; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY gruppi_modifica (id, id_gruppo, id_gruppo_modifica) FROM stdin; |
\. |
-- |
-- Data for Name: logs; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY logs (id, "timestamp", table_name, old_value, new_value, id_anagrafiche, field, id_record) FROM stdin; |
\. |
-- |
-- Data for Name: messages; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY messages (id, message, owner, modification_time, transmission_time) FROM stdin; |
\. |
-- |
-- Data for Name: messages_users; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY messages_users (id, id_messages, id_anagrafiche, notification_time) FROM stdin; |
\. |
-- |
-- Data for Name: recordset; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY recordset (id, id_anagrafiche, name, size, block, query_numrec, query_records, query_where, query_find_records) FROM stdin; |
\. |
-- |
-- Data for Name: recordset_rows; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY recordset_rows (id, id_recordset, num_row, id_record) FROM stdin; |
\. |
-- |
-- Data for Name: report_id; Type: TABLE DATA; Schema: public; Owner: postgres |
-- |
COPY report_id (id, key, group_id) FROM stdin; |
\. |
-- |
-- Name: anagrafiche_gruppi_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY anagrafiche_gruppi |
ADD CONSTRAINT anagrafiche_gruppi_pkey PRIMARY KEY (id); |
-- |
-- Name: anagrafiche_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY anagrafiche |
ADD CONSTRAINT anagrafiche_pkey PRIMARY KEY (id); |
-- |
-- Name: autorizzazioni_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY autorizzazioni |
ADD CONSTRAINT autorizzazioni_pkey PRIMARY KEY (id); |
-- |
-- Name: funzioni_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY funzioni |
ADD CONSTRAINT funzioni_pkey PRIMARY KEY (id); |
-- |
-- Name: gruppi_funzioni_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY gruppi_funzioni |
ADD CONSTRAINT gruppi_funzioni_pkey PRIMARY KEY (id); |
-- |
-- Name: gruppi_modifica_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY gruppi_modifica |
ADD CONSTRAINT gruppi_modifica_pkey PRIMARY KEY (id); |
-- |
-- Name: gruppi_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY gruppi |
ADD CONSTRAINT gruppi_pkey PRIMARY KEY (id); |
-- |
-- Name: id_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY messages_users |
ADD CONSTRAINT id_pkey PRIMARY KEY (id); |
-- |
-- Name: logs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY logs |
ADD CONSTRAINT logs_pkey PRIMARY KEY (id); |
-- |
-- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY messages |
ADD CONSTRAINT messages_pkey PRIMARY KEY (id); |
-- |
-- Name: recordset_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY recordset |
ADD CONSTRAINT recordset_pkey PRIMARY KEY (id); |
-- |
-- Name: recordset_rows_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY recordset_rows |
ADD CONSTRAINT recordset_rows_pkey PRIMARY KEY (id); |
-- |
-- Name: report_id_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: |
-- |
ALTER TABLE ONLY report_id |
ADD CONSTRAINT report_id_pkey PRIMARY KEY (id); |
-- |
-- Name: anagrafiche_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX anagrafiche_id_idx ON recordset USING btree (id_anagrafiche); |
-- |
-- Name: fki_logs_id_anagrafiche; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX fki_logs_id_anagrafiche ON logs USING btree (id_anagrafiche); |
-- |
-- Name: fki_recordset_anagrafiche; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX fki_recordset_anagrafiche ON recordset USING btree (id_anagrafiche); |
-- |
-- Name: fki_recordset_rows; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX fki_recordset_rows ON recordset_rows USING btree (id_recordset); |
-- |
-- Name: logs_id_anagrafiche; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX logs_id_anagrafiche ON logs USING btree (id_anagrafiche); |
-- |
-- Name: logs_table; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX logs_table ON logs USING btree (table_name); |
-- |
-- Name: logs_timestamp; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX logs_timestamp ON logs USING btree ("timestamp"); |
-- |
-- Name: messages_date; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX messages_date ON messages USING btree (modification_time); |
-- |
-- Name: messages_owner; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX messages_owner ON messages USING btree (owner); |
-- |
-- Name: messages_users_id_anagrafiche; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX messages_users_id_anagrafiche ON messages_users USING btree (id_anagrafiche); |
-- |
-- Name: messages_users_id_messages; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX messages_users_id_messages ON messages_users USING btree (id_messages); |
-- |
-- Name: messages_users_notification_time; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX messages_users_notification_time ON messages_users USING btree (notification_time); |
-- |
-- Name: prefix_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX prefix_idx ON recordset USING btree (name); |
-- |
-- Name: recordset_rows_id_record; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX recordset_rows_id_record ON recordset_rows USING btree (id_record); |
-- |
-- Name: recordset_rows_id_recordset; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX recordset_rows_id_recordset ON recordset_rows USING btree (id_recordset); |
-- |
-- Name: recordset_rows_num_row; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE INDEX recordset_rows_num_row ON recordset_rows USING btree (num_row); |
-- |
-- Name: recordset_rows_unique; Type: INDEX; Schema: public; Owner: postgres; Tablespace: |
-- |
CREATE UNIQUE INDEX recordset_rows_unique ON recordset_rows USING btree (id_recordset, id_record); |
-- |
-- Name: anagrafiche_gruppi_id_anagrafiche; Type: FK CONSTRAINT; Schema: public; Owner: postgres |
-- |
ALTER TABLE ONLY anagrafiche_gruppi |
ADD CONSTRAINT anagrafiche_gruppi_id_anagrafiche FOREIGN KEY (id_anagrafiche) REFERENCES anagrafiche(id) ON UPDATE RESTRICT ON DELETE CASCADE; |
-- |
-- Name: anagrafiche_gruppi_id_gruppi; Type: FK CONSTRAINT; Schema: public; Owner: postgres |
-- |
ALTER TABLE ONLY anagrafiche_gruppi |
ADD CONSTRAINT anagrafiche_gruppi_id_gruppi FOREIGN KEY (id_gruppi) REFERENCES gruppi(id) ON UPDATE RESTRICT ON DELETE CASCADE; |
-- |
-- Name: gruppi_funzioni_id_autorizzazioni; Type: FK CONSTRAINT; Schema: public; Owner: postgres |
-- |
ALTER TABLE ONLY gruppi_funzioni |
ADD CONSTRAINT gruppi_funzioni_id_autorizzazioni FOREIGN KEY (id_autorizzazioni) REFERENCES autorizzazioni(id) ON UPDATE RESTRICT ON DELETE RESTRICT; |
-- |
-- Name: gruppi_funzioni_id_funzioni; Type: FK CONSTRAINT; Schema: public; Owner: postgres |
-- |
ALTER TABLE ONLY gruppi_funzioni |
ADD CONSTRAINT gruppi_funzioni_id_funzioni FOREIGN KEY (id_funzioni) REFERENCES funzioni(id) ON UPDATE RESTRICT ON DELETE RESTRICT; |
-- |
-- Name: gruppi_funzioni_id_gruppi; Type: FK CONSTRAINT; Schema: public; Owner: postgres |
-- |
ALTER TABLE ONLY gruppi_funzioni |
ADD CONSTRAINT gruppi_funzioni_id_gruppi FOREIGN KEY (id_gruppi) REFERENCES gruppi(id) ON UPDATE RESTRICT ON DELETE RESTRICT; |
-- |
-- Name: gruppi_modifica_id_gruppo; Type: FK CONSTRAINT; Schema: public; Owner: postgres |
-- |
ALTER TABLE ONLY gruppi_modifica |
ADD CONSTRAINT gruppi_modifica_id_gruppo FOREIGN KEY (id_gruppo) REFERENCES gruppi(id) ON UPDATE RESTRICT ON DELETE RESTRICT; |
-- |
-- Name: gruppi_modifica_id_gruppo_modifica; Type: FK CONSTRAINT; Schema: public; Owner: postgres |
-- |
ALTER TABLE ONLY gruppi_modifica |
ADD CONSTRAINT gruppi_modifica_id_gruppo_modifica FOREIGN KEY (id_gruppo_modifica) REFERENCES gruppi(id) ON UPDATE RESTRICT ON DELETE RESTRICT; |
-- |
-- Name: logs_id_anagrafiche; Type: FK CONSTRAINT; Schema: public; Owner: postgres |
-- |
ALTER TABLE ONLY logs |
ADD CONSTRAINT logs_id_anagrafiche FOREIGN KEY (id_anagrafiche) REFERENCES anagrafiche(id) ON UPDATE RESTRICT ON DELETE RESTRICT; |
-- |
-- Name: messages_users_messages; Type: FK CONSTRAINT; Schema: public; Owner: postgres |
-- |
ALTER TABLE ONLY messages_users |
ADD CONSTRAINT messages_users_messages FOREIGN KEY (id_messages) REFERENCES messages(id) ON UPDATE RESTRICT ON DELETE CASCADE; |
-- |
-- Name: recordset_anagrafiche; Type: FK CONSTRAINT; Schema: public; Owner: postgres |
-- |
ALTER TABLE ONLY recordset |
ADD CONSTRAINT recordset_anagrafiche FOREIGN KEY (id_anagrafiche) REFERENCES anagrafiche(id) ON DELETE CASCADE; |
-- |
-- Name: recordset_rows; Type: FK CONSTRAINT; Schema: public; Owner: postgres |
-- |
ALTER TABLE ONLY recordset_rows |
ADD CONSTRAINT recordset_rows FOREIGN KEY (id_recordset) REFERENCES recordset(id) ON DELETE CASCADE; |
-- |
-- Name: public; Type: ACL; Schema: -; Owner: postgres |
-- |
REVOKE ALL ON SCHEMA public FROM PUBLIC; |
REVOKE ALL ON SCHEMA public FROM postgres; |
GRANT ALL ON SCHEMA public TO postgres; |
GRANT USAGE ON SCHEMA public TO PUBLIC; |
-- |
-- Name: anagrafiche; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE anagrafiche FROM PUBLIC; |
REVOKE ALL ON TABLE anagrafiche FROM postgres; |
GRANT ALL ON TABLE anagrafiche TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE anagrafiche TO masonsql; |
GRANT SELECT ON TABLE anagrafiche TO report; |
-- |
-- Name: anagrafiche_gruppi; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE anagrafiche_gruppi FROM PUBLIC; |
REVOKE ALL ON TABLE anagrafiche_gruppi FROM postgres; |
GRANT ALL ON TABLE anagrafiche_gruppi TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE anagrafiche_gruppi TO masonsql; |
GRANT SELECT ON TABLE anagrafiche_gruppi TO report; |
-- |
-- Name: anagrafiche_gruppi_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE anagrafiche_gruppi_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE anagrafiche_gruppi_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE anagrafiche_gruppi_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE anagrafiche_gruppi_id_seq TO masonsql; |
-- |
-- Name: anagrafiche_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE anagrafiche_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE anagrafiche_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE anagrafiche_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE anagrafiche_id_seq TO masonsql; |
-- |
-- Name: autorizzazioni; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE autorizzazioni FROM PUBLIC; |
REVOKE ALL ON TABLE autorizzazioni FROM postgres; |
GRANT ALL ON TABLE autorizzazioni TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE autorizzazioni TO masonsql; |
GRANT SELECT ON TABLE autorizzazioni TO report; |
-- |
-- Name: autorizzazioni_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE autorizzazioni_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE autorizzazioni_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE autorizzazioni_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE autorizzazioni_id_seq TO masonsql; |
-- |
-- Name: funzioni; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE funzioni FROM PUBLIC; |
REVOKE ALL ON TABLE funzioni FROM postgres; |
GRANT ALL ON TABLE funzioni TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE funzioni TO masonsql; |
GRANT SELECT ON TABLE funzioni TO report; |
-- |
-- Name: funzioni_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE funzioni_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE funzioni_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE funzioni_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE funzioni_id_seq TO masonsql; |
-- |
-- Name: gruppi; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE gruppi FROM PUBLIC; |
REVOKE ALL ON TABLE gruppi FROM postgres; |
GRANT ALL ON TABLE gruppi TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE gruppi TO masonsql; |
GRANT SELECT ON TABLE gruppi TO report; |
-- |
-- Name: gruppi_and_anagrafiche; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE gruppi_and_anagrafiche FROM PUBLIC; |
REVOKE ALL ON TABLE gruppi_and_anagrafiche FROM postgres; |
GRANT ALL ON TABLE gruppi_and_anagrafiche TO postgres; |
GRANT SELECT ON TABLE gruppi_and_anagrafiche TO report; |
GRANT SELECT ON TABLE gruppi_and_anagrafiche TO masonsql; |
-- |
-- Name: gruppi_funzioni; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE gruppi_funzioni FROM PUBLIC; |
REVOKE ALL ON TABLE gruppi_funzioni FROM postgres; |
GRANT ALL ON TABLE gruppi_funzioni TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE gruppi_funzioni TO masonsql; |
GRANT SELECT ON TABLE gruppi_funzioni TO report; |
-- |
-- Name: gruppi_funzioni_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE gruppi_funzioni_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE gruppi_funzioni_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE gruppi_funzioni_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE gruppi_funzioni_id_seq TO masonsql; |
-- |
-- Name: gruppi_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE gruppi_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE gruppi_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE gruppi_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE gruppi_id_seq TO masonsql; |
-- |
-- Name: gruppi_modifica; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE gruppi_modifica FROM PUBLIC; |
REVOKE ALL ON TABLE gruppi_modifica FROM postgres; |
GRANT ALL ON TABLE gruppi_modifica TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE gruppi_modifica TO masonsql; |
GRANT SELECT ON TABLE gruppi_modifica TO report; |
-- |
-- Name: gruppi_modifica_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE gruppi_modifica_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE gruppi_modifica_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE gruppi_modifica_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE gruppi_modifica_id_seq TO masonsql; |
-- |
-- Name: logs; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE logs FROM PUBLIC; |
REVOKE ALL ON TABLE logs FROM postgres; |
GRANT ALL ON TABLE logs TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE logs TO masonsql; |
GRANT SELECT ON TABLE logs TO report; |
-- |
-- Name: logs_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE logs_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE logs_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE logs_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE logs_id_seq TO masonsql; |
-- |
-- Name: messages; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE messages FROM PUBLIC; |
REVOKE ALL ON TABLE messages FROM postgres; |
GRANT ALL ON TABLE messages TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE messages TO masonsql; |
GRANT SELECT ON TABLE messages TO report; |
-- |
-- Name: messages_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE messages_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE messages_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE messages_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE messages_id_seq TO masonsql; |
-- |
-- Name: messages_users; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE messages_users FROM PUBLIC; |
REVOKE ALL ON TABLE messages_users FROM postgres; |
GRANT ALL ON TABLE messages_users TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE messages_users TO masonsql; |
GRANT SELECT ON TABLE messages_users TO report; |
-- |
-- Name: messages_users_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE messages_users_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE messages_users_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE messages_users_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE messages_users_id_seq TO masonsql; |
-- |
-- Name: recordset; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE recordset FROM PUBLIC; |
REVOKE ALL ON TABLE recordset FROM postgres; |
GRANT ALL ON TABLE recordset TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE recordset TO masonsql; |
-- |
-- Name: recordset_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE recordset_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE recordset_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE recordset_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE recordset_id_seq TO masonsql; |
-- |
-- Name: recordset_rows; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE recordset_rows FROM PUBLIC; |
REVOKE ALL ON TABLE recordset_rows FROM postgres; |
GRANT ALL ON TABLE recordset_rows TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE recordset_rows TO masonsql; |
-- |
-- Name: recordset_rows_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE recordset_rows_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE recordset_rows_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE recordset_rows_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE recordset_rows_id_seq TO masonsql; |
-- |
-- Name: report_id; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON TABLE report_id FROM PUBLIC; |
REVOKE ALL ON TABLE report_id FROM postgres; |
GRANT ALL ON TABLE report_id TO postgres; |
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE report_id TO masonsql; |
GRANT SELECT ON TABLE report_id TO report; |
-- |
-- Name: report_id_id_seq; Type: ACL; Schema: public; Owner: postgres |
-- |
REVOKE ALL ON SEQUENCE report_id_id_seq FROM PUBLIC; |
REVOKE ALL ON SEQUENCE report_id_id_seq FROM postgres; |
GRANT ALL ON SEQUENCE report_id_id_seq TO postgres; |
GRANT SELECT,UPDATE ON SEQUENCE report_id_id_seq TO masonsql; |
-- |
-- PostgreSQL database dump complete |
-- |
/masonsql_dojo1.6/utility/convert_iso-8859-15_to_utf-8.sh |
---|
0,0 → 1,32 |
#!/bin/bash |
if [ "$1" != "--CONVERT" ] |
then |
find ./ -type f -exec /opt/masonsql/utility/convert_iso-8859-15_to_utf-8.sh --CONVERT {} \; |
exit |
fi |
shift 1 |
F=$1 |
#echo CHECK $F |
# cartelle da escludere |
[ -z "${F%%*/jquery*}" ] && exit |
[ -z "${F%%*/FCKeditor/*}" ] && exit |
[ -z "${F%%*/bin/*}" ] && exit |
# estensioni del file |
[ -z "${F%%*.txt}" -o -z "${F%%*.htm}" -o -z "${F%%*.html}" -o -z "${F%%*.js}" \ |
-o -z "${F%%*.comp}" -o -z "${F%%*.css}" -o -z "${F%%*.pl}" -o -z "${F%%*.pm}" \ |
-o -z "${F%%*.include}" -o -z "${F%%*.sql}" -o -z "${F%%*handler}" \ |
-o -z "${F%%*APPUNTI}" -o -z "${F%%*.mason}" -o -z "${F%%*.conf}" ] || exit |
[ -f "$F.ISO-8859-15" ] && exit |
echo "CONVERT $F" |
cp -a "$F" "$F.ISO-8859-15" |
iconv --from-code=ISO-8859-15 --to-code=UTF-8 "$F.ISO-8859-15" > "$F" |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/masonsql_dojo1.6/utility/UpiPrinterServer/UpiPrinterServer.pl |
---|
0,0 → 1,451 |
# Copyright 2007 Guido Brugnara <gdo@leader.it> |
# |
# Il programma è distribuito con licenza duale: |
# Commerciale oppure GPL (http://www.gnu.org/copyleft/gpl.html). |
# |
# L'autore è disponibile ad integrare le modifiche proposte da Terzi solo se il |
# contributo viene rilasciato con licenza Perl Artistic Licence al fine di |
# garantire all'autore la possibilità di applicare la licenza duale alla nuova |
# versione. |
my $release = '0.15'; |
$|=1; |
use Win32; |
use Win32::Daemon; |
use Win32::EventLog; |
use Win32::TieRegistry; |
use IO::Select; |
use URI::Escape; |
use LWP::UserAgent; |
use HTML::Entities; |
use HTTP::Status; |
use HTTP::Daemon::SSL; |
use Win32::Printer::Direct; |
use Win32::Printer::Enum; |
my %print_errors = ( |
-1 => 'Memory allocation error', |
-2 => 'Error opening the file', |
-3 => 'Error opening the printer', |
-4 => 'Error startint the print job', |
-5 => 'Error writing to printer', |
-6 => 'Error ending the print job', |
-7 => 'Error closing printer' |
); |
use Data::Dumper; |
use File::Temp qw(tempfile); |
my $nameService = 'UpiPrinterServer'; |
# Nome del server HTTP che viene inviato al client |
sub HTTP::Daemon::product_tokens { |
"$nameService Rel:$release"; |
} |
# Chiave di registry del servizio |
$RegistryKeyName = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\$nameService"; |
# nome della stampante di default |
$DefaultPrinterName = ''; |
# path file certificati |
$CertsPath = ''; |
my $PORTNO = 22000; # porta di ascolto del server HTTPS |
my $LOOP_PERIOD = 20; # millisecondi di intervallo per la verifica di chiamate pendenti |
my $COUNT=0; # conteggio delle chiamate |
# invio i messaggi di errore e warn al file Log di Windows |
use Win32::EventLog::Carp { Source => $nameService }; |
my $Select = IO::Select->new(); |
# cartella certificati nello stesso percorso dell'eseguibile |
$CertsDefaultDir = $0; |
$CertsDefaultDir =~ s/[^\\]*$//; |
$CertsDefaultDir .= 'certs'; |
if($ARGV[0] eq '-install'){ |
use Win32::GUI::Carp 'warningsToDialog'; |
# visualizza immediatamente il warning |
$Win32::GUI::Carp::ImmediateWarnings = 1; |
%Hash = ( |
machine => '', |
name => $nameService, |
display => 'UPI Printer Server', |
path => $^X, |
user => '', |
pwd => '', |
description => 'Server stampa via HTTPS', |
parameters =>"\"$0\"", |
); |
if($0 =~ m/\.exe/i){ |
$Hash{'path'} = $0; |
$Hash{'parameters'} = ''; |
} |
if(Win32::Daemon::CreateService(\%Hash)){ |
# modifico nel Registry la configurazione del servizio |
my $RegistryKeyService = new Win32::TieRegistry $RegistryKeyName or die "Can't access $RegistryKeyName key: $^E\n"; |
# con 0x110 l'applicazione può interagire con il desktop |
$RegistryKeyService->SetValue('Type', '0x010', REG_DWORD) or die "Error on set Type entry: $^E\n"; |
# imposto la chiave per la stampate di default |
$RegistryKeyService->SetValue('DefaultPrinterName', '', REG_SZ) or die "Error on set DefaultPrinterName entry: $^E\n"; |
# chiave percorso certificati |
my $CertsDir = $ARGV[1] eq '-certs' ? $ARGV[2] : $CertsDefaultDir; |
$RegistryKeyService->SetValue('CertsPath', $CertsDir, REG_SZ) or die "Error on set CertsPath entry: $^E\n"; |
# lancio il servizio |
use Win32::Service; |
Win32::Service::StartService('', $nameService); |
warn "Servizio $nameService attivato!\n"; |
}else{ |
warn "Attivazione servizio $nameService fallito!:\n" . Win32::FormatMessage( Win32::Daemon::GetLastError() ) . "\n"; |
} |
exit; |
}elsif($ARGV[0] eq '-remove'){ |
use Win32::GUI::Carp 'warningsToDialog'; |
# visualizza immediatamente il warning |
$Win32::GUI::Carp::ImmediateWarnings = 1; |
my $name = $nameService; |
# fermo il servizio prima di disinstallarlo |
use Win32::Service; |
Win32::Service::StopService('', $nameService); |
if( Win32::Daemon::DeleteService('', $name ) ) { |
warn "Servizio $nameService disinstallato.\n"; |
} else { |
warn "Disattivazione servizio $nameService fallito:\n" . Win32::FormatMessage( Win32::Daemon::GetLastError() ) . "\n"; |
} |
exit; |
}elsif($ARGV[0] eq '-debug'){ |
# esecuzione demone da riga di comando (si presuppone che i parametri nel registry siano presenti) |
InitVariables(); |
openHTTPS(); |
while(1){ |
runningHTTPS(); |
} |
closeHTTPS(); |
exit; |
} |
# EVENTLOG_ERROR_TYPE: An Error event is being logged. |
# EVENTLOG_WARNING_TYPE: A Warning event is being logged. |
# EVENTLOG_INFORMATION_TYPE: An Information event is being logged. |
# |
sub Log($;$) { |
my ($mess,$type) = @_; |
defined $type or $type = EVENTLOG_INFORMATION_TYPE; |
my $EventLog = new Win32::EventLog( $nameService ) || die $!; |
$EventLog->Report({ EventType => $type, |
Strings => $mess, |
}) || die $!; |
} |
# MB_ICONSTOP "X" in a red circle |
# MB_ICONQUESTION question mark in a bubble |
# MB_ICONEXCLAMATION exclamation mark in a yellow triangle |
# MB_ICONINFORMATION "i" in a bubble |
# |
sub Die($;$){ |
my ($mess, $type) = @_; |
Log $mess; |
AlertFork $mess, $type; |
die $mess."\n"; |
} |
sub Alert($;$){ |
my ($mess, $type) = @_; |
defined $type or $type = MB_ICONEXCLAMATION; |
Log $mess; |
Win32::MsgBox($mess, $type, $nameService); |
} |
sub AlertFork($;$){ |
my ($mess, $type) = @_; |
defined $type or $type = MB_ICONEXCLAMATION; |
if(!defined(my $pid = fork)){ |
Win32::MsgBox("Error to start kild process", MB_ICONEXCLAMATION, "UPI Printer Server"); |
die "Error to start kild process"; |
}else{ |
if($pid == 0){ |
# processo figlio |
Alert($mess, $type); |
exit; |
} |
} |
} |
sub openHTTPS(){ |
my $SSL_key_file = $CertsPath.'\server-key.pem'; |
my $SSL_cert_file = $CertsPath.'\server-cert.pem'; |
# verifico la presenza dei certificati |
if(! -e $SSL_key_file){ |
Die "File $SSL_key_file don't exist\n"; |
} |
if(! -e $SSL_cert_file){ |
Die "File $SSL_cert_file don't exist\n"; |
} |
my $daemon = new HTTP::Daemon::SSL( |
LocalAddr => '127.0.0.1', |
SSL_key_file => $SSL_key_file, |
SSL_cert_file => $SSL_cert_file, |
LocalPort => $PORTNO |
); |
if(!$daemon){ |
Die("HTTPS server: error on open [$@]\n"); |
} |
$Select->add($daemon); |
Log "Start local HTTPS server on port $PORTNO\n"; |
} |
sub closeHTTPS(){ |
for my $daemon ($Select->handles){ |
$Select->remove($daemon); |
undef $daemon; |
} |
Log "Stop local HTTPS server on port $PORTNO\n"; |
} |
sub runningHTTPS(){ |
if(my @ready = $Select->can_read(int($LOOP_PERIOD * 0.1))){ |
foreach my $daemon (@ready){ |
$COUNT++; |
if(my $connect = $daemon->accept){ |
$connect->autoflush(1); |
my $from = $connect->peerhost; |
if($from ne '127.0.0.1'){ |
# solo le chiamate locali vengono accettate |
$connect->send_error(RC_FORBIDDEN); |
}else{ |
my $request = $connect->get_request(1); |
if(!$request){ |
# in IE con SSL alla richiesta del certificato non attendibile non è definito l'oggetto request |
next; |
} |
my $url = $request->url; #->path; |
my $content = $request->content; |
my $method = $request->method; |
if($url =~ m|^/printers$|i || $url =~ m|^/set_default/.*|i || $url =~ m|^/$|){ |
if($url =~ m|^/set_default/(.*)|i){ |
$DefaultPrinterName = uri_unescape($1); |
# imposto la chiave per la stampate di default |
my $RegistryKeyService = new Win32::TieRegistry $RegistryKeyName or die "Can't access $RegistryKeyName key: $^E\n"; |
$RegistryKeyService->SetValue('DefaultPrinterName', $DefaultPrinterName, REG_SZ) or die "Error on set DefaultPrinterName entry: $^E\n"; |
undef $RegistryKeyService; |
} |
my $message = qq| |
<html> |
<head><title>UPI Printer Server - Lista stampanti disponibili</title></head> |
<body> |
<h1>UPI Printer Server</h1> |
<h2>Lista stampanti disponibili</h2> |
<p>Selezionare la stampante che si desidera venga utilizzata (<cite>default</cite>):</p> |
<ul> |
|; |
my @printers = Printers(); |
foreach my $printer (@printers){ |
$message .= '<li><A href="/set_default/' . uri_escape($printer->{PrinterName}) . '">' |
. encode_entities($printer->{PrinterName}) . "</A></li>\n"; |
} |
$message .= qq| |
</ul> |
<p>Attuale stampante selezionata (<cite>default</cite>): <b>| . |
encode_entities($DefaultPrinterName) . q|</b></p> |
</body> |
<script> |
//document.domain = 'leader.it'; |
</script> |
</html> |
|; |
$message =~ s/^\s+//m; |
my $response = HTTP::Response->new(RC_OK, 'List printers'); |
$response->header( 'Content-Type' => 'text/html'); |
$response->content($message); |
$connect->send_response($response); |
}elsif($url =~ m|^/print/(.*)|i || $url =~ m|^/print$|i){ |
my $printer_name = $1 ? uri_unescape($1) : $DefaultPrinterName; |
if($printer_name){ |
if($request->method eq 'POST'){ |
my ($fh, $file_name) = tempfile(); |
# copio dal buffer nel file temporaneo. |
print $fh $request->content; |
close $fh; |
my $err = Printfile($printer_name, $file_name); |
if($err == 1){ |
my $response = HTTP::Response->new(RC_ACCEPT, 'Print OK'); |
$response->header( 'Content-Type' => 'text/plain'); |
$response->content('Print OK'); |
$connect->send_response($response); |
}else{ |
$connect->send_error(RC_INTERNAL_SERVER_ERROR, "Print to $printer_name with error $err: $print_errors{$err}") |
} |
}else{ |
$connect->send_error(RC_METHOD_NOT_ALLOWED, 'Only POST method is allowed'); |
} |
}else{ |
$connect->send_error(RC_NOT_FOUND, 'No default printer'); |
} |
}elsif($url =~ m|^/from_server/([\w\.]+)/(\w+)/(.+)$|i || $url =~ m|^/from_server/([\w\.]+)/(\w+)|i){ |
my $file = $2; |
my $URL = "https://$1/UpiPrinterServer.txt?file=$file"; |
my $printer_name = $3 ? uri_unescape($3) : $DefaultPrinterName; |
if($printer_name){ |
# effettuo la chiamata indicata |
my $user_agent = LWP::UserAgent->new; |
$user_agent->agent($daemon->product_tokens); |
$user_agent->timeout(5); |
my $user_request = HTTP::Request->new(GET => $URL); |
my $user_response = $user_agent->request($user_request); |
if($user_response->is_success){ |
my ($fh, $file_name) = tempfile(); |
# copio dal buffer nel file temporaneo. |
print $fh $user_response->content; |
close $fh; |
my $err = Printfile($printer_name, $file_name); |
if($err == 1){ |
$connect->send_response(Response('printed', "File $file printed to $printer_name")); |
}else{ |
my $code = -$err; |
$connect->send_response(Response("print_err_$code", "Print to $printer_name with error $err: $print_errors{$err}")); |
} |
}else{ |
$connect->send_response(Response('remote_err_'.$user_response->code, 'Remote server error: '.$user_response->status_line."\n")); |
} |
}else{ |
$connect->send_response(Response('no_print_default', 'No default printer is selected')); |
} |
}else{ |
$connect->send_error(RC_NOT_FOUND, 'Command mismatch'); |
} |
} |
$connect->close; |
}else{ |
Log "Error to connect: $@\n"; |
} |
} |
} |
} |
# prepara la risposta da inviare |
sub Response($$){ |
my($status, $status_mess) = @_; |
$status =~ s/'/\\'/sg; |
$status_mess =~ s/'/\\'/sg; |
$status_mess =~ s/\n/\\n/sg; |
my $response = HTTP::Response->new(RC_ACCEPT, 'Print OK'); |
$response->header( 'Content-Type' => 'text/plain'); |
$response->content(qq| |
if(UpiPrinterServerHandler){ |
UpiPrinterServerHandler('$status', '$status_mess'); |
}else{ |
alert('printed!\\nFile $file printed to $printer_name'); |
} |
|); |
return $response; |
} |
#---------------------------------------------- Callbacks |
sub Callback_Running { |
my( $Event, $Context ) = @_; |
# Note that here you want to check that the state |
# is indeed SERVICE_RUNNING. Even though the Running |
# callback is called it could have done so before |
# calling the "Start" callback. |
if( SERVICE_RUNNING == Win32::Daemon::State() ) |
{ |
# ... process your main stuff here... |
# ... note that here there is no need to |
# change the state |
# AlertFork('Running '.$count++.' ...'); |
runningHTTPS(); |
# AlertFork("Running $count."); |
} |
} |
sub InitVariables(){ |
# impostazione stampate di default |
my $RegistryKeyService = new Win32::TieRegistry $RegistryKeyName or die "Can't access $RegistryKeyName key: $^E\n"; |
$DefaultPrinterName = $RegistryKeyService->GetValue('DefaultPrinterName'); |
# Path cartella dei certificati |
$CertsPath = $RegistryKeyService->GetValue('CertsPath'); |
undef $RegistryKeyService; |
} |
sub Callback_Start { |
my( $Event, $Context ) = @_; |
# Initialization code |
# ...do whatever you need to do to start... |
#AlertFork('Callback_Start ...'); |
InitVariables(); |
openHTTPS(); |
$Context->{last_state} = SERVICE_RUNNING; |
Win32::Daemon::State( SERVICE_RUNNING ); |
#AlertFork('Callback_Start.'); |
} |
sub Callback_Pause { |
my( $Event, $Context ) = @_; |
#AlertFork('Callback_Pause ...'); |
closeHTTPS(); |
$Context->{last_state} = SERVICE_PAUSED; |
Win32::Daemon::State( SERVICE_PAUSED ); |
#AlertFork('Callback_Pause.'); |
} |
sub Callback_Continue { |
my( $Event, $Context ) = @_; |
#AlertFork('Callback_Continue ...'); |
openHTTPS(); |
$Context->{last_state} = SERVICE_RUNNING; |
Win32::Daemon::State( SERVICE_RUNNING ); |
#AlertFork('Callback_Continue.'); |
} |
sub Callback_Stop { |
my( $Event, $Context ) = @_; |
#AlertFork('Callback_Stop ...'); |
closeHTTPS(); |
$Context->{last_state} = SERVICE_STOPPED; |
Win32::Daemon::State( SERVICE_STOPPED ); |
# We need to notify the Daemon that we want to stop callbacks and the service. |
Win32::Daemon::StopService(); |
#AlertFork('Callback_Stop.'); |
} |
Win32::Daemon::RegisterCallbacks( { |
start => \&Callback_Start, |
running => \&Callback_Running, |
stop => \&Callback_Stop, |
pause => \&Callback_Pause, |
continue => \&Callback_Continue, |
} ); |
%Context = ( |
last_state => SERVICE_STOPPED, |
start_time => time(), |
); |
if(! defined $ENV{'USERNAME'}){ |
Win32::Daemon::StartService(undef, $LOOP_PERIOD); |
}else{ |
warn qq| |
Utilizzare il parametro -install per installare il servizio |
oppure -remove per disinstallarlo. |
Aggiungere una seconda opzione [-certs <percorso>] per |
indicare la cartella contenente i certificati SSL del server |
(default: $CertsDefaultDir) |
In caso di errore è possibile lanciare il server con l'opzione |
[-debug] da riga di comando (si presuppone che il servizio |
sia installato e che i parametri siano stati configurati nel |
registry). |
|; |
} |
exit; |
/masonsql_dojo1.6/utility/UpiPrinterServer/INSTALLAZIONE.txt |
---|
0,0 → 1,67 |
UpiPrinterServer versione 0.15 |
PREREQUISITI |
--------------------------------------------------------------- |
Il driver è stato verificato su Windows XP SP2. |
Verificare che sul browser utilizzato (Internet Explorer o Mozilla Firefox) |
sia installato il certificato che autentica il servizio: |
Per Internet Explorer: |
- aprire la pagina web https://srl.leader.it/ca.leader.it/ca.leader.it.cert.der |
- selezionare [Apri] nella maschera che compare |
- installare il certificato con il pulsante che compare nella maschera |
successiva |
- confermare tutte le successive maschere fino a conclusione |
Per FireFox: |
- aprire la pagina web https://srl.leader.it/ca.leader.it/ca.leader.it.cert.der |
- selezionare [Accetta questo certificato in modo permanente] e |
confermare |
- scegliere la voce [Dai fiducia a questo CA per l'identificazione dei siti |
WEB] e confermare |
AGGIORNAMENTO |
--------------------------------------------------------------- |
Per aggiornare è necessario prima disinstallare e |
successivamente installare. |
DISINSTALLAZIONE |
--------------------------------------------------------------- |
Eseguire il comando di disinstallazione: |
C:\Programmi\UpiPrinterServer\UpiPrinterServer.exe -remove |
Cancellare la cartella C:\Programmi\UpiPrinterServer |
INSTALLAZIONE |
--------------------------------------------------------------- |
Spostare la cartella UpiPrinterServer contenuta nel file |
UpiPrinterServer.zip nella cartella del PC: C:\Programmi |
Eseguire il comando di installazione: |
C:\Programmi\UpiPrinterServer\UpiPrinterServer.exe -install |
Verificare che il servizio "UpiPrinterServer" sia attivo: |
https://localhost:22000 |
Selezionare la stampante desiderata per la stampa dalla pagina Web visualizzata. |
Verificare se il servizio lavora utilizzando la pagina di test: |
https://sois.provincia.tn.it/test/test_UpiPrinterServer.html |
/masonsql_dojo1.6/utility/UpiPrinterServer/LEGGIMI.txt |
---|
0,0 → 1,85 |
UpiPrinterServer versione 0.15 |
Installare il Perl di ActiveState 5.8.8 Build 822 |
Repository utilizzati per reperire i package installati: |
ppm rep add theoryx5.uwinnipeg.ca http://theoryx5.uwinnipeg.ca/ppms/ |
ppm rep add trouchelle.com http://trouchelle.com/ppm/ |
ppm rep add www.bribes.org http://www.bribes.org/perl/ppm |
#ppm rep add "ActiveState PPM2 Repository" #http://ppm.ActiveState.com/cgibin/PPM/ppmserver-5.8-windows.pl?urn:/PPMServer |
#ppm rep down "ActiveState Package Repository" |
#ppm rep down "ActiveState Package Repository" |
#ppm rep down "ActiveState Package Repository" |
#ppm rep down "ActiveState Package Repository" |
http://ppm4.activestate.com/MSWin32-x86/5.8/822/package.xml |
Package da installare oltre la base standard di ActiveState: |
#ppm install Net_SSLeay.pm |
ppm install Net-SSLeay |
ppm install HTTP-Daemon-SSL |
ppm install Win32-Printer |
ppm install Win32-EventLog-Carp |
ppm install Win32-GUI-Carp |
# http://www.roth.net/perl/Daemon/ |
ppm install http://www.roth.net/perl/packages/win32-daemon.ppd |
L'applicazione è reperibile nel repository SVN: |
https://svn.leader.it/wsvn/masonsql/utility/UpiPrinterServer/ |
COMPILAZIONE |
--------------------------------------------------------------- |
Installare i package per la compilazione |
ppm install Getopt-ArgvFile |
ppm install PAR-Packer |
# Se si vuole offuscare il codice: |
ppm install B-Deobfuscate |
utilizzare lo script di compilazione: |
compile.bat UpiPrinterServer |
Verrà creato il file: UpiPrinterServer.exe |
INSTALLAZIONE |
--------------------------------------------------------------- |
Creare la cartella "C:\Programmi\UpiPrinterServer" |
Copiare nella cartella il file "UpiPrinterServer.exe" e la |
cartella "certs" contenente i certificati: |
server-cert.pem |
server-key.pem |
Eseguire il comando di installazione: |
C:\Programmi\UpiPrinterServer\UpiPrinterServer.exe -install |
Verificare che il servizio "UpiPrinterServer" sia attivo: |
Selezionare la stampante dalla pagina Web: |
https://localhost:22000 |
e selezionando dalla pagina il link della stampante desiderata. |
Verificare se il servizio lavora utilizzando https://<SERVER>/test/test_UpiPrinterServer.html |
Per disinstallare il servizio: |
C:\Programmi\UpiPrinterServer\UpiPrinterServer.exe -remove |
Per verificare il servizio nel caso si blocchi durante l'utilizzo. |
Assicurarsi che il servizio "Upi Printer Server" sia fermo; lanciare da una console il comando: |
C:\Programmi\UpiPrinterServer\UpiPrinterServer.exe -debug |
e utilizzare il servizio. |
/masonsql_dojo1.6/utility/UpiPrinterServer/compile.bat |
---|
0,0 → 1,8 |
REM compila il file .pl in .exe |
REM NOTA: le DLL ssleay32.dll e libeay32.dll non si trovano in C:/WINDOWS/system32 copiarle da C:\Perl\site\lib\auto\Net\SSLeay\ |
perl -x -S pp -B -f Bleach -f Obfuscate --gui -p -l C:/WINDOWS/system32/ssleay32.dll -l C:/WINDOWS/system32/libeay32.dll -o %1.par %1.pl |
parl -B -O./%1.exe %1.par |
del %1.par |
/masonsql_dojo1.6/utility/UpiPrinterServer/certs/server-cert.pem |
---|
0,0 → 1,16 |
-----BEGIN CERTIFICATE----- |
MIIChjCCAe8CCQDL59rbpzVtpTANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEBhMC |
SVQxETAPBgNVBAgTCFRyZW50aW5vMRIwEAYDVQQKEwlMZWFkZXIuSVQxGTAXBgNV |
BAsTEFBvbG8gVGVjbm9sb2dpY28xFTATBgNVBAMTDGNhLmxlYWRlci5pdDEgMB4G |
CSqGSIb3DQEJARYRc3VwcG9ydEBsZWFkZXIuaXQwHhcNMDcwNTAyMDk1OTI2WhcN |
MDkwNTAxMDk1OTI2WjCBhTELMAkGA1UEBhMCSVQxETAPBgNVBAgTCFRyZW50aW5v |
MRIwEAYDVQQKEwlMZWFkZXIuSVQxGTAXBgNVBAsTEFBvbG8gVGVjbm9sb2dpY28x |
EjAQBgNVBAMTCWxvY2FsaG9zdDEgMB4GCSqGSIb3DQEJARYRc3VwcG9ydEBsZWFk |
ZXIuaXQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALAD3+y9vCaorWUtIfb+ |
UCAh5lLDGporU6WcN1xsEAfRxACM6YeKdLRqsulOGrIPRpqiGE87NNTe+20gTvRi |
WuBCAkDXf7QegnTPhJ+Jsg9XnjlGs+hAIRDQ7zY0C7KqQ0hMWoPpJ72viObk9XcR |
3uQS4fGMpiFAWc1UhfJtzXcnAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAfI51q/ZP |
UihpTTaIsOZY62x00OdqRN5YpTyHx1gkkte3kXq7A50Pm0b2qLcYSeR9smUVoH9p |
bKCqrqyUBbpAqkBAPJzTj2jg1K0ZUscMaeuZ/B3/SY0GmJfuwgyEhHnqXYOPMJyT |
y4DYA4/zT1F+IgZ1HOOzfqtAI6mCV/2mC24= |
-----END CERTIFICATE----- |
/masonsql_dojo1.6/utility/UpiPrinterServer/certs/server-key.pem |
---|
0,0 → 1,15 |
-----BEGIN RSA PRIVATE KEY----- |
MIICWwIBAAKBgQCwA9/svbwmqK1lLSH2/lAgIeZSwxqaK1OlnDdcbBAH0cQAjOmH |
inS0arLpThqyD0aaohhPOzTU3vttIE70YlrgQgJA13+0HoJ0z4SfibIPV545RrPo |
QCEQ0O82NAuyqkNITFqD6Se9r4jm5PV3Ed7kEuHxjKYhQFnNVIXybc13JwIDAQAB |
AoGAO8mFJVApeeQvyb8z20b1BoUdTB1zisyOxCE0+NLH+y/4aMt0g5K3I5Veojri |
fHsN23aV1UviHTCErMOdrgs+nH97r/0mH2R8X1T3BqF8Y0oi7rx6vF63FePm3Nlk |
hxSCREIwcOIFFFxTABMXbpozAS6J68tNETjC8gScAY08fCECQQDmlevxGWzYuQyG |
4sY+QGH3q3dv4AEf/D3Af9nNFDBnaC9LlHKLsc2rnZETPJVbuIYS2TfwY09sclbr |
9jBnE+oXAkEAw2o4wvSYaLzc72Zu7Qp3ymObhEOpMXgQxeI/hd/TNXFkmSycpZ+K |
OYoQcGdofraVXbYbDuq8UykVbFJeknLVcQJAIlCjWTD4ctQvGg+7gt4f9jStRJfo |
cvMd2XztU8iyX2Ew0KWZ2lIukmCTi3JTo9+1DC8JVRviYPgvGVR85YogJwJAE6D8 |
2KBnGsY1zxpT9B2EEOFWgr+lJCHyVV43kUP9XDXqq/QuO/i9krAKnK/WcDv43vPm |
3eW4SwYqb7oKY92DEQJAHCAHKwZ7KwPL40ZviRYJgcd8oqIm3VfLxYHiHLduzGZc |
EsQe+I9LObfAJjiiwYvonyVbro0koR9dmeJ6quTeOA== |
-----END RSA PRIVATE KEY----- |
/masonsql_dojo1.6/doc/MasonSQL_CRUD.txt |
---|
0,0 → 1,407 |
# ---------------------------------------------------------------------- # |
# Copyright:2002-2010 Leader.IT di Guido Brugnara <http://www.leader.it> |
# Strada della Pozzata, 41 - Villazzano |
# 38123 T R E N T O (ITALY) |
# Authors: Guido Brugnara <gdo@leader.it> |
# |
# $Revision: $ info@leader.it |
# ---------------------------------------------------------------------- # |
MasonSQL - interfaccia CRUD - versione 1.5 |
Nel documento viene descritta l'interfaccia per lo scambio dei dati per le classiche operazioni di Creazione(Create), Lettura(Retrieve), Aggiornamento(Update) e Cancellazione(Delete). |
L'interfaccia di comunicazione tra il client di accesso ed il server è disponibile esclusivamente con il protocollo standard HTTPS, con autenticazione basic. |
Per esigenze di compatibilità con le versioni precedenti di MasonSQL e per agevolare lo sviluppo dei client di accesso sono stati utilizzati esclusivamente i metodi di accesso GET e POST. |
Nella URI viene codificata la classe dell'oggetto che si vuole leggere, modificare, ecc. |
Esempi: |
https://adep.provincia.tn.it/dbms/campioni |
https://adep.provincia.tn.it/dbms/parametri |
https://adep.provincia.tn.it/dbms/formulari/siti |
Nella URL (Uniform Resource Locator) della chiamata viene codificato anche il metodo richiesto e la chiave univoca dell'oggetto richiesto. |
Esempi: |
https://adep.provincia.tn.it/dbms/campioni?method=update&key=12 |
https://adep.provincia.tn.it/dbms/parametri?key=888 |
https://adep.provincia.tn.it/dbms/parametri?method=select&key=23 |
https://adep.provincia.tn.it/dbms/campioni?method=delete&key=4 |
https://adep.provincia.tn.it/dbms/parametri?method=newkey |
https://adep.provincia.tn.it/dbms/parametri?method=insert&key=33 |
Ciascuna chiamata è di tipo atomico, o "stateless"; ovvero si conclude con una operazione completata con la risposta del server; non richiede successive interazioni. |
Unica eccezione, se così si può dire impropriamente, è data dal metodo "newkey" che ritorna una chiave utilizzabile per l'inserimento successivo di un nuovo oggetto. |
Se la chiave non viene poi utilizzata per inserire un nuovo oggetto, ciò non costituisce un problema. |
I dati degli oggetti (record delle tabelle) vengono scambiati nel formato XML con charset UTF-8. |
Per compatibilità con le versioni precedenti di MasonSQL lo schema utilizzato è il seguente: |
<?xml version="1.0" encoding="utf-8"?> |
<dbms method="retrieve" user="administrator" timestamp="28/04/2010 07:45:17.997114 CEST" start="0" rows="1" max_rows="1529"> |
<campioni id="..." ... /> |
</dbms> |
Il TAG <dbms ... > identifica il percorso iniziale della URI e racchiude il TAG il cui nome identifica la classe dell'oggetto (il nome della tabella è rappresentato nel formato "schema.tabella" con un punto come separatore ). |
Nel TAG <dbms ... > sono definiti alcuni attributi: |
method - metodo richiesto |
user - corrisponde all'utente che ha effettuato la richiesta |
timestamp - data di riferimento della transazione. |
Attributi presenti solo con method=retrieve: |
start - offset del primo record restituito |
rows - numero di record restituiti |
max_rows - numero dei record elaborati |
Nella URI il nome della tabella da "schema.tabella" viene codificato con "schema/tabella". |
In mancanza di indicazione dello schema si intende che la tabella è presente nello schema di "default" (Schema: "public"). |
ATTENZIONE: Nelle operazioni di modifica ed inserimento è obbligatorio utilizzare il TAG corrispondente all'oggetto identificato nella URI. |
I campi della tabella vengono rappresentati nello schema XML utilizzando parametri del TAG: |
Esempio: |
<?xml version="1.0" encoding="utf-8"?> |
<dbms method="retrieve" user="administrator" timestamp="28/04/2010 07:48:19.200846 CEST" start="0" rows="1" max_rows="1"> |
<campioni stato_rapporto="firmato" data_ingresso="01/01/2010" persona_prelievo="1135" |
persona_responsabile3="" id_laboratorio="12" data_inizio_prova="01/01/2010" |
persona_responsabile2="" stato="Completato" durata_prelievo="" id="1136" |
id_tipi_campioni="514" osservazioni="" persona_responsabile="41" id_sito="41" |
data_fine_prova="09/10/2000" codice="[314444/03]" ora_prelievo="11:40" |
data_prelievo="03/10/2000" id_rapporto="1114"/> |
</dbms> |
I parametri (campi della tabella) contenenti caratteri riservati e/o proibiti (Es: '<' '&' <CR> ) devono essere codificati (Es: '<' '&' '\n'). |
Gestione dei permessi |
L'interfaccia è accessibile con autenticazione basic (password protetta dal canale cifrato SSL del protocollo HTTPS). |
L'utente che accede eredita i diritti in base ai gruppi di appartenenza, così come gestiti nelle applicazioni. Se l'utente appartiene ad una ditta di gestione o ad un laboratorio avrà diritto di accedere agli oggetti inerenti, così come accade attraverso l'interfaccia nel browser. |
NOME CHIAVE |
Le classi di oggetti (le tabelle) utilizzano come chiave univoca un campo che non ha un nome univoco ma può cambiare in ciascuna tabella, anche se è comunque un parametro di progetto e quindi non cambia nel tempo. |
Il nome di "default" è "id", ma per esser certi è possibile reperire il nome della chiave univoca utilizzata nell'oggetto utilizzando il metodo "keyname": |
https://adep.provincia.tn.it/dbms/campioni?method=keyname |
Verrà restituito il seguente documento XML contenente il nome del campo chiave: |
Esempio: |
Codice: 200 OK |
Content-Type: text/xml; charset=utf-8 |
<?xml version="1.0" encoding="utf-8"?> |
<dbms method="keyname" user="admin" timestamp="28/04/2010 12:00:00" > |
<campioni keyname="id" /> |
</dbms> |
In caso di errore il server risponderà con errore (400) accompagnato da un documento contenente il messaggio dell'errore. |
INFO |
Con il metodo "info" viene restituito un documento XML contenenete una serie di informazioni utili sull'oggetto. |
https://adep.provincia.tn.it/dbms/campioni?method=info |
Verrà restituito il seguente documento XML: |
Esempio: |
Codice: 200 OK |
Content-Type: text/xml; charset=utf-8 |
<?xml version="1.0" encoding="utf-8"?> |
<dbms method="info" user="admin" timestamp="28/04/2010 12:00:00" > |
<campioni keyname="id" log="0" delete="1" print="1" insert="1" dbms="1" xls="1" |
printsel="1" update="1" select="1" father_name="" father_id_name="" father_key_name="" > |
<field size="4" name="id" type="integer" descr="" primary_key="1" notnull="1" /> |
<field size="4" name="id_sito" type="integer" descr="Sito prelievo" notnull="1" /> |
<field size="4" name="data_prelievo" type="date" descr="Data di prelievo" /> |
...... |
<field size="500" name="osservazioni" type="character" descr="Osservazioni" /> |
<child field="id" table="parametri" key="id_campione" /> |
<relation field="persona_responsabile" table="anagrafiche" /> |
<relation field="id_sito" table="siti" /> |
...... |
<relation field="cod_campioni" table="cod_campioni" key="codice" /> |
</campioni> |
</dbms> |
<field/> identifica le caratteristiche di un attributo |
<child/> identifica la relazione con un oggetto figlio (relazione n:1) |
<relation/> identifica la relazione con un diverso oggetto (relazione 1:n) |
Attenzione che <child/> e <relation/> compaiono se nella dichiarazione degli oggetti vengono descritte le rispettive relazioni (metodi ENTITY_CHILDREN e ENTITY_RELATIONS). |
NUMERO DEI RECORD PRESENTI |
Con il metodo "numrec" viene restituito un documento XML contenente la quantità di record presente in archivio che l'utente può recuperare. |
https://adep.provincia.tn.it/dbms/campioni?method=numrec |
Metodo della chiamata: GET |
Parametri: |
method => 'numrec' |
father_key => 'FFFF' - chiave univoca del "padre" (obbligatoria se l'oggetto ha un padre) |
Esempio: |
Codice: 200 OK |
Content-Type: text/xml; charset=utf-8 |
<dbms method="numrec" user="admin" timestamp="28/04/2010 12:00:00" > |
<campioni numrec="1780" /> |
</dbms> |
LETTURA |
La URL per effettuare una operazione di lettura di un oggetto è costruita nel modo seguente: |
https://adep.provincia.tn.it/dbms/parametri?method=retrieve&key=NNNN |
oppure |
https://adep.provincia.tn.it/dbms/parametri?method=retrieve&father_key=NNNN |
E' possibile inoltre ricercare più oggetti utilizzando la seguente forma |
https://adep.provincia.tn.it/dbms/parametri?method=retrieve&rows=10&where=campione like 'mycode%' |
Attenzione: Nell'esempio i caratteri come ad esempio lo spazio nella URL vanno convertiti (lo spazio viene convertito con %20). |
Per maggior chiarezza questi caratteri vengono mostrati nell'esempio senza conversione, anche perché alcuni browser ne permettono l'utilizzo in quanto effettuano la conversione prima della trasmissione al server. |
Metodo della chiamata: GET |
Parametri: |
method => 'retrieve' |
key => 'NNNN' - chiave univoca dell'oggetto da recuperare (generalmente è un numero naturale) |
father_key => 'FFFF' - chiave univoca del "padre" |
rows => 'RRR' - Numero di righe di record da ritornare |
(quando non si utilizza il parametro 'key', limitato a 65536) |
start => 'SSS' - Posizione da cui mostrare i dati (0 corrisponde alla prima riga) |
where => "codice='XXX'" - query di ricerca limitata agli operatori di confronto =, !=, <, >, <=, >=, like, *~ e l'operatore "and" |
Esempi: |
https://adep.provincia.tn.it/dbms/parametri?key=888 |
https://adep.provincia.tn.it/dbms/parametri?method=retrieve&key=23 |
https://adep.provincia.tn.it/dbms/parametri?method=retrieve&father_key=700 |
https://adep.provincia.tn.it/dbms/parametri?method=retrieve&father_key=700&where=cod_campioni='biogas' |
La risposta del server sarà un documento XML contenente il record richiesto (con parametro "key") o i record collegati all'oggetto "padre" oppure il risultato della query di ricerca. |
Esempio: |
Codice: 200 OK |
Content-Type: text/xml; charset=utf-8 |
<?xml version="1.0" encoding="utf-8"?> |
<dbms method="retrieve" user="admin" timestamp="28/04/2010 12:00:00" start="0" rows="2" max_rows="1801"> |
<parametri parametro="Quantità media liquami (ingresso o uscita)" risultato="22" id_campione="11111" ord="0" |
id_metodo="321" um="mc/h" cod_parametri="qmedia" incertezza="" tipo="D" metodo="(Portata)" |
parametro_metodo="" id="234555" sinal="0" valore="20" /> |
<parametri parametro="Coeffic. Ripart. Portata vasca fanghi in aereazione" risultato="0.17" id_campione="11111" ord="1" |
id_metodo="333" um="." cod_parametri="coeffripportatav" incertezza="" tipo="D" metodo="CoeffRipPortata" |
parametro_metodo="" id="24324" sinal="0" valore="0.5" /> |
</dbms> |
In caso di errore il server risponderà con errore (400) accompagnato da un documento contenente il messaggio dell'errore. |
La chiave del padre è obbligatoria se è dichiarato il padre. |
Per accedere ad un intero set di record di grande dimensione, maggiore del limite imposto a rows di 65536 record utilizzare il parametro start. |
Per recuperare gli ultimi record del recordset, utilizzare il metodo "numrec" per conoscere il numero di record presenti e poi eseguire un metodo retrieve con start = numrec - rows. |
NUOVA CHIAVE |
E' possibile inserire un nuovo oggetto sia fornendo la chiave univoca oppure non fornendo la chiave univoca. |
Nel primo caso è possibile reperire una chiave univoca utilizzabile effettuando una chiamata (GET) con URI la classe dell'oggetto (la tabella) e con metodo newkey: |
https://adep.provincia.tn.it/dbms/campioni?method=newkey |
Verrà restituito il seguente documento XML contenente il codice univoco utilizzabile per inserire un nuovo documento: |
Esempio: |
Codice: 200 OK |
Content-Type: text/xml; charset=utf-8 |
<?xml version="1.0" encoding="utf-8"?> |
<dbms method="newkey" user="admin" timestamp="28/04/2010 12:00:00" > |
<campioni key="1136" keyname="id" /> |
</dbms> |
In caso di errore il server risponderà con errore (400) accompagnato da un documento contenente il messaggio dell'errore. |
CREAZIONE |
La URL per effettuare l'operazione di inserimento di un nuovo oggetto è costruita nel modo seguente: |
https://adep.provincia.tn.it/dbms/campioni?method=create&key=NNNN&father_key=FFFF |
Metodo della chiamata: POST |
Parametri: |
method => 'create' |
key => 'NNNN' chiave univoca del nuovo oggetto (parametro opzionale) |
father_key => 'FFFF' chiave univoca dell'oggetto "padre" (parametro opzionale) |
Esempi: |
https://adep.provincia.tn.it/dbms/campioni?method=create&key=1136 |
https://adep.provincia.tn.it/dbms/parametri?method=create&key=1137&father_key=12 |
https://adep.provincia.tn.it/dbms/parametri?method=create&father_key=120 |
<dbms method="create" user="admin" timestamp="28/04/2010 12:00:00" > |
<campioni stato_rapporto="firmato" persona_prelievo="134" |
id_tipi_campioni="491" osservazioni="" persona_responsabile="241" id_sito="101" /> |
</dbms> |
Nel caso non venga fornita la chiave univoca il server inserirà un nuovo record attribuendo una chiave univoca reperibile nel documento contenente il record creato. |
I campi non forniti resteranno vuoti oppure inizializzati con i valori di "default" se previsti. |
ATTENZIONE: Si sconsiglia di effettuare creazioni senza la chiave univoca in quanto in caso di problemi nella comunicazione c'è il rischio di inserire più record uguali, oppure di non conoscere la chiave del record appena inserito. |
La risposta del server sarà un documento XML contenente il record generato |
Esempio: |
Codice: 200 OK |
Content-Type: text/xml; charset=utf-8 |
<?xml version="1.0" encoding="utf-8"?> |
<dbms method="create" user="admin" timestamp="28/04/2010 12:00:00" > |
<campioni stato_rapporto="firmato" ... id="1136" /> |
</dbms> |
In caso di errore il server risponderà con errore (400) accompagnato da un documento contenente il messaggio dell'errore. |
MODIFICA |
La URL per effettuare una operazione di lettura di un oggetto è costruita nel modo seguente: |
https://adep.provincia.tn.it/dbms/parametri?method=update&key=NNNN |
Metodo della chiamata: POST |
Parametri: |
method => 'update' |
key => 'NNNN' chiave univoca dell'oggetto da recuperare (generalmente è un numero naturale) |
Esempio: |
https://adep.provincia.tn.it/dbms/campioni?method=update&key=123 |
<?xml version="1.0" encoding="utf-8"?> |
<dbms method="update" user="admin" timestamp="28/04/2010 12:00:00" > |
<campioni stato_rapporto="firmato" ... id="123" /> |
</dbms> |
I campi non forniti non verranno modificati. |
La risposta del server sarà un documento XML contenente il record modificato |
Esempio: |
Codice: 200 OK |
Content-Type: text/xml; charset=utf-8 |
<?xml version="1.0" encoding="utf-8"?> |
<dbms method="update" user="admin" timestamp="28/04/2010 12:00:00" > |
<campioni data_ingresso="02/03/2010" codice="AX400/2" id="123" |
osservazioni="Commento\nsu\npiù\nrighe" /> |
</dbms> |
In caso di errore il server risponderà con errore (400) accompagnato da un documento contenente il messaggio dell'errore. |
CANCELLAZIONE |
La URL per effettuare una operazione di cancellazione di un oggetto è costruita nel modo seguente: |
https://adep.provincia.tn.it/dbms/parametri?method=delete&key=NNNN |
Metodo della chiamata: GET |
Parametri: |
method => 'delete' |
key => 'NNNN' chiave univoca dell'oggetto da recuperare (generalmente è un numero naturale) |
Esempio: |
https://adep.provincia.tn.it/dbms/parametri?method=delete&key=23 |
<?xml version="1.0" encoding="utf-8"?> |
<dbms method="delete" user="admin" timestamp="28/04/2010 12:00:00" > |
<parametri id="23" /> |
</dbms> |
La risposta del server sarà OK (200) con invio di un documento XML contenente i record cancellati, oppure errore (400) accompagnato da un documento contenente il messaggio dell'errore. |
Nel caso si faccia riferimento a record inesistenti o non accessibili dall'utente autenticato essi non verranno riportati nel documento XML di risposta. |
PERMESSI DI ACCESSO |
L'accesso ai metodi e lle cassli degli oggetti/tabelle è controllato dall'autorizzazione "Dbms" per tutti i metodi e dalle autorizzazioni "Select", "Update", "Insert" e "Delete" per gli omonimi metodi. |
Tramite il metodo "info" è possibile verificare le autorizzazioni concesse sugli oggetti/tabelle. |
MESSAGGI DI ERRORE |
In caso di errore nella richiesta, violazione dei diritti o nella risposta del database il messaggio di errore viene inviato al client con errore "400 Bad Request" ed un documento XML contenente l'errore e, se abilitato il livello di debug, anche lo stack-trace dell'errore nel codice: |
<error user="administrator" timestamp="28/04/2010 13:10:22.434 CEST" > |
<message>No access to record or record not exists</message> |
<debug row="1"> |
Stack: [/opt/masonsql/htdocs/lib/my_library.comp:300], [/usr/local/share/perl ...n.comp:1112]\n |
</debug> |
</error> |
Di seguito alcuni messaggi di errore, tra i più significativi: |
No Dbms permission | L'utente non ha diritto di accesso alla funzionalità |
No insert permission | L'utente non ha diritto di inserire nuovi oggetti |
No delete permission | L'utente non ha diritto di cancellare oggetti |
No update permission | L'utente non ha diritto di modificare oggetti |
No father retrieve permission | L'utente non ha diritto di leggere il padre |
No related 'OOO' retrieve permission | L'utente non ha diritto di leggere l'oggetto collegato 'OOO' |
No father record retrieve | L'utente non ha diritto di leggere lo specifico oggetto padre |
No related 'OOO' record retrieve | L'utente non ha diritto di leggere lo specifico oggetto collegato 'OOO' |
No key param | Manca nella richiesta il parametro 'key' |
No multiple key in param key | E' stato fornito un elenco di chiavi nella richiesta |
No record retrieve or record not exists | L'oggetto fornito non esiste o non si hanno sufficienti diritti di accesso all'oggetto |
Delete record return N rows | La cancellazione dell'oggetto ha restituito un numero di oggetti diverso da uno |
No father_id param with father 'FATHER' | Manca il parametro father_id relativo all'oggetto PADRE |
No father_id == -1 | La chiave di valore "-1" è riservata dal framework e se utilizzata genera errore |
No key == -1 | La chiave di valore "-1" è riservata dal framework e se utilizzata genera errore |
Defined father_id param without father definition | Fornito il parametro father_id nella chiamata di un oggetto senza padre |
Key already used | In inserimento, la chiave fornita è già utilizzata (non è detto che l'utente abbia comunque accesso a quell'oggetto) |
Key greater last key | In inserimento, la chiave fornita è maggiore dell'ultima chiave generata |
No content | Chiamata POST senza contenuto |
Malformed xml content: no <dbms> tag | Il documento trasmesso non contiene il blocco XML: <dbms ... >....</dbms> |
Errori segnalati relativi al campo 'where', utilizzabile con il metodo 'retrieve': |
Utilizzo della parola riservata '***' non autorizzata |
Utilizzo dell'operatore '$value' non autorizzato |
Utilizzo del campo '***' non autorizzato |
Utilizzo della funzione '***' non autorizzata |
Errore di sintassi: termine '***' sconosciuto |
Errore di sintassi: manca un delimitatore di stringa |
Errore di sintassi: mancante/i N parentesi di chiusura |
Errore di sintassi: parentesi di chiusura senza la corrispondente parentesi di apertura |
___ |
TEST & DEBUG |
Per valutare il comportamento dell'interfaccia è possibile utilizzare la pagina html: |
https://adep.provincia.tn.it/test/test_crud.html |
E' possibile indicare lo schema, tabella, chiave ed il documento XML (per "update" e "insert") su cui eseguire le operazioni di: info, numrec, newkey, update, insert e delete. Viene restituito il record di risposta nel riquadro sottostante. |
Nota: Il documento è stato creato utilizzando il charset UTF-8. |
-------------------------------------------------------------------------------- |
/masonsql_dojo1.6/lib/Auth_AC/AuthCookieHandler.pm |
---|
0,0 → 1,180 |
################################################################ |
package Auth_AC::AuthCookieHandler; |
use strict; |
use DBI; |
use vars qw($VERSION @ISA); |
$VERSION = substr(q$Revision: 1.2 $, 10); |
@ISA = ( $mod_perl::VERSION >= 2 ) ? qw(Apache2::AuthCookie) : qw(Apache::AuthCookie); |
use Digest::MD5 qw(md5_hex); |
#DEBUG print STDERR "DEBUG: Auth_AC::AuthCookieHandler->BEGIN\n"; |
my $secret = "Frase . . . per la cifratura segreta :-)"; |
sub connect { |
my $self = shift; |
my $r = shift; |
my $conn = $r->dir_config('DBIconnect'); |
my $user; |
my $passwd; |
if($conn =~ s/user=(\w+)//i){ |
$user=$1; |
} |
if($conn =~ s/passw\w+=(\w+)//i){ |
$passwd=$1; |
} |
#DEBUG print STDERR "Auth_AC::AuthCookieHandler->connect($conn, $user, $passwd)\n"; |
my $dbh = DBI->connect($conn, $user, $passwd) |
|| die "DBI Error open database: ".DBI::errstr; |
$dbh->{HandleError} = sub { |
# Qui si puo' modificare i messaggi di errore oppure catturare gli errori e |
# quindi annullarli. |
return 0; |
}; |
$dbh->{pg_enable_utf8} = 1; |
$dbh->{RaiseError} = 1; |
$dbh->{ShowErrorStatement}=1; |
# necessario per i database e client >=7.3 e successivi in quanto si utilizzano "prepare" di query multiple |
$dbh->{'pg_server_prepare'} = 0; |
$dbh->do(q| |
set DateStyle to 'SQL, EUROPEAN'; |
set TIME ZONE LOCAL; |
set client_encoding TO 'UTF-8'; |
SET search_path TO public; |
|); |
$dbh->{AutoCommit} = 0; |
return $dbh; |
} |
sub authen_cred { |
my $self = shift; |
my $r = shift; |
# i parametri in AuthCookieLoginForm credential[_0, _1, _2] |
my ($login, $md5_phrase, $force_login) = @_; |
# md5_phrase = MD5(MD5(passwd).MD5(<date yyyymmgg>).MD5(<IP_client>)) |
#DEBUG print STDERR "authen_cred LOGIN:$login, PHRASE:$md5_phrase FORCE:$force_login\n"; |
#DEBUG use Data::Dumper; print STDERR "AuthCookieHandler.pm", Dumper(\%ENV); |
# cerco l'utente nel database |
no strict; |
my $dbh = $self->connect($r); |
$dbh->{AutoCommit} = 1; |
use strict; |
my $SQL="select password,session from anagrafiche where login=?"; |
#DEBUG print STDERR "LOGIN SQL:$SQL LOGIN:$login\n"; |
my $sth = $dbh->prepare($SQL); |
$sth->execute($login); |
if($sth eq '0E0' || $sth->rows != 1){ |
#DEBUG print STDERR "AUTHENTICATION rows=".$sth->rows." KEY=UNDEFINED\n"; |
return undef; |
} |
my($md5_password, $old_session) = @{$sth->fetchrow_arrayref}; |
#DEBUG print STDERR "AUTHENTICATION database password='$md5_password' old_session='$old_session'\n"; |
# verifico l'eventuale session presente |
if($old_session){ |
my($sess, $IP, $minutes) = split /\s+/, $old_session; |
# verifico da quanto tempo la sessione non era utilizzata |
my $inactivity_minutes = int(time/60) - $minutes; |
# se devo forzare la login oppure la sessione è inattivo da più di Auth_InactivityMax secondi |
if($force_login || $inactivity_minutes > $r->dir_config('Auth_InactivityMax')){ |
# annullo la session |
$sth = $dbh->prepare('update anagrafiche set session = null where login = ?'); |
$sth->execute($login); |
$dbh->{AutoCommit} || $dbh->commit; |
$old_session = undef; |
#DEBUG print STDERR "LOGIN: DELETE OLD SESSION (force_login=$force_login; $inactivity_minutes >= ".$r->dir_config('Auth_InactivityMax').")\n"; |
}else{ |
#DEBUG print STDERR "AUTHENTICATION INACTIVE:${inactivity_minutes}min MAX:".$r->dir_config('Auth_InactivityMax')."min KEY:undef FORCE:$force_login\n"; |
return undef; |
} |
} |
# in Apache2 inizializza le variabili ambiente $ENV{xxxx} |
( $mod_perl::VERSION >= 2 ) && $r->subprocess_env; |
# si determina una hash per l'operazione di login che avrà validità di 10 minuti in quanto dipende da time/60/10 |
my $md5_base = md5_hex($ENV{REMOTE_ADDR}.(int(time/60/10))); |
#DEBUG print STDERR "REMOTE_ADDR=$ENV{REMOTE_ADDR} local md5_base='$md5_base' md5_password = '$md5_password'\n"; |
# calcolo il dato di confronto inviato dal Client |
my $md5_phrase_local = md5_hex($md5_password.':'.$md5_base); |
#DEBUG print STDERR "AUTHENTICATION 'local $md5_phrase_local' == '$md5_phrase' browser\n"; |
if($md5_phrase_local ne $md5_phrase){ |
#DEBUG print STDERR "AUTHENTICATION2 KEY=UNDEFINED\n"; |
return undef; |
} |
my $NewSess_id = md5_hex(rand().$md5_phrase_local).' '.$ENV{REMOTE_ADDR}; |
$SQL = 'update anagrafiche set previus_session_time = session_time, session_time = now(), session = ? where login = ?'; |
#DEBUG print STDERR "NewSess_id='$NewSess_id'\n"; |
$sth = $dbh->prepare($SQL); |
my $NumRec = $sth->execute($NewSess_id.' '.int(time/60), $login); |
$dbh->{AutoCommit} || $dbh->commit; |
if($NumRec eq '0E0'){ |
#DEBUG print STDERR "AUTHENTICATION3 KEY=UNDEFINED\n"; |
return undef; |
} |
my $session_key = $login.':'.$NewSess_id.':'.md5_hex( $NewSess_id, $secret ); |
#DEBUG print STDERR "AUTHENTICATION KEY=$session_key\n"; |
# svuoto la cache dei recordset dell'utente corrente |
$sth = $dbh->prepare(q{ |
delete from public.recordset_rows |
using anagrafiche, recordset |
where id_recordset = recordset.id |
and recordset.id_anagrafiche = anagrafiche.id |
and anagrafiche.login = ?; |
delete from public.recordset |
using anagrafiche |
where id_anagrafiche = anagrafiche.id |
and anagrafiche.login = ? |
}); |
$sth->execute($login, $login); |
$dbh->{AutoCommit} || $dbh->commit; |
return $session_key; |
} |
sub authen_ses_key { |
my $self = shift; |
my $r = shift; |
my $session_key = shift; |
my ($login, $Sess_id, $mac) = split /:/, $session_key, 3; |
no strict; |
my $dbh = $self->connect($r); |
$dbh->{AutoCommit} = 1; |
use strict; |
my $sth = $dbh->prepare('select session from anagrafiche where login = ?'); |
#DEBUG print STDERR "LOGIN test LOGIN:$login SESS_ID:$Sess_id MAC:$mac\n"; |
if($sth->execute($login)){ |
my $row = $sth->fetchrow_arrayref; |
if($row){ |
my($sess, $IP, $minutes) = split /\s+/, $row->[0]; |
if ( md5_hex( $Sess_id, $secret ) eq $mac && $Sess_id eq $sess.' '.$IP) { |
# verifico da quanto tempo la sessione non era utilizzata |
my $inactivity_minutes = int(time/60) - $minutes; |
# se inattivo da più di Auth_InactivityMax minuti |
if($inactivity_minutes > $r->dir_config('Auth_InactivityMax')){ |
# annullo la session |
$sth = $dbh->prepare('update anagrafiche set session = null where login = ?'); |
$sth->execute($login); |
$dbh->{AutoCommit} || $dbh->commit; |
#DEBUG print STDERR "INACTIVITY IS TOO LONG $inactivity_minutes > ".$r->dir_config('Auth_InactivityMax')."\n"; |
return undef; |
} |
# ogni minuto aggiorno la session nel DB |
if($inactivity_minutes > 0){ |
#DEBUG print STDERR "UPDATE activity\n"; |
$sth = $dbh->prepare('update anagrafiche set session = ? where login = ?'); |
$sth->execute($sess.' '.$IP.' '.int(time/60), $login); |
$dbh->{AutoCommit} || $dbh->commit; |
} |
#DEBUG print STDERR "VERIFICA OK: $session_key inactivity: $inactivity_minutes < ".$r->dir_config('Auth_InactivityMax')." SESS:$session_key\n"; |
return $session_key |
} |
} |
} |
#DEBUG print STDERR "VERIFICA NO: $session_key\n"; |
return undef; |
} |
return 1; |
/masonsql_dojo1.6/lib/Auth_AC/AuthBasicHandler.pm |
---|
0,0 → 1,53 |
package Auth_AC::AuthBasicHandler; |
use Apache2::Access (); |
use Apache2::RequestUtil (); |
use Apache2::Const -compile => qw(OK DECLINED HTTP_UNAUTHORIZED); |
use Digest::MD5 qw(md5_hex); |
sub handler { |
my $r = shift; |
my ($status, $password) = $r->get_basic_auth_pw; |
return $status unless $status == Apache2::Const::OK; |
if(!$password || !$r->user){ |
$r->note_basic_auth_failure; |
return Apache2::Const::HTTP_UNAUTHORIZED; |
} |
my $conn = $r->dir_config('DBIconnect'); |
my $user; |
my $passwd; |
if($conn =~ s/user=(\w+)//i){ |
$user=$1; |
} |
if($conn =~ s/passw\w+=(\w+)//i){ |
$passwd=$1; |
} |
#DEBUG print STDERR "Auth_AC::AuthBasicHandler->connect($conn, $user, $passwd)\n"; |
my $dbh = DBI->connect($conn, $user, $passwd) || die "DBI Error open database: ".DBI::errstr; |
$dbh->{pg_enable_utf8} = 1; |
$dbh->{RaiseError} = 1; |
$dbh->{ShowErrorStatement}=1; |
$dbh->do(q|set client_encoding TO 'UTF-8';|); |
$dbh->{AutoCommit} = 1; |
# cerco l'utente nel database |
my $SQL="select password,session from public.anagrafiche where login=?"; |
#DEBUG print STDERR "LOGIN SQL '$SQL' '$login'\n"; |
my $sth = $dbh->prepare($SQL); |
$sth->execute($r->user); |
if($sth eq '0E0' || $sth->rows != 1){ |
#DEBUG print STDERR "AUTHENTICATION rows=".$sth->rows." KEY=UNDEFINED\n"; |
$r->note_basic_auth_failure; |
return Apache2::Const::HTTP_UNAUTHORIZED; |
} |
my($md5_password, $old_session) = @{$sth->fetchrow_arrayref}; |
# verifico la password |
if(md5_hex($password) eq $md5_password){ |
return Apache2::Const::OK; |
} |
$r->note_basic_auth_failure; |
return Apache2::Const::HTTP_UNAUTHORIZED; |
} |
1; |
/masonsql_dojo1.6/lib/MasonSQL/Escapes.pm |
---|
0,0 → 1,39 |
package MasonSQL::Escapes; |
# funzione di 'escaping' per linguaggio Javascript |
sub js_escape { |
$_=$_[0]; |
$$_=~s/\\/\\\\/sg; |
$$_=~s/"/\\"/sg; |
$$_=~s/\'/\\\'/sg; |
$$_=~s/\n/\\n/sg; |
$$_=~s/\t/\\t/sg; |
$$_=~s/<\/script>/<\\\/script>/sg; |
} |
# funzione di 'escaping' per linguaggio XML |
sub xml_escape { |
$_=$_[0]; |
$$_=~s/&/&/sg; |
$$_=~s/</</sg; |
$$_=~s/>/>/sg; |
$$_=~s/"/"/sg; #" |
$$_=~s/\t/\\t/sg; |
$$_=~s/\n/\\n/sg; |
} |
# funzione di 'escaping' per incapsulare codice (HTML e XML in un campo textarea |
sub textarea_escape { |
$_=$_[0]; |
$$_=~s/&/&/sg; |
$$_=~s/</</sg; |
$$_=~s/>/>/sg; |
} |
# funzione di 'escaping' per incapsulare codice multiriga |
sub multi_escape { |
$_=$_[0]; |
$$_=~s/\n/<br>/sg; |
} |
1; |
/masonsql_dojo1.6/lib/MasonSQL/ApacheHandler.pm |
---|
0,0 → 1,21 |
# Handler per la gestione customizzata degli errori di mason |
package MasonSQL::ApacheHandler; |
use strict; |
use HTML::Mason::ApacheHandler; |
# preparo |
sub handler { |
my $r = shift; |
my $return = eval { HTML::Mason::ApacheHandler->handler($r) }; |
if(my $error = $@){ |
# l'oggetto $error viene poi utilizzato in /lib/error.comp |
$r->pnotes( error => $error ); |
$r->filename( $r->document_root . '/lib/error.comp'); |
return HTML::Mason::ApacheHandler->handler($r); |
} |
return $return; |
} |
1; |
/masonsql_dojo1.6/lib/MasonSQL/CompRootHandler.pm |
---|
0,0 → 1,31 |
# utilizzato in Apache 1.3 |
# |
package MasonSQL::CompRootHandler; |
use strict; |
use Apache::Constants qw(:common); |
use Apache::File; |
use DirHandle (); |
sub handler { |
my $r = shift; |
# verifico se il file è presente nei percorsi definiti nell'ordine |
my @MasonCompRoot = $r->dir_config->get('MasonCompRoot'); |
foreach my $root (@MasonCompRoot){ |
my($name, $dir) = split /\s*=>\s*/, $root, 2; |
(defined $name) or die "Configurazione inaspettatata di MasonCompRoot '$root'\n"; |
if(-e $dir.$r->uri){ |
# se esiste il file nel percorso lo seleziono per il download |
$r->filename($dir.$r->uri); |
last; |
} |
} |
my $fh = Apache::File->new($r->filename) or return FORBIDDEN; |
$r->send_fd($fh); |
close $fh; |
return OK; |
} |
1; |
__END__ |
/masonsql_dojo1.6/lib/MasonSQL/CompRootHandler2.pm |
---|
0,0 → 1,34 |
# Usato in pache 2.0 e 2.2 |
# |
package MasonSQL::CompRootHandler2; |
use strict; |
### Per Apache2spostati nel file di configurazione di Apache |
#use Apache::Constants qw(:common); |
#use Apache::File; |
#use DirHandle (); |
### Per Apache2 |
use Apache2::Const qw(FORBIDDEN OK); |
sub handler { |
my $r = shift; |
# verifico se il file è presente nei percorsi definiti nell'ordine |
my @MasonCompRoot = $r->dir_config->get('MasonCompRoot'); |
foreach my $root (@MasonCompRoot){ |
my($name, $dir) = split /\s*=>\s*/, $root, 2; |
(defined $name) or die "Configurazione inaspettatata di MasonCompRoot '$root'\n"; |
if(-e $dir.$r->uri){ |
# se esiste il file nel percorso lo seleziono per il download |
$r->filename($dir.$r->uri); |
$r->sendfile($dir.$r->uri); |
return OK; |
} |
} |
return FORBIDDEN; |
} |
1; |
__END__ |
/masonsql_dojo1.6/lib/MasonSQL/JSONRPCUtils.pm |
---|
0,0 → 1,35 |
package MasonSQL::JSONRPCUtils; |
use strict; |
#use JSON; |
use JSON -support_by_pp; |
sub json_rpc_response{ |
my $content = shift || return; |
my $json_response = {'version' => '1.1', |
'result' => $content |
}; |
# return JSON::objToJson($json_response, {skipinvalid => 1, convblessed => 1}); |
return JSON::objToJson($json_response, {allow_unknown => 1, allow_blessed => 1, convert_blessed => 1}); |
} |
sub json_rpc_error_response{ |
my $content = shift || return; |
my $message = shift || return; |
my $code = shift || 500; |
my $json_response = {'version' => 1.1, |
'error' => {'name' => 'JSONRPCError', |
'code' => $code, |
'message' => $message, |
'error' => $content |
} |
}; |
# return JSON::objToJson($json_response, {skipinvalid => 1, convblessed => 1}); |
return JSON::objToJson($json_response, {allow_unknown => 1, allow_blessed => 1, convert_blessed => 1}); |
} |
1; |
/masonsql_dojo1.6/lib/MasonSQL/JSLogger.pm |
---|
0,0 → 1,232 |
package MasonSQL::JSLogger; |
use Data::Dumper; |
use strict; |
use warnings; |
use vars qw(%LEVELS %VAL2LEVEL); |
no strict qw(refs); |
use constant ALL_INT => 0; |
use constant DEBUG_INT => 10000; |
use constant INFO_INT => 20000; |
use constant WARN_INT => 30000; |
use constant ERROR_INT => 40000; |
use constant FATAL_INT => 50000; |
use constant OFF_INT => (2 ** 31) - 1; |
sub new{ |
my $class = shift; |
my $current_level = shift; |
$current_level = OFF_INT unless defined $current_level; |
my $self = {'level' => $current_level, 'log_sub' => \&_log_level, 'code' => {}, 'to_dump' => ['init', 'log'], 'join_separator' => ''}; |
bless $self, $class; |
return $self; |
} |
sub to_dump{ |
my $self = shift; |
my $to_dump = shift; |
unless (defined $to_dump){ |
return $self->{'to_dump'}; |
}else{ |
$self->{'to_dump'} = $to_dump; |
} |
} |
sub join_separator{ |
my $self = shift; |
my $separator = shift; |
unless (defined $separator){ |
return $self->{'join_separator'}; |
}else{ |
$self->{'join_separator'} = $separator; |
} |
} |
sub log_sub{ |
my $self = shift; |
my $log_sub = shift; |
if (defined $log_sub){ |
$self->{'log_sub'} = $log_sub; |
}else{ |
return $self->{'log_sub'}; |
} |
} |
sub add_level{ |
my $level = shift || return; |
my $value = shift; |
return unless defined $value; |
return if defined $LEVELS{$level} or defined $VAL2LEVEL{$value}; |
$level = uc $level; |
$LEVELS{$level} = $value; |
$VAL2LEVEL{$value} = $level; |
*{__PACKAGE__ . "::$level"} = $value; |
_create_log_level_methods($level); |
} |
sub delete_level{ |
my $level = shift; |
return unless defined $level; |
return unless is_valid($level); |
return if is_predefined($level); |
$level = lc (($level =~ m/^[0-9]+$/o) ? $VAL2LEVEL{$level} : $level); |
my $uLevel = uc $level; |
delete $VAL2LEVEL{$LEVELS{$uLevel}}; |
delete $LEVELS{$uLevel}; |
delete ${__PACKAGE__ . "::"}{"$uLevel"}; |
delete ${__PACKAGE__ . "::"}{"$level"}; |
delete ${__PACKAGE__ . "::"}{"is_$level"}; |
} |
add_level('DEBUG', DEBUG_INT); |
add_level('ALL', ALL_INT); |
add_level('INFO', INFO_INT); |
add_level('WARN', WARN_INT); |
add_level('ERROR', ERROR_INT); |
add_level('FATAL', FATAL_INT); |
add_level('OFF', OFF_INT); |
sub _create_log_level_methods{ |
my $level = shift || return; |
my $uLevel = uc $level; |
$level = lc $level; |
*{__PACKAGE__ . "::$level"} = sub { |
my $self = shift; |
$self->{'log_sub'}->($self, $level, @_) if defined $LEVELS{uc $level}; |
}; |
*{__PACKAGE__ . "::is_$level"} = sub { |
$_[0]->_is_level($uLevel) if defined $LEVELS{$uLevel}; |
}; |
} |
sub is_predefined{ |
my $level = shift; |
return unless defined $level; |
return unless is_valid($level); |
$level = ($level =~ m/^[0-9]+$/o) ? $VAL2LEVEL{$level} : uc $level; |
return $level =~ m/^ALL|DEBUG|INFO|WARN|ERROR|FATAL|OFF$/o; |
} |
sub is_valid{ |
my $level = shift; |
return unless defined $level; |
$level = uc $level; |
if ($level =~ m/[A-Z]+/o){ |
return defined $LEVELS{$level}; |
}else{ |
return defined $VAL2LEVEL{$level}; |
} |
} |
sub set_code{ |
my $self = shift; |
my $codes = shift || return; |
for my $code (keys %$codes){ |
unless ($codes->{$code}){ |
delete $self->{'code'}{lc $code} if defined $self->{'code'}{lc $code}; |
}else{ |
$self->{'code'}{lc $code} = $codes->{$code}; |
} |
} |
} |
sub init_code{ |
my $self = shift; |
my $types = shift || return; |
my $toSubstitute = shift || return; |
my $uSubs = ""; |
my $sRegex; |
for my $subs (keys %{$toSubstitute}){ |
$uSubs = uc $subs; |
$sRegex = qr/#$uSubs#/; |
for my $type (@$types){ |
$type = lc $type; |
if (defined $self->{'code'}{$type}){ |
$self->{'code'}{$type} =~ s/$sRegex/$toSubstitute->{$subs}/g; |
} |
} |
} |
} |
sub dump_code{ |
my $self = shift; |
my $types = shift || return; |
my $toSubstitute = shift || return; |
my $code = ""; |
my $uSubs = ""; |
for my $type (@$types){ |
$type = lc $type; |
$code .= $self->{'code'}{$type} || ""; |
} |
return "" if $code eq ''; |
for my $subs (keys %{$toSubstitute}){ |
$uSubs = uc $subs; |
$code =~ s/#$uSubs#/$toSubstitute->{$subs}/g; |
} |
return $code; |
} |
sub _log_level{ |
my $self = shift; |
my $level = shift || return; |
if (&{__PACKAGE__ . "::is_$level"}($self)){ |
my $msgarr = [map { (ref $_ eq "CODE") ? $_->() : $_ } @_]; |
my $msg = join($self->{'join_separator'}, @$msgarr); |
$msg =~ s/</</go; |
$self->dump_code($self->{'to_dump'}, {'level' => $level, 'msg' => $msg}); |
} |
} |
sub _is_level{ |
my $self = shift; |
my $level = shift || return; |
return $self->{'level'} <= $LEVELS{$level}; |
} |
sub level{ |
my $class = shift; |
my $level = shift; |
if (defined $level){ |
$class->{'level'} = ($level =~ m/^[0-9]+$/o) ? $level : $LEVELS{uc $level} if is_valid($level); |
}else{ |
return $class->{'level'}; |
} |
} |
1; |
/masonsql_dojo1.6/lib/MasonX/Plugin/UTF8.pm |
---|
0,0 → 1,16 |
package MasonX::Plugin::UTF8; |
use base qw(HTML::Mason::Plugin); |
use warnings; |
use strict; |
sub start_request_hook { |
my ( $self, $context ) = @_; |
my $args_ref = $context->args(); |
foreach my $arg ( @{$args_ref} ) { |
utf8::is_utf8($arg) || utf8::decode($arg); |
} |
return; |
} |
1; |
/masonsql_dojo1.6/report/printreptopdf.sh |
---|
0,0 → 1,34 |
#!/bin/bash |
#Enable this setting if you have problems starting the application |
#for example in suse 7.3 starting from a vncserver |
#export CLX_USE_LIBQT=true |
#Enable this setting if you have not defined the LANG variable in your system |
#export LANG=en_US |
export LANG=it_IT.ISO-8859-15@euro |
export LC_CTYPE="" |
export PGCLIENTENCODING=LATIN9 |
#Bug fix in some distros need LC_NUMERIC en_US or print will not work |
#That is to enable a bugfix, use it only if print does not work |
#export LC_NUMERIC=en_US |
#Use this env.variables to override language locale |
export KYLIX_DEFINEDENVLOCALES=Yes |
export KYLIX_THOUSAND_SEPARATOR=. |
export KYLIX_DECIMAL_SEPARATOR=, |
export KYLIX_DATE_SEPARATOR=/ |
export KYLIX_TIME_SEPARATOR=: |
#You can share libraries copying libs to a directory |
#for example /opt/kylixlibs and add the path to ld.so.conf |
#then run ldconfig (as root) |
DIR=${0%/*} |
export HOME=$DIR |
export USER=www-data |
# versione 2_9a |
export LD_LIBRARY_PATH=$DIR:$LD_LIBRARY_PATH |
exec $DIR/rpservercline-2_9a/printreptopdf $* |
# versione 2_7e |
#export LD_LIBRARY_PATH=$DIR/rpservercline-2_7e:$LD_LIBRARY_PATH |
#exec $DIR/rpservercline-2_7e/printreptopdf $* |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/masonsql_dojo1.6/report/LEGGIMI |
---|
0,0 → 1,22 |
"Report Manager Designer Version 2_9a" |
Author: Toni Martir |
toni@pala.com (no free support) |
http://reportman.sourceforge.net |
INSTALLAZIONE: |
* Copiare i file della distribuzione ( rpservercline-2_9a.i386.tar.gz ) in /opt/masonsql/report/rpservercline-2_9a: |
* Modificare lo script /opt/masonsql/report/printreptopdf.sh adattando il comando che punta all'eseguibile in /opt/masonsql/report/rpservercline-2_9a/printreptopdf |
* Creare il link per eseguire da utente root i comandi di test: /root/.borland => /opt/masonsql/report/.borland |
* L'applicazione crea il link /opt/masonsql/report/.borland -> /opt/APPLICAZIONE/etc/******.borland (vedi file di conf.) alla prima connessione |
In PostgreSQL lanciare il comando: |
CREATE DOMAIN BLOB as bytea |
per la gestione delle immagini. |