diff --git a/ETS-WS/ETS-WS/Web.config b/ETS-WS/ETS-WS/Web.config index f50e92d..099307d 100644 --- a/ETS-WS/ETS-WS/Web.config +++ b/ETS-WS/ETS-WS/Web.config @@ -21,7 +21,7 @@ - + diff --git a/ETS-WS/ETS-WS/WebShipUtils.cs b/ETS-WS/ETS-WS/WebShipUtils.cs index d778207..493de33 100644 --- a/ETS-WS/ETS-WS/WebShipUtils.cs +++ b/ETS-WS/ETS-WS/WebShipUtils.cs @@ -235,6 +235,22 @@ namespace ETS_WS return answ; } /// + /// redattore da idx DB + /// + /// + /// + public static string redattoreFromIdxFile(int idxFile) + { + string answ = ""; + try + { + answ = utils.obj.taDoc.getByIdxFile(idxFile)[0].Redattore; + } + catch + { } + return answ; + } + /// /// fornisce email dato codice fornitore /// /// @@ -456,6 +472,50 @@ namespace ETS_WS { utils.obj.taTMD.deleteQuery(userId, setName); } + /// + /// determina se l'utente possa vedere records taggati Red + /// + public bool userCanSeeRed + { + get + { + return (userIsUserRed || userIsPowerUserRed); + } + } + /// + /// determina se l'utente sia poweruser + /// + public bool userIsPowerUser + { + get + { + bool answ = utils.obj.userHasRight(utils.obj.currUserAD, utils.obj.confReadString("CodModulo"), "PowerUser"); + return answ; + } + } + /// + /// determina se l'utente sia poweruser + /// + public bool userIsUserRed + { + get + { + bool answ = utils.obj.userHasRight(utils.obj.currUserAD, utils.obj.confReadString("CodModulo"), "UserRed"); + return answ; + } + } + /// + /// determina se l'utente sia poweruser Red + /// + public bool userIsPowerUserRed + { + get + { + bool answ = utils.obj.userHasRight(utils.obj.currUserAD, utils.obj.confReadString("CodModulo"), "PowerUserRed"); + return answ; + } + } + } /// diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx b/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx index 052d211..4bbabf0 100644 --- a/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx +++ b/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx @@ -35,7 +35,7 @@ - + diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx.cs b/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx.cs index 3a1c91e..25b4098 100644 --- a/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx.cs +++ b/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx.cs @@ -315,6 +315,47 @@ namespace ETS_WS.WebUserControls } } } + /// + /// calcola la visibilità del button di edit dati + /// - utente corrente (e quindi suoi diritti red/non red) + /// - ruoli utente (user/poweruser) x cui può editare solo i suoi o tutti + /// + /// + /// + public bool showEditButton(object _idxFile) + { + bool answ = false; + int idxFile = 0; + try + { + idxFile = Convert.ToInt32(_idxFile); + } + catch + { } + if (idxFile > 0) + { + // controllo condizioni: in primis è lui che ha creato record + if (WebShipUtils.redattoreFromIdxFile(idxFile)==utils.obj.currUserNomeCognome) + { + answ = true; + } + else + { + // se non è lui controllo se sia record Red + if (WebShipUtils.isRedFromIdxFile(idxFile)) // è record Red + { + // controllo se sia powerUserRed + answ = WebShipUtils.mng.userIsPowerUserRed; + } + else // non è record Red + { + // controllo se sia powerUser + answ = WebShipUtils.mng.userIsPowerUser; + } + } + } + return answ; + } } } \ No newline at end of file diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_filtroRicerca.ascx b/ETS-WS/ETS-WS/WebUserControls/mod_filtroRicerca.ascx index c7c72fd..58ecf22 100644 --- a/ETS-WS/ETS-WS/WebUserControls/mod_filtroRicerca.ascx +++ b/ETS-WS/ETS-WS/WebUserControls/mod_filtroRicerca.ascx @@ -40,23 +40,20 @@
-
+

- +
-
+

- +
-
+

- +
-
+

@@ -64,15 +61,22 @@
-
+

-
-
- - +
+ +
+
+
+ +
+
+ + +
diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_filtroRicerca.ascx.cs b/ETS-WS/ETS-WS/WebUserControls/mod_filtroRicerca.ascx.cs index 75e3b83..4ee0547 100644 --- a/ETS-WS/ETS-WS/WebUserControls/mod_filtroRicerca.ascx.cs +++ b/ETS-WS/ETS-WS/WebUserControls/mod_filtroRicerca.ascx.cs @@ -176,7 +176,7 @@ namespace ETS_WS.WebUserControls if (chkCommessa.Checked) { tacCommesse.contextKey = string.Format("{0}#{1}", utils.obj.StringSessionObj("_inizio"), utils.obj.StringSessionObj("_fine")); - chkCommessa.Text = "Elimina Filtro Commessa"; + chkCommessa.Text = "Elim. Comm."; tacCommesse.setFocus(); } else @@ -196,12 +196,12 @@ namespace ETS_WS.WebUserControls if (chkFase.Checked) { tacFasi.contextKey = string.Format("{0}#{1}", utils.obj.StringSessionObj("_inizio"), utils.obj.StringSessionObj("_fine")); - chkFase.Text = "Elimina Filtro Fasi"; + chkFase.Text = "Elim. Fase"; tacFasi.setFocus(); } else { - chkFase.Text = "Filtra per Fase"; + chkFase.Text = "Filtra Fase"; } tacFasi.Visible = chkFase.Checked; updateVisual(); @@ -216,12 +216,12 @@ namespace ETS_WS.WebUserControls if (chkFonte.Checked) { tacFonti.contextKey = string.Format("{0}#{1}", utils.obj.StringSessionObj("_inizio"), utils.obj.StringSessionObj("_fine")); - chkFonte.Text = "Elimina Filtro Fonte"; + chkFonte.Text = "Elim. Fonte"; tacFonti.setFocus(); } else { - chkFonte.Text = "Filtra per Fonte"; + chkFonte.Text = "Filtra Fonte"; } tacFonti.Visible = chkFonte.Checked; updateVisual(); @@ -235,7 +235,7 @@ namespace ETS_WS.WebUserControls { if (chkInOut.Checked) { - chkInOut.Text = "Elimina Filtro In/Out"; + chkInOut.Text = "Elim. In/Out"; } else { @@ -265,6 +265,23 @@ namespace ETS_WS.WebUserControls updateVisual(); } /// + /// imposto visibilità x dati red/non red + /// + /// + /// + protected void chkRed_CheckedChanged(object sender, EventArgs e) + { + if (chkRed.Checked) + { + chkRed.Text = "Public+Red"; + } + else + { + chkRed.Text = "Public"; + } + updateVisual(); + } + /// /// selezionata nuova dim pagina /// /// @@ -348,6 +365,5 @@ namespace ETS_WS.WebUserControls eh_reqSearch(this, new EventArgs()); } } - } } \ No newline at end of file diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_filtroRicerca.ascx.designer.cs b/ETS-WS/ETS-WS/WebUserControls/mod_filtroRicerca.ascx.designer.cs index c39bc06..2e24a6d 100644 --- a/ETS-WS/ETS-WS/WebUserControls/mod_filtroRicerca.ascx.designer.cs +++ b/ETS-WS/ETS-WS/WebUserControls/mod_filtroRicerca.ascx.designer.cs @@ -147,6 +147,15 @@ namespace ETS_WS.WebUserControls { /// protected global::ETS_WS.WebUserControls.mod_textAutocomplete tacRedattore; + /// + /// chkRed control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkRed; + /// /// lblCerca control. /// diff --git a/ETS-WS/ETS-WS/bin/ETS-WS.dll b/ETS-WS/ETS-WS/bin/ETS-WS.dll index 14623df..46dcd76 100644 Binary files a/ETS-WS/ETS-WS/bin/ETS-WS.dll and b/ETS-WS/ETS-WS/bin/ETS-WS.dll differ diff --git a/ETS-WS/ETS-WS/bin/ETS_Data.dll b/ETS-WS/ETS-WS/bin/ETS_Data.dll index 65acb69..1fdc346 100644 Binary files a/ETS-WS/ETS-WS/bin/ETS_Data.dll and b/ETS-WS/ETS-WS/bin/ETS_Data.dll differ diff --git a/ETS_Data/DS_Anagrafica.Designer.cs b/ETS_Data/DS_Anagrafica.Designer.cs index 97e448f..a8389aa 100644 --- a/ETS_Data/DS_Anagrafica.Designer.cs +++ b/ETS_Data/DS_Anagrafica.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.17626 +// Runtime Version:4.0.30319.17929 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -2835,11 +2835,19 @@ SELECT UtenteAD, codModulo, codFunzione, valore FROM Diritti WHERE (UtenteAD = @ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitCommandCollection() { - this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1]; + this._commandCollection = new global::System.Data.SqlClient.SqlCommand[2]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; this._commandCollection[0].CommandText = "SELECT UtenteAD, codModulo, codFunzione, valore FROM dbo.Diritti"; this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand(); + this._commandCollection[1].Connection = this.Connection; + this._commandCollection[1].CommandText = "dbo.stp_Dir_getByUserModFun"; + this._commandCollection[1].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UtenteAD", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@codModulo", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@codFunzione", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -2866,6 +2874,35 @@ SELECT UtenteAD, codModulo, codFunzione, valore FROM Diritti WHERE (UtenteAD = @ return dataTable; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)] + public virtual DS_Anagrafica.DirittiDataTable getByUserModFun(string UtenteAD, string codModulo, string codFunzione) { + this.Adapter.SelectCommand = this.CommandCollection[1]; + if ((UtenteAD == null)) { + this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value; + } + else { + this.Adapter.SelectCommand.Parameters[1].Value = ((string)(UtenteAD)); + } + if ((codModulo == null)) { + this.Adapter.SelectCommand.Parameters[2].Value = global::System.DBNull.Value; + } + else { + this.Adapter.SelectCommand.Parameters[2].Value = ((string)(codModulo)); + } + if ((codFunzione == null)) { + this.Adapter.SelectCommand.Parameters[3].Value = global::System.DBNull.Value; + } + else { + this.Adapter.SelectCommand.Parameters[3].Value = ((string)(codFunzione)); + } + DS_Anagrafica.DirittiDataTable dataTable = new DS_Anagrafica.DirittiDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] diff --git a/ETS_Data/DS_Anagrafica.xsd b/ETS_Data/DS_Anagrafica.xsd index 8873fd7..c724118 100644 --- a/ETS_Data/DS_Anagrafica.xsd +++ b/ETS_Data/DS_Anagrafica.xsd @@ -155,7 +155,21 @@ SELECT UtenteAD, codModulo, codFunzione, valore FROM Diritti WHERE (UtenteAD = @ - + + + + + dbo.stp_Dir_getByUserModFun + + + + + + + + + + @@ -265,7 +279,7 @@ SELECT COD_MODULO, DESCRIZIONE FROM Moduli WHERE (COD_MODULO = @COD_MODULO) - + @@ -313,7 +327,7 @@ SELECT COD_MODULO, DESCRIZIONE FROM Moduli WHERE (COD_MODULO = @COD_MODULO) - + @@ -347,7 +361,7 @@ SELECT COD_MODULO, DESCRIZIONE FROM Moduli WHERE (COD_MODULO = @COD_MODULO) - + @@ -367,7 +381,7 @@ SELECT COD_MODULO, DESCRIZIONE FROM Moduli WHERE (COD_MODULO = @COD_MODULO) - + @@ -410,9 +424,9 @@ SELECT COD_MODULO, DESCRIZIONE FROM Moduli WHERE (COD_MODULO = @COD_MODULO) - - - + + + \ No newline at end of file diff --git a/ETS_Data/DS_Anagrafica.xss b/ETS_Data/DS_Anagrafica.xss index 53f92c6..42714d9 100644 --- a/ETS_Data/DS_Anagrafica.xss +++ b/ETS_Data/DS_Anagrafica.xss @@ -7,12 +7,12 @@ - - - + + + - + 417 @@ -24,7 +24,7 @@ - + 708 @@ -32,19 +32,23 @@ 708 - 346 + 365 - + - 930 - 254 + 950 + 324 - 811 - 254 + 950 + 341 + + + 842 + 341 diff --git a/ETS_Data/utils.cs b/ETS_Data/utils.cs index d3e3d56..1f919d8 100644 --- a/ETS_Data/utils.cs +++ b/ETS_Data/utils.cs @@ -12,6 +12,7 @@ namespace ETS_Data #region area table adapters public DS_AnagraficaTableAdapters.UtentiTableAdapter taUtenti; + public DS_AnagraficaTableAdapters.DirittiTableAdapter taDiritti; public DS_utilsTableAdapters.v_selFontiTableAdapter taSelFonti; public DS_utilsTableAdapters.v_selCommesseTableAdapter taSelCommesse; @@ -37,6 +38,7 @@ namespace ETS_Data protected void initTA() { taUtenti = new DS_AnagraficaTableAdapters.UtentiTableAdapter(); + taDiritti = new DS_AnagraficaTableAdapters.DirittiTableAdapter(); taSelFonti = new DS_utilsTableAdapters.v_selFontiTableAdapter(); taSelCommesse = new DS_utilsTableAdapters.v_selCommesseTableAdapter(); taSelFasi = new DS_utilsTableAdapters.v_selFasiTableAdapter(); @@ -62,6 +64,7 @@ namespace ETS_Data string connStringETS_WAnagrafica = (string)configAppSetReader.GetValue("ETS_AnagraficaConnectionString", typeof(string)); // connections del db taUtenti.Connection.ConnectionString = connStringETS_WAnagrafica; + taDiritti.Connection.ConnectionString = connStringETS_WAnagrafica; taSelFonti.Connection.ConnectionString = connStringETS_WS; taSelCommesse.Connection.ConnectionString = connStringETS_WS; @@ -231,6 +234,24 @@ namespace ETS_Data return currUserAD; } } + /// + /// calcola se l'utente abbia il diritto x la funzione indicata + /// + /// username formato AD + /// codice modulo + /// codice funzione + /// + public bool userHasRight(string utenteAD, string codModulo, string codFunzione) + { + bool answ = false; + try + { + answ = taDiritti.getByUserModFun(utenteAD, codModulo, codFunzione).Rows.Count > 0; + } + catch + { } + return answ; + } #endregion