Merge branch 'release/fixUserStdLog'
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
_adminEmail samuele@steamware.net,info@steamware.net samuele@steamware.net,info@steamware.net info@steamware.net
|
||||
_allowForceUser true true abilita login forzato
|
||||
_commonPages menu menu pagina comune
|
||||
_emailPwd drmfsls16 drmfsls16 drmfsls16
|
||||
_emailUser steamwarebot@gmail.com steamwarebot@gmail.com steamwarebot@gmail.com
|
||||
_emailPwd siamoInViaNazionale93 siamoInViaNazionale93 siamoInViaNazionale93
|
||||
_emailUser steamwarebot@outlook.it steamwarebot@outlook.it steamwarebot@outlook.it
|
||||
_smtpCli smtp-mail.outlook.com smtp-mail.outlook.com smtp-mail.outlook.com
|
||||
_fromEmail steamwarebot@outlook.it steamwarebot@outlook.it steamwarebot@outlook.it
|
||||
_enableSSL true true true
|
||||
_fromEmail webmaster@admodelling.org webmaster@admodelling.org email mittente eventuali msg
|
||||
_righeDataGrid 30 30 Num righe datagrid std
|
||||
|
||||
+1467
-1419
File diff suppressed because it is too large
Load Diff
+314
-298
@@ -1,3 +1,4 @@
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -183,7 +184,8 @@ namespace SteamWare
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// � un boolean che indica se in session ci siano user/dominio e quindi utente autenticato in precedenza...
|
||||
/// � un boolean che indica se in session ci siano user/dominio e quindi utente autenticato
|
||||
/// in precedenza...
|
||||
/// </summary>
|
||||
public bool isAuth
|
||||
{
|
||||
@@ -222,7 +224,7 @@ namespace SteamWare
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore recupero lingua utente{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
Log.Info(string.Format("Errore recupero lingua utente{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
if (string.IsNullOrEmpty(answ))
|
||||
{
|
||||
@@ -314,7 +316,7 @@ namespace SteamWare
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(String.Format("Errore recupero permessi!{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
Log.Info(String.Format("Errore recupero permessi!{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return tabPermessi;
|
||||
}
|
||||
@@ -434,281 +436,6 @@ namespace SteamWare
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// controllo utente/pwd da tab
|
||||
/// </summary>
|
||||
/// <param name="_username"></param>
|
||||
/// <param name="_pwd"></param>
|
||||
/// <returns></returns>
|
||||
private bool checkUserPwd(string _username, string _pwd)
|
||||
{
|
||||
bool risultato = false;
|
||||
try
|
||||
{
|
||||
risultato = DataWrap.DW.taUserData.getByUserPwd(_username, _pwd).Rows.Count > 0;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return risultato;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// cancella da session l'utente
|
||||
/// </summary>
|
||||
protected void clearAllUserData()
|
||||
{
|
||||
memLayer.ML.emptySessionVal("USER_NAME");
|
||||
memLayer.ML.emptySessionVal("DOMINIO");
|
||||
memLayer.ML.emptySessionVal("permessiUtente");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// formatta un nodo in modo corretto dai dati indicati
|
||||
/// </summary>
|
||||
/// <param name="titolo"></param>
|
||||
/// <param name="descrizione"></param>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="tipoNodo"></param>
|
||||
protected string formattaNodo(string titolo, string descrizione, string url, siteNodeType tipoNodo)
|
||||
{
|
||||
string _out = "";
|
||||
switch (tipoNodo)
|
||||
{
|
||||
case siteNodeType.startContainer:
|
||||
_out = string.Format("<menu title=\"{0}\" description=\"{1}\" url=\"~/{2}\">", Traduci(titolo), Traduci(descrizione), url);
|
||||
break;
|
||||
|
||||
case siteNodeType.endContainer:
|
||||
_out = "</menu>";
|
||||
break;
|
||||
|
||||
case siteNodeType.leaf:
|
||||
_out = string.Format("<voce title=\"{0}\" description=\"{1}\" url=\"~/{2}\" />", Traduci(titolo), Traduci(descrizione), url);
|
||||
break;
|
||||
}
|
||||
return _out;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// salva dati accessori quali il cdc dell'utente...
|
||||
/// </summary>
|
||||
protected virtual void salvaDatiAccessori()
|
||||
{
|
||||
// salvo il cdc utente...
|
||||
memLayer.ML.setSessionVal("CdCUser", rigaUtente.COD_CDC);
|
||||
// verifico se necessario fare echo lemmi e vado in runMode di echo dei termini tradotti
|
||||
bool echoLemmi = false;
|
||||
try
|
||||
{
|
||||
echoLemmi = memLayer.ML.CRB("echoLemmi");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (echoLemmi)
|
||||
{
|
||||
currRunMode = runModes.echoLemmi;
|
||||
}
|
||||
else
|
||||
{
|
||||
currRunMode = runModes.normal;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua setup dei permessi una volta salvati i diritti
|
||||
/// </summary>
|
||||
protected virtual void setPermessiDaDiritti()
|
||||
{
|
||||
// proseguo coi permessi
|
||||
DataLayer_AnagGen.PermessiDataTable allPermessi = DataWrap.DW.taPermessi.GetData();
|
||||
DataLayer_AnagGen.Permessi2FunzioneDataTable allPerm2Funz = DataWrap.DW.taPermessi2Funzione.GetData();
|
||||
DataLayer_AnagGen.PermessiDataTable _permessiUtente = new DataLayer_AnagGen.PermessiDataTable();
|
||||
DataLayer_AnagGen.PermessiDataTable _permessiUtenteWrite = new DataLayer_AnagGen.PermessiDataTable();
|
||||
string filtroFunz, filtroPerm, filtroPermWrite;
|
||||
filtroPerm = " COD_PERMESSO IN (";
|
||||
filtroPermWrite = " COD_PERMESSO IN (";
|
||||
// filtro i diritti utente x non avere duplicati...
|
||||
Dictionary<string, string> funzioniUtente = new Dictionary<string, string>();
|
||||
foreach (DataLayer_AnagGen.DIRITTIRow riga in diritti)
|
||||
{
|
||||
try
|
||||
{
|
||||
funzioniUtente.Add(riga.COD_FUNZIONE, riga.COD_FUNZIONE);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
foreach (KeyValuePair<string, string> kvp in funzioniUtente)
|
||||
{
|
||||
filtroFunz = string.Format("COD_FUNZIONE='{0}'", kvp.Value);
|
||||
// recupero le righe dei righe2perm
|
||||
DataLayer_AnagGen.Permessi2FunzioneRow[] righe_p2f = (DataLayer_AnagGen.Permessi2FunzioneRow[])allPerm2Funz.Select(filtroFunz);
|
||||
foreach (DataLayer_AnagGen.Permessi2FunzioneRow riga_p2f in righe_p2f)
|
||||
{
|
||||
filtroPerm += string.Format("'{0}', ", riga_p2f.COD_PERMESSO);
|
||||
// se � write metto in tab relativa...
|
||||
try
|
||||
{
|
||||
if (riga_p2f.READWRITE == "S")
|
||||
{
|
||||
filtroPermWrite += string.Format("'{0}', ", riga_p2f.COD_PERMESSO);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
// cambio modalit� controllo permessi abilitati x problema permessi non trovati...
|
||||
if (filtroPerm != " COD_PERMESSO IN (")
|
||||
{
|
||||
filtroPerm = filtroPerm.Remove(filtroPerm.Length - 2);
|
||||
filtroPerm += ") ";
|
||||
DataLayer_AnagGen.PermessiRow[] righePerm = (DataLayer_AnagGen.PermessiRow[])allPermessi.Select(filtroPerm, "GRUPPO, NUMERO");
|
||||
foreach (DataLayer_AnagGen.PermessiRow rigaPerm in righePerm)
|
||||
{
|
||||
_permessiUtente.ImportRow(rigaPerm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.lg.scriviLog("Permessi utente non trovati!", tipoLog.ERROR);
|
||||
}
|
||||
permessi = _permessiUtente;
|
||||
// salvo, se ci sono, permessi write...
|
||||
if (filtroPermWrite != " COD_PERMESSO IN (")
|
||||
{
|
||||
filtroPermWrite = filtroPermWrite.Remove(filtroPermWrite.Length - 2);
|
||||
filtroPermWrite += ") ";
|
||||
DataLayer_AnagGen.PermessiRow[] righePermW = (DataLayer_AnagGen.PermessiRow[])allPermessi.Select(filtroPermWrite, "GRUPPO, NUMERO");
|
||||
foreach (DataLayer_AnagGen.PermessiRow rigaPerm in righePermW)
|
||||
{
|
||||
_permessiUtenteWrite.ImportRow(rigaPerm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.lg.scriviLog("Permessi utente WRITE non trovati!", tipoLog.ERROR);
|
||||
}
|
||||
permessiWrite = _permessiUtenteWrite;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Carica la tabella diritti dell'utente da db e salva in session
|
||||
/// </summary>
|
||||
protected virtual void setupDirittiPermessi()
|
||||
{
|
||||
DataLayer_AnagGen.DIRITTIDataTable _dirittiUtente = DataWrap.DW.taDiritti.GetByUserDominioModulo(utente, dominio, modulo);
|
||||
diritti = _dirittiUtente; // salvo in session i diritti..
|
||||
if (diritti.Count > 0)
|
||||
{
|
||||
setPermessiDaDiritti();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Carica la tabella diritti dell'utente da db e salva in session SOLO per il CDC indicato
|
||||
/// </summary>
|
||||
/// <param name="cdc"></param>
|
||||
protected virtual void setupDirittiPermessi(string cdc)
|
||||
{
|
||||
DataLayer_AnagGen.DIRITTIDataTable _dirittiUtente = DataWrap.DW.taDiritti.GetByUserDominioModuloCdc(utente, dominio, modulo, cdc);
|
||||
diritti = _dirittiUtente; // salvo in session i diritti..
|
||||
if (diritti.Count > 0)
|
||||
{
|
||||
setPermessiDaDiritti();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Carica la tabella diritti dell'utente da db e salva in session
|
||||
/// </summary>
|
||||
protected virtual void setupDirittiPermessiByUsername()
|
||||
{
|
||||
DataLayer_AnagGen.DIRITTIDataTable _dirittiUtente = DataWrap.DW.taDiritti.GetByUserModulo(utente, modulo);
|
||||
diritti = _dirittiUtente; // salvo in session i diritti..
|
||||
if (diritti.Count > 0)
|
||||
{
|
||||
setPermessiDaDiritti();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// imposta la lingua utente dal valore della riga DB
|
||||
/// </summary>
|
||||
protected virtual void setupLingua()
|
||||
{
|
||||
string _lingua = "";
|
||||
try
|
||||
{
|
||||
_lingua = rigaUtente.COD_LINGUA;
|
||||
}
|
||||
catch { }
|
||||
if (string.IsNullOrEmpty(_lingua))
|
||||
{
|
||||
_lingua = "IT";
|
||||
}
|
||||
|
||||
lingua = _lingua;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// costruisce la mappa del sito per l'utente
|
||||
/// </summary>
|
||||
protected virtual void setupMappaSito()
|
||||
{
|
||||
string _mappa = "";
|
||||
_mappa += "<mainMenu>";
|
||||
try
|
||||
{
|
||||
// partiamo dai permessi utente di numero "0" (sono intestazioni men�...)
|
||||
DataLayer_AnagGen.PermessiRow[] vociMenu = (DataLayer_AnagGen.PermessiRow[])permessi.Select("NUMERO ='0'", "GRUPPO");
|
||||
foreach (DataLayer_AnagGen.PermessiRow voce in vociMenu)
|
||||
{
|
||||
_mappa += formattaNodo(voce.NOME, voce.DESCRIZIONE, voce.URL, siteNodeType.startContainer);
|
||||
// per ogni livello riempiamo con i permessi figli
|
||||
DataLayer_AnagGen.PermessiRow[] pagine = (DataLayer_AnagGen.PermessiRow[])permessi.Select(string.Format("GRUPPO ='{0}' AND NUMERO > 0", voce.GRUPPO), "NUMERO");
|
||||
foreach (DataLayer_AnagGen.PermessiRow pagina in pagine)
|
||||
{
|
||||
_mappa += formattaNodo(pagina.NOME, pagina.DESCRIZIONE, pagina.URL, siteNodeType.leaf);
|
||||
}
|
||||
_mappa += formattaNodo(voce.NOME, voce.DESCRIZIONE, voce.URL, siteNodeType.endContainer);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// salva in session...
|
||||
_mappa += "</mainMenu>";
|
||||
mappaSito = _mappa;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// carica la riga dati utente
|
||||
/// </summary>
|
||||
protected virtual void setupRiga()
|
||||
{
|
||||
//logger.lg.scriviLog(string.Format(@"setupRiga x utente {0}\{1}", dominio, utente), tipoLog.STARTUP);
|
||||
DataLayer_AnagGen.UTENTERow _rigaUtenteAnagGen = ((DataLayer_AnagGen.UTENTERow)DataWrap.DW.taUtente.GetDataByUtenteDominio(utente, dominio).Rows[0]);
|
||||
rigaUtente = _rigaUtenteAnagGen;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// carica la riga dati utente da SOLO USERNAME
|
||||
/// </summary>
|
||||
protected virtual void setupRigaByUsername()
|
||||
{
|
||||
DataLayer_AnagGen.UTENTERow _rigaUtenteAnagGen = ((DataLayer_AnagGen.UTENTERow)DataWrap.DW.taUtente.getByUserName(utente).Rows[0]);
|
||||
rigaUtente = _rigaUtenteAnagGen;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -746,7 +473,7 @@ namespace SteamWare
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog($"Exception during ADuserOk:{Environment.NewLine}{exc}");
|
||||
Log.Error($"Exception during ADuserOk:{Environment.NewLine}{exc}");
|
||||
}
|
||||
// risultato...
|
||||
isOk = (isOkUser && isOkPerm);
|
||||
@@ -771,7 +498,7 @@ namespace SteamWare
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog($"Exception during assegnaDirittoUtente:{Environment.NewLine}{exc}");
|
||||
Log.Error($"Exception during assegnaDirittoUtente:{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -967,7 +694,8 @@ namespace SteamWare
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// restituisce l'elenco delle funzioni abilitate dato modulo ed username partendo dalla radice dell'albero dei diritti
|
||||
/// restituisce l'elenco delle funzioni abilitate dato modulo ed username partendo dalla
|
||||
/// radice dell'albero dei diritti
|
||||
/// </summary>
|
||||
/// <param name="user_name"></param>
|
||||
/// <param name="codModulo"></param>
|
||||
@@ -978,7 +706,8 @@ namespace SteamWare
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// restituisce la tabella (per utente corrente) dei CDC abilitati per l'applicazione attuale da sessione (se non c'� salva...)
|
||||
/// restituisce la tabella (per utente corrente) dei CDC abilitati per l'applicazione
|
||||
/// attuale da sessione (se non c'� salva...)
|
||||
/// </summary>
|
||||
/// <param name="cod_modulo">modulo di cui si testano i diritti</param>
|
||||
/// <returns></returns>
|
||||
@@ -1014,7 +743,8 @@ namespace SteamWare
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// conta il numero di permessi utente per la pagina attuale e restituisce true se ne trova almeno 1
|
||||
/// conta il numero di permessi utente per la pagina attuale e restituisce true se ne trova
|
||||
/// almeno 1
|
||||
/// </summary>
|
||||
/// <param name="pagina"></param>
|
||||
/// <returns></returns>
|
||||
@@ -1037,7 +767,8 @@ namespace SteamWare
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// verifica se il permesso utente per la pagina attuale sia write per almeno 1 diritto assegnato (restituisce true se ne trova almeno 1 con permessi2funzione.readwrite='S')
|
||||
/// verifica se il permesso utente per la pagina attuale sia write per almeno 1 diritto
|
||||
/// assegnato (restituisce true se ne trova almeno 1 con permessi2funzione.readwrite='S')
|
||||
/// </summary>
|
||||
/// <param name="pagina"></param>
|
||||
/// <returns></returns>
|
||||
@@ -1111,7 +842,7 @@ namespace SteamWare
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
Log.Info(string.Format("{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -1134,13 +865,14 @@ namespace SteamWare
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.lg.scriviLog(String.Format("Eccezione: {0}", e));
|
||||
Log.Info(String.Format("Eccezione: {0}", e));
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Procedura da chiamare DOPO aver messo in session i dati utente/dominio x caricare gli altri dati
|
||||
/// Procedura da chiamare DOPO aver messo in session i dati utente/dominio x caricare gli
|
||||
/// altri dati
|
||||
/// </summary>
|
||||
/// <param name="_dominio"></param>
|
||||
/// <param name="_username"></param>
|
||||
@@ -1153,7 +885,7 @@ namespace SteamWare
|
||||
clearAllUserData();
|
||||
if (_username != "" && _dominio != "")
|
||||
{
|
||||
//logger.lg.scriviLog(string.Format("startUpUtente:{2} dominio:\t{0}{2}username:\t{1}", _dominio, _username, Environment.NewLine), tipoLog.STARTUP);
|
||||
//Log.Info(string.Format("startUpUtente:{2} dominio:\t{0}{2}username:\t{1}", _dominio, _username, Environment.NewLine), tipoLog.STARTUP);
|
||||
utente = _username;
|
||||
dominio = _dominio;
|
||||
setupRiga();
|
||||
@@ -1166,13 +898,14 @@ namespace SteamWare
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in fase di startUpUtente:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
Log.Info(string.Format("Errore in fase di startUpUtente:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return risultato;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Procedura da chiamare DOPO aver messo in session i dati utente/dominio x caricare gli altri dati CON I DIRITTI SOLO per il CDC indicato
|
||||
/// Procedura da chiamare DOPO aver messo in session i dati utente/dominio x caricare gli
|
||||
/// altri dati CON I DIRITTI SOLO per il CDC indicato
|
||||
/// </summary>
|
||||
/// <param name="_dominio"></param>
|
||||
/// <param name="_username"></param>
|
||||
@@ -1197,7 +930,8 @@ namespace SteamWare
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Procedura da chiamare DOPO aver messo in session i dati utente/dominio x caricare gli altri dati
|
||||
/// Procedura da chiamare DOPO aver messo in session i dati utente/dominio x caricare gli
|
||||
/// altri dati
|
||||
/// </summary>
|
||||
/// <param name="_username"></param>
|
||||
/// <param name="_pwd"></param>
|
||||
@@ -1253,23 +987,23 @@ namespace SteamWare
|
||||
{
|
||||
if (DataWrap.DW.dictVocabolario != null)
|
||||
{
|
||||
string key = $"{lingua }#{lemma}";
|
||||
string key = $"{lingua}#{lemma}";
|
||||
if (DataWrap.DW.dictVocabolario.ContainsKey(key))
|
||||
{
|
||||
answ = DataWrap.DW.dictVocabolario[lingua + "#" + lemma];
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.lg.scriviLog($"Lemma not found: {_lemma}", tipoLog.LEMMA);
|
||||
Log.Info($"Lemma not found: {_lemma}", tipoLog.LEMMA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(_lemma, tipoLog.LEMMA);
|
||||
Log.Error(_lemma, tipoLog.LEMMA);
|
||||
// loggo risultato x voc
|
||||
logger.lg.scriviLog($"Presenti {DataWrap.DW.numRecVoc} lemmi in vocabolario, richiesto lingua {lingua} | lemma {lemma}{Environment.NewLine}{exc}");
|
||||
Log.Error($"Presenti {DataWrap.DW.numRecVoc} lemmi in vocabolario, richiesto lingua {lingua} | lemma {lemma}{Environment.NewLine}{exc}");
|
||||
if (DataWrap.DW.numRecVoc > 4)
|
||||
{
|
||||
// mostro primi 4...
|
||||
@@ -1278,7 +1012,7 @@ namespace SteamWare
|
||||
{
|
||||
if (i <= 4)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Key: {0} | Val: {1}", item.Key, item.Value), tipoLog.INFO);
|
||||
Log.Info(string.Format("Key: {0} | Val: {1}", item.Key, item.Value), tipoLog.INFO);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -1286,7 +1020,7 @@ namespace SteamWare
|
||||
}
|
||||
if (currRunMode == runModes.echoLemmi)
|
||||
{
|
||||
logger.lg.scriviLog(_lemma, tipoLog.LEMMA);
|
||||
Log.Info(_lemma, tipoLog.LEMMA);
|
||||
}
|
||||
|
||||
return answ;
|
||||
@@ -1334,7 +1068,8 @@ namespace SteamWare
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// verifica nella tab diritti se l'utente abbia il right richiesto (come COD_FUNZIONE) e fornisce bool in risposta
|
||||
/// verifica nella tab diritti se l'utente abbia il right richiesto (come COD_FUNZIONE) e
|
||||
/// fornisce bool in risposta
|
||||
/// </summary>
|
||||
/// <param name="diritto"></param>
|
||||
/// <returns></returns>
|
||||
@@ -1354,5 +1089,286 @@ namespace SteamWare
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// cancella da session l'utente
|
||||
/// </summary>
|
||||
protected void clearAllUserData()
|
||||
{
|
||||
memLayer.ML.emptySessionVal("USER_NAME");
|
||||
memLayer.ML.emptySessionVal("DOMINIO");
|
||||
memLayer.ML.emptySessionVal("permessiUtente");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// formatta un nodo in modo corretto dai dati indicati
|
||||
/// </summary>
|
||||
/// <param name="titolo"></param>
|
||||
/// <param name="descrizione"></param>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="tipoNodo"></param>
|
||||
protected string formattaNodo(string titolo, string descrizione, string url, siteNodeType tipoNodo)
|
||||
{
|
||||
string _out = "";
|
||||
switch (tipoNodo)
|
||||
{
|
||||
case siteNodeType.startContainer:
|
||||
_out = string.Format("<menu title=\"{0}\" description=\"{1}\" url=\"~/{2}\">", Traduci(titolo), Traduci(descrizione), url);
|
||||
break;
|
||||
|
||||
case siteNodeType.endContainer:
|
||||
_out = "</menu>";
|
||||
break;
|
||||
|
||||
case siteNodeType.leaf:
|
||||
_out = string.Format("<voce title=\"{0}\" description=\"{1}\" url=\"~/{2}\" />", Traduci(titolo), Traduci(descrizione), url);
|
||||
break;
|
||||
}
|
||||
return _out;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// salva dati accessori quali il cdc dell'utente...
|
||||
/// </summary>
|
||||
protected virtual void salvaDatiAccessori()
|
||||
{
|
||||
// salvo il cdc utente...
|
||||
memLayer.ML.setSessionVal("CdCUser", rigaUtente.COD_CDC);
|
||||
// verifico se necessario fare echo lemmi e vado in runMode di echo dei termini tradotti
|
||||
bool echoLemmi = false;
|
||||
try
|
||||
{
|
||||
echoLemmi = memLayer.ML.CRB("echoLemmi");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (echoLemmi)
|
||||
{
|
||||
currRunMode = runModes.echoLemmi;
|
||||
}
|
||||
else
|
||||
{
|
||||
currRunMode = runModes.normal;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua setup dei permessi una volta salvati i diritti
|
||||
/// </summary>
|
||||
protected virtual void setPermessiDaDiritti()
|
||||
{
|
||||
// proseguo coi permessi
|
||||
DataLayer_AnagGen.PermessiDataTable allPermessi = DataWrap.DW.taPermessi.GetData();
|
||||
DataLayer_AnagGen.Permessi2FunzioneDataTable allPerm2Funz = DataWrap.DW.taPermessi2Funzione.GetData();
|
||||
DataLayer_AnagGen.PermessiDataTable _permessiUtente = new DataLayer_AnagGen.PermessiDataTable();
|
||||
DataLayer_AnagGen.PermessiDataTable _permessiUtenteWrite = new DataLayer_AnagGen.PermessiDataTable();
|
||||
string filtroFunz, filtroPerm, filtroPermWrite;
|
||||
filtroPerm = " COD_PERMESSO IN (";
|
||||
filtroPermWrite = " COD_PERMESSO IN (";
|
||||
// filtro i diritti utente x non avere duplicati...
|
||||
Dictionary<string, string> funzioniUtente = new Dictionary<string, string>();
|
||||
foreach (DataLayer_AnagGen.DIRITTIRow riga in diritti)
|
||||
{
|
||||
try
|
||||
{
|
||||
funzioniUtente.Add(riga.COD_FUNZIONE, riga.COD_FUNZIONE);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
foreach (KeyValuePair<string, string> kvp in funzioniUtente)
|
||||
{
|
||||
filtroFunz = string.Format("COD_FUNZIONE='{0}'", kvp.Value);
|
||||
// recupero le righe dei righe2perm
|
||||
DataLayer_AnagGen.Permessi2FunzioneRow[] righe_p2f = (DataLayer_AnagGen.Permessi2FunzioneRow[])allPerm2Funz.Select(filtroFunz);
|
||||
foreach (DataLayer_AnagGen.Permessi2FunzioneRow riga_p2f in righe_p2f)
|
||||
{
|
||||
filtroPerm += string.Format("'{0}', ", riga_p2f.COD_PERMESSO);
|
||||
// se � write metto in tab relativa...
|
||||
try
|
||||
{
|
||||
if (riga_p2f.READWRITE == "S")
|
||||
{
|
||||
filtroPermWrite += string.Format("'{0}', ", riga_p2f.COD_PERMESSO);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
// cambio modalit� controllo permessi abilitati x problema permessi non trovati...
|
||||
if (filtroPerm != " COD_PERMESSO IN (")
|
||||
{
|
||||
filtroPerm = filtroPerm.Remove(filtroPerm.Length - 2);
|
||||
filtroPerm += ") ";
|
||||
DataLayer_AnagGen.PermessiRow[] righePerm = (DataLayer_AnagGen.PermessiRow[])allPermessi.Select(filtroPerm, "GRUPPO, NUMERO");
|
||||
foreach (DataLayer_AnagGen.PermessiRow rigaPerm in righePerm)
|
||||
{
|
||||
_permessiUtente.ImportRow(rigaPerm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Info("Permessi utente non trovati!", tipoLog.ERROR);
|
||||
}
|
||||
permessi = _permessiUtente;
|
||||
// salvo, se ci sono, permessi write...
|
||||
if (filtroPermWrite != " COD_PERMESSO IN (")
|
||||
{
|
||||
filtroPermWrite = filtroPermWrite.Remove(filtroPermWrite.Length - 2);
|
||||
filtroPermWrite += ") ";
|
||||
DataLayer_AnagGen.PermessiRow[] righePermW = (DataLayer_AnagGen.PermessiRow[])allPermessi.Select(filtroPermWrite, "GRUPPO, NUMERO");
|
||||
foreach (DataLayer_AnagGen.PermessiRow rigaPerm in righePermW)
|
||||
{
|
||||
_permessiUtenteWrite.ImportRow(rigaPerm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Info("Permessi utente WRITE non trovati!", tipoLog.ERROR);
|
||||
}
|
||||
permessiWrite = _permessiUtenteWrite;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Carica la tabella diritti dell'utente da db e salva in session
|
||||
/// </summary>
|
||||
protected virtual void setupDirittiPermessi()
|
||||
{
|
||||
DataLayer_AnagGen.DIRITTIDataTable _dirittiUtente = DataWrap.DW.taDiritti.GetByUserDominioModulo(utente, dominio, modulo);
|
||||
diritti = _dirittiUtente; // salvo in session i diritti..
|
||||
if (diritti.Count > 0)
|
||||
{
|
||||
setPermessiDaDiritti();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Carica la tabella diritti dell'utente da db e salva in session SOLO per il CDC indicato
|
||||
/// </summary>
|
||||
/// <param name="cdc"></param>
|
||||
protected virtual void setupDirittiPermessi(string cdc)
|
||||
{
|
||||
DataLayer_AnagGen.DIRITTIDataTable _dirittiUtente = DataWrap.DW.taDiritti.GetByUserDominioModuloCdc(utente, dominio, modulo, cdc);
|
||||
diritti = _dirittiUtente; // salvo in session i diritti..
|
||||
if (diritti.Count > 0)
|
||||
{
|
||||
setPermessiDaDiritti();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Carica la tabella diritti dell'utente da db e salva in session
|
||||
/// </summary>
|
||||
protected virtual void setupDirittiPermessiByUsername()
|
||||
{
|
||||
DataLayer_AnagGen.DIRITTIDataTable _dirittiUtente = DataWrap.DW.taDiritti.GetByUserModulo(utente, modulo);
|
||||
diritti = _dirittiUtente; // salvo in session i diritti..
|
||||
if (diritti.Count > 0)
|
||||
{
|
||||
setPermessiDaDiritti();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// imposta la lingua utente dal valore della riga DB
|
||||
/// </summary>
|
||||
protected virtual void setupLingua()
|
||||
{
|
||||
string _lingua = "";
|
||||
try
|
||||
{
|
||||
_lingua = rigaUtente.COD_LINGUA;
|
||||
}
|
||||
catch { }
|
||||
if (string.IsNullOrEmpty(_lingua))
|
||||
{
|
||||
_lingua = "IT";
|
||||
}
|
||||
|
||||
lingua = _lingua;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// costruisce la mappa del sito per l'utente
|
||||
/// </summary>
|
||||
protected virtual void setupMappaSito()
|
||||
{
|
||||
string _mappa = "";
|
||||
_mappa += "<mainMenu>";
|
||||
try
|
||||
{
|
||||
// partiamo dai permessi utente di numero "0" (sono intestazioni men�...)
|
||||
DataLayer_AnagGen.PermessiRow[] vociMenu = (DataLayer_AnagGen.PermessiRow[])permessi.Select("NUMERO ='0'", "GRUPPO");
|
||||
foreach (DataLayer_AnagGen.PermessiRow voce in vociMenu)
|
||||
{
|
||||
_mappa += formattaNodo(voce.NOME, voce.DESCRIZIONE, voce.URL, siteNodeType.startContainer);
|
||||
// per ogni livello riempiamo con i permessi figli
|
||||
DataLayer_AnagGen.PermessiRow[] pagine = (DataLayer_AnagGen.PermessiRow[])permessi.Select(string.Format("GRUPPO ='{0}' AND NUMERO > 0", voce.GRUPPO), "NUMERO");
|
||||
foreach (DataLayer_AnagGen.PermessiRow pagina in pagine)
|
||||
{
|
||||
_mappa += formattaNodo(pagina.NOME, pagina.DESCRIZIONE, pagina.URL, siteNodeType.leaf);
|
||||
}
|
||||
_mappa += formattaNodo(voce.NOME, voce.DESCRIZIONE, voce.URL, siteNodeType.endContainer);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// salva in session...
|
||||
_mappa += "</mainMenu>";
|
||||
mappaSito = _mappa;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// carica la riga dati utente
|
||||
/// </summary>
|
||||
protected virtual void setupRiga()
|
||||
{
|
||||
//Log.Info(string.Format(@"setupRiga x utente {0}\{1}", dominio, utente), tipoLog.STARTUP);
|
||||
DataLayer_AnagGen.UTENTERow _rigaUtenteAnagGen = ((DataLayer_AnagGen.UTENTERow)DataWrap.DW.taUtente.GetDataByUtenteDominio(utente, dominio).Rows[0]);
|
||||
rigaUtente = _rigaUtenteAnagGen;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// carica la riga dati utente da SOLO USERNAME
|
||||
/// </summary>
|
||||
protected virtual void setupRigaByUsername()
|
||||
{
|
||||
DataLayer_AnagGen.UTENTERow _rigaUtenteAnagGen = ((DataLayer_AnagGen.UTENTERow)DataWrap.DW.taUtente.getByUserName(utente).Rows[0]);
|
||||
rigaUtente = _rigaUtenteAnagGen;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// controllo utente/pwd da tab
|
||||
/// </summary>
|
||||
/// <param name="_username"></param>
|
||||
/// <param name="_pwd"></param>
|
||||
/// <returns></returns>
|
||||
private bool checkUserPwd(string _username, string _pwd)
|
||||
{
|
||||
bool risultato = false;
|
||||
try
|
||||
{
|
||||
risultato = DataWrap.DW.taUserData.getByUserPwd(_username, _pwd).Rows.Count > 0;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return risultato;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user