]> saetta.ns0.it Git - solipa/territorio/commitdiff
Aumentati i controlli sulle autorizzazioni.
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Thu, 29 Dec 2011 07:42:28 +0000 (08:42 +0100)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Thu, 29 Dec 2011 07:42:28 +0000 (08:42 +0100)
.project
src/aggregazioniterritoriali.c
src/comuni.c
src/main.c
src/province.c
src/regioni.c
src/stati.c
src/tipiaggregazioneterritoriale.c
src/vie.c

index f295a15490efadc15cf648bbbff58ebd59f61329..39e8a2fe395d229962f8fc2e093b44083be04f26 100644 (file)
--- a/.project
+++ b/.project
@@ -70,7 +70,7 @@
        </natures>
        <filteredResources>
                <filter>
-                       <id>1307524070148</id>
+                       <id>1325143905026</id>
                        <name></name>
                        <type>30</type>
                        <matcher>
@@ -79,7 +79,7 @@
                        </matcher>
                </filter>
                <filter>
-                       <id>1307524070162</id>
+                       <id>1325143905031</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
@@ -88,7 +88,7 @@
                        </matcher>
                </filter>
                <filter>
-                       <id>1307524070176</id>
+                       <id>1325143905035</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
@@ -97,7 +97,7 @@
                        </matcher>
                </filter>
                <filter>
-                       <id>1307524070191</id>
+                       <id>1325143905040</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1307524070205</id>
+                       <id>1325143905045</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1307524070222</id>
+                       <id>1325143905049</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1307524070237</id>
+                       <id>1325143905053</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                                <arguments>1.0-name-matches-false-false-*.lo</arguments>
                        </matcher>
                </filter>
+               <filter>
+                       <id>1325143905057</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-config.h.in*</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905061</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-config.log</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905065</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-config.sub</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905069</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-depcomp</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905074</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-install-sh</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905078</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-ltmain.sh</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905082</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-missing</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905087</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-config.guess</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905091</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-aclocal.m4</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905095</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-config.status</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905100</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-libterritorio.pc</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905129</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-libtool</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905133</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-stamp-h1</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905159</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-configure</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905181</id>
+                       <name></name>
+                       <type>30</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-*.anjuta</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1325143905204</id>
+                       <name></name>
+                       <type>22</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-config.h</arguments>
+                       </matcher>
+               </filter>
        </filteredResources>
 </projectDescription>
index 5bc5ab7801bc50419c9742d8318065ee017d35bd..d0cba5d18d84330ef17a8748f26d3e2b4bdd42af 100644 (file)
@@ -352,11 +352,23 @@ static void
 territorio_aggregazioni_territoriali_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)
 {
+       AutozIResource *ires1;
+
        GtkWidget *w;
 
        TerritorioAggregazioniTerritoriali *territorio_aggregazioni_territoriali = (TerritorioAggregazioniTerritoriali *)user_data;
        TerritorioAggregazioniTerritorialiPrivate *priv = TERRITORIO_AGGREGAZIONI_TERRITORIALI_GET_PRIVATE (territorio_aggregazioni_territoriali);
 
+       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+               {
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Non si è autorizzati a craere nuove aggregazioni territoriali.");
+                       return;
+               }
+
        TerritorioAggregazioneTerritoriale *c = territorio_aggregazione_territoriale_new (priv->commons, 0);
 
        g_signal_connect (G_OBJECT (c), "aggiornato",
@@ -378,6 +390,8 @@ static void
 territorio_aggregazioni_territoriali_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
+       AutozIResource *ires1;
+
        GtkWidget *dialog;
        gboolean risp;
 
@@ -389,6 +403,16 @@ territorio_aggregazioni_territoriali_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
+                       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+                       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+                               {
+                                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                              GTK_MESSAGE_WARNING,
+                                                              GTK_BUTTONS_OK,
+                                                              "Non si è autorizzati a eliminare le aggregazioni territoriali.");
+                                       return;
+                               }
+
                        dialog = gtk_message_dialog_new (priv->wtransient,
                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                                         GTK_MESSAGE_QUESTION,
index 4160127fda553ba36a03a84ec493b4eb73c368ef..6ab286be0b4e5f16a5e1cb13da86c1dcc9e31762 100644 (file)
@@ -499,11 +499,23 @@ static void
 territorio_comuni_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)
 {
+       AutozIResource *ires1;
+
        GtkWidget *w;
 
        TerritorioComuni *territorio_comuni = (TerritorioComuni *)user_data;
        TerritorioComuniPrivate *priv = TERRITORIO_COMUNI_GET_PRIVATE (territorio_comuni);
 
+       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+               {
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Non si è autorizzati a creare nuovi comuni.");
+                       return;
+               }
+
        TerritorioComune *c = territorio_comune_new (priv->commons, 0);
 
        g_signal_connect (G_OBJECT (c), "aggiornato",
@@ -536,6 +548,16 @@ territorio_comuni_on_btn_elimina_clicked (GtkButton *button,
        TerritorioComuni *territorio_comuni = (TerritorioComuni *)user_data;
        TerritorioComuniPrivate *priv = TERRITORIO_COMUNI_GET_PRIVATE (territorio_comuni);
 
+       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+               {
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Non si è autorizzati a eliminare i comuni.");
+                       return;
+               }
+
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_comuni), &iter,
index 47f61619659e037647576476ad828015808a8a8e..d1fd984c1dbc86c0b12152a13995413f4e5d41fc 100644 (file)
@@ -229,6 +229,14 @@ main (int argc, char *argv[])
 
        gint i;
 
+#ifdef G_OS_WIN32
+       if (g_getenv ("TZ") == NULL)
+               {
+                       /* per un problema delle glib che fanno riferimento a TZ e sotto win non c'è */
+                       g_setenv ("TZ", "+01:00", TRUE);
+               }
+#endif
+
        gtk_init (&argc, &argv);
 
        gda_init ();
@@ -315,7 +323,7 @@ main (int argc, char *argv[])
                        g_warning ("Impossibile creare l'oggetto per libautoz.");
                        return 0;
                }
-       if (!autoz_load_from_db (commons->autoz, gdacon, NULL, TRUE))
+       if (!autoz_load_from_db_with_monitor (commons->autoz, gdacon, NULL, TRUE))
                {
                        g_warning ("Impossibile caricare la configurazione per libautoz dal db.");
                        return 0;
index 2323523610a739d05136701bae7bb00d6e39842a..9717d3943fe1bfa5fe086312be88d2d8756baad0 100644 (file)
@@ -492,11 +492,23 @@ static void
 territorio_province_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)
 {
+       AutozIResource *ires1;
+
        GtkWidget *w;
 
        TerritorioProvince *territorio_province = (TerritorioProvince *)user_data;
        TerritorioProvincePrivate *priv = TERRITORIO_PROVINCE_GET_PRIVATE (territorio_province);
 
+       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+               {
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Non si è autorizzati a creare nuove province.");
+                       return;
+               }
+
        TerritorioProvincia *c = territorio_provincia_new (priv->commons, 0);
 
        g_signal_connect (G_OBJECT (c), "aggiornato",
@@ -518,6 +530,8 @@ static void
 territorio_province_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
+       AutozIResource *ires1;
+
        GtkWidget *dialog;
        gboolean risp;
 
@@ -529,6 +543,16 @@ territorio_province_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
+                       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+                       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+                               {
+                                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                              GTK_MESSAGE_WARNING,
+                                                              GTK_BUTTONS_OK,
+                                                              "Non si è autorizzati a eliminare le province.");
+                                       return;
+                               }
+
                        dialog = gtk_message_dialog_new (priv->wtransient,
                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                                         GTK_MESSAGE_QUESTION,
index 2c488cc15cbef186c584b97517287a492609f664..381923260e52bac73112b3b63c56ebd73d279cc3 100644 (file)
@@ -328,7 +328,6 @@ static void
 territorio_regioni_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        TerritorioRegioni *territorio_regioni = TERRITORIO_REGIONI (object);
-
        TerritorioRegioniPrivate *priv = TERRITORIO_REGIONI_GET_PRIVATE (territorio_regioni);
 
        switch (property_id)
@@ -343,7 +342,6 @@ static void
 territorio_regioni_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        TerritorioRegioni *territorio_regioni = TERRITORIO_REGIONI (object);
-
        TerritorioRegioniPrivate *priv = TERRITORIO_REGIONI_GET_PRIVATE (territorio_regioni);
 
        switch (property_id)
@@ -378,11 +376,23 @@ static void
 territorio_regioni_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)
 {
+       AutozIResource *ires1;
+
        GtkWidget *w;
 
        TerritorioRegioni *territorio_regioni = (TerritorioRegioni *)user_data;
        TerritorioRegioniPrivate *priv = TERRITORIO_REGIONI_GET_PRIVATE (territorio_regioni);
 
+       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+               {
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Non si è autorizzati a creare nuove regioni.");
+                       return;
+               }
+
        TerritorioRegione *c = territorio_regione_new (priv->commons, 0);
 
        g_signal_connect (G_OBJECT (c), "aggiornato",
@@ -404,6 +414,8 @@ static void
 territorio_regioni_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
+       AutozIResource *ires1;
+
        GtkWidget *dialog;
        gboolean risp;
 
@@ -415,6 +427,16 @@ territorio_regioni_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
+                       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+                       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+                               {
+                                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                              GTK_MESSAGE_WARNING,
+                                                              GTK_BUTTONS_OK,
+                                                              "Non si è autorizzati a eliminare le regioni.");
+                                       return;
+                               }
+
                        dialog = gtk_message_dialog_new (priv->wtransient,
                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                                         GTK_MESSAGE_QUESTION,
index 9ce4caa6056c121de9972dbb765f32e5b6b77785..b9a61fcafd63c1940a9528ed337909d8bddf1c96 100644 (file)
@@ -328,7 +328,6 @@ static void
 territorio_stati_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        TerritorioStati *territorio_stati = TERRITORIO_STATI (object);
-
        TerritorioStatiPrivate *priv = TERRITORIO_STATI_GET_PRIVATE (territorio_stati);
 
        switch (property_id)
@@ -343,7 +342,6 @@ static void
 territorio_stati_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        TerritorioStati *territorio_stati = TERRITORIO_STATI (object);
-
        TerritorioStatiPrivate *priv = TERRITORIO_STATI_GET_PRIVATE (territorio_stati);
 
        switch (property_id)
@@ -378,11 +376,23 @@ static void
 territorio_stati_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)
 {
+       AutozIResource *ires1;
+
        GtkWidget *w;
 
        TerritorioStati *territorio_stati = (TerritorioStati *)user_data;
        TerritorioStatiPrivate *priv = TERRITORIO_STATI_GET_PRIVATE (territorio_stati);
 
+       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+               {
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Non si è autorizzati a creare nuovi stati.");
+                       return;
+               }
+
        TerritorioStato *c = territorio_stato_new (priv->commons, 0);
 
        g_signal_connect (G_OBJECT (c), "aggiornato",
@@ -404,6 +414,8 @@ static void
 territorio_stati_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
+       AutozIResource *ires1;
+
        GtkWidget *dialog;
        gboolean risp;
 
@@ -415,6 +427,16 @@ territorio_stati_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
+                       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+                       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+                               {
+                                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                              GTK_MESSAGE_WARNING,
+                                                              GTK_BUTTONS_OK,
+                                                              "Non si è autorizzati a eliminare gli stati.");
+                                       return;
+                               }
+
                        dialog = gtk_message_dialog_new (priv->wtransient,
                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                                         GTK_MESSAGE_QUESTION,
index a1fb4533abe192d79331a7c02982b92b2eb99f8f..600fc0f90ab074da242d27eb9e3686185b386ac7 100644 (file)
@@ -1,5 +1,5 @@
 /* 
- * Copyright (C) 2010 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2010-2011 Andrea Zagli <azagli@libero.it>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -319,7 +319,6 @@ static void
 territorio_tipi_aggregazione_territoriale_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        TerritorioTipiAggregazioneTerritoriale *territorio_tipi_aggregazione_territoriale = TERRITORIO_TIPI_AGGREGAZIONE_TERRITORIALE (object);
-
        TerritorioTipiAggregazioneTerritorialePrivate *priv = TERRITORIO_TIPI_AGGREGAZIONE_TERRITORIALE_GET_PRIVATE (territorio_tipi_aggregazione_territoriale);
 
        switch (property_id)
@@ -334,7 +333,6 @@ static void
 territorio_tipi_aggregazione_territoriale_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        TerritorioTipiAggregazioneTerritoriale *territorio_tipi_aggregazione_territoriale = TERRITORIO_TIPI_AGGREGAZIONE_TERRITORIALE (object);
-
        TerritorioTipiAggregazioneTerritorialePrivate *priv = TERRITORIO_TIPI_AGGREGAZIONE_TERRITORIALE_GET_PRIVATE (territorio_tipi_aggregazione_territoriale);
 
        switch (property_id)
@@ -350,11 +348,23 @@ static void
 territorio_tipi_aggregazione_territoriale_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)
 {
+       AutozIResource *ires1;
+
        GtkWidget *w;
 
        TerritorioTipiAggregazioneTerritoriale *territorio_tipi_aggregazione_territoriale = (TerritorioTipiAggregazioneTerritoriale *)user_data;
        TerritorioTipiAggregazioneTerritorialePrivate *priv = TERRITORIO_TIPI_AGGREGAZIONE_TERRITORIALE_GET_PRIVATE (territorio_tipi_aggregazione_territoriale);
 
+       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+               {
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Non si è autorizzati a creare nuovi tipi di aggregazioni territoriali.");
+                       return;
+               }
+
        TerritorioTipoAggregazioneTerritoriale *c = territorio_tipo_aggregazione_territoriale_new (priv->commons, 0);
 
        g_signal_connect (G_OBJECT (c), "aggiornato",
@@ -376,6 +386,8 @@ static void
 territorio_tipi_aggregazione_territoriale_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
+       AutozIResource *ires1;
+
        GtkWidget *dialog;
        gboolean risp;
 
@@ -387,6 +399,16 @@ territorio_tipi_aggregazione_territoriale_on_btn_elimina_clicked (GtkButton *but
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
+                       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+                       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+                               {
+                                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                              GTK_MESSAGE_WARNING,
+                                                              GTK_BUTTONS_OK,
+                                                              "Non si è autorizzati a eliminare i tipi aggregazione territoriale.");
+                                       return;
+                               }
+
                        dialog = gtk_message_dialog_new (priv->wtransient,
                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                                         GTK_MESSAGE_QUESTION,
index e504b818eb09ca5ba72909262b15892931274d85..7bad6e09fa8eb43b789de9a9bac04beba8606c6c 100644 (file)
--- a/src/vie.c
+++ b/src/vie.c
@@ -519,11 +519,23 @@ static void
 territorio_vie_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)
 {
+       AutozIResource *ires1;
+
        GtkWidget *w;
 
        TerritorioVie *territorio_vie = (TerritorioVie *)user_data;
        TerritorioViePrivate *priv = TERRITORIO_VIE_GET_PRIVATE (territorio_vie);
 
+       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+               {
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Non si è autorizzati a creare nuove vie.");
+                       return;
+               }
+
        TerritorioVia *c = territorio_via_new (priv->commons, 0);
 
        g_signal_connect (G_OBJECT (c), "aggiornato",
@@ -557,6 +569,16 @@ territorio_vie_on_btn_elimina_clicked (GtkButton *button,
        TerritorioVie *territorio_vie = (TerritorioVie *)user_data;
        TerritorioViePrivate *priv = TERRITORIO_VIE_GET_PRIVATE (territorio_vie);
 
+       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "territorio_rw");
+       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+               {
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Non si è autorizzati a eliminare le vie.");
+                       return;
+               }
+
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_vie), &iter,