fix visualizzazione menù x utenti "base"...

This commit is contained in:
Samuele E. Locatelli
2015-10-29 14:49:04 +01:00
parent ab54bbf1f8
commit 836c9b3e6a
30 changed files with 426 additions and 68 deletions
+1
View File
@@ -59,6 +59,7 @@
<DependentUpon>DS_Utility.xsd</DependentUpon>
</Compile>
<Compile Include="DtProxy.cs" />
<Compile Include="OpAuth.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
+130
View File
@@ -0,0 +1,130 @@
using SteamWare;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CMS_SC_Data
{
/// <summary>
/// Classe gestione auth utente
/// </summary>
public class OpAuth
{
/// <summary>
/// email (univoco)
/// </summary>
public string email { get; set; }
/// <summary>
/// Cognome - Nome
/// </summary>
public string CognomeNome { get; set; }
/// <summary>
/// numero autorizzazioni ancora possibili
/// </summary>
public int remAuth { get; set; }
/// <summary>
/// scadenza massima auth
/// </summary>
public DateTime scadAuth { get; set; }
/// <summary>
/// inizializzazione componente, default da web.config MA CON AUTH
/// </summary>
protected OpAuth()
{
// imposto valori di default (scaduti...)
email = "NA";
CognomeNome = "NA";
remAuth = memLayer.ML.CRI("defRemAuth");
scadAuth = DateTime.Now.AddMinutes(memLayer.ML.CRI("defMinScad"));
}
/// <summary>
/// Fornisce un oggetto OpAuth popolato da email calcolando il resto + lettura default da web.config
/// </summary>
/// <param name="email"></param>
/// <returns></returns>
public static OpAuth startOpAuth(string email)
{
OpAuth answ = new OpAuth();
if (email != "")
{
answ.email = email;
answ.CognomeNome = "Test - completare"; // utils.obj.getOperatoreByCod(email);
}
currAuth = answ;
return answ;
}
/// <summary>
/// toglie auth utente
/// </summary>
public static void stopAuth()
{
memLayer.ML.emptySessionVal("OpAuth");
}
/// <summary>
/// Auth Corrente x operazioni User
/// </summary>
public static OpAuth currAuth
{
get
{
OpAuth answ = new OpAuth();
// cerco in sessione...
if (memLayer.ML.isInSessionObject("OpAuth"))
{
answ = (OpAuth)memLayer.ML.objSessionObj("OpAuth");
}
return answ;
}
set
{
memLayer.ML.setSessionVal("OpAuth", value);
}
}
/// <summary>
/// definisce si sia valida auth operatività utente, ovvero
/// - valori in sessione
/// - num auth > 0
/// - auth non scaduta
/// </summary>
public static bool isAuth
{
get
{
bool answ = false;
// se ho valori in sessione
if (memLayer.ML.isInSessionObject("OpAuth"))
{
// se ho num auth > 0
if (currAuth.remAuth > 0)
{
// se non è scaduta auth..
if (currAuth.scadAuth > DateTime.Now)
{
// se ho un email VALIDO
if (currAuth.email != "")
{
answ = true;
}
}
}
}
return answ;
}
}
/// <summary>
/// definisce se sia RICHEISTA OpAuth
/// </summary>
public static bool opAuthReq
{
get
{
// verifico SE devo fare controllo OpAuth...
return memLayer.ML.CRB("enableOpAuth");
}
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+9 -1
View File
@@ -20,7 +20,7 @@
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>
<AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -377,6 +377,7 @@
<Content Include="WebUserControls\mod_enrollByAuthKey.ascx" />
<Content Include="WebUserControls\mod_enrollByEmail.ascx" />
<Content Include="WebUserControls\mod_enrollByJumperAuthKey.ascx" />
<Content Include="WebUserControls\mod_enrollUserBase.ascx" />
<Content Include="WebUserControls\mod_fileUpload.ascx" />
<Content Include="WebUserControls\mod_lemmiVocab.ascx" />
<Content Include="WebUserControls\mod_listValues.ascx" />
@@ -754,6 +755,13 @@
<Compile Include="WebUserControls\mod_enrollByJumperAuthKey.ascx.designer.cs">
<DependentUpon>mod_enrollByJumperAuthKey.ascx</DependentUpon>
</Compile>
<Compile Include="WebUserControls\mod_enrollUserBase.ascx.cs">
<DependentUpon>mod_enrollUserBase.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="WebUserControls\mod_enrollUserBase.ascx.designer.cs">
<DependentUpon>mod_enrollUserBase.ascx</DependentUpon>
</Compile>
<Compile Include="WebUserControls\mod_fileUpload.ascx.cs">
<DependentUpon>mod_fileUpload.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
+6
View File
@@ -895,4 +895,10 @@ a:focus {
height: 0;
width: 0;
visibility: hidden;
}
.checkOk {
color: #99FF99;
}
.checkKo {
color: #5f2121;
}
+8
View File
@@ -1075,3 +1075,11 @@ a:focus {
width: 0;
visibility: hidden;
}
.checkOk {
color: #99FF99;
}
.checkKo {
color: #5f2121;
}
+4 -1
View File
@@ -5,6 +5,8 @@
<%@ Register Src="WebUserControls/mod_elencoRichResetUtenti.ascx" TagName="mod_elencoRichResetUtenti" TagPrefix="uc3" %>
<%@ Register Src="WebUserControls/mod_enrollByAuthKey.ascx" TagName="mod_enrollByAuthKey" TagPrefix="uc4" %>
<%@ Register Src="~/WebUserControls/mod_enrollUserBase.ascx" TagPrefix="uc2" TagName="mod_enrollUserBase" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
@@ -13,11 +15,12 @@
<div class="container">
<div id="divUnauth" runat="server">
<h1><%: traduci("UserAdminTitle") %></h1>
<%: traduci("UserAdminInstr01") %>
<br />
<uc2:mod_enrollUserBase runat="server" id="mod_enrollUserBase" />
<br />
<uc4:mod_enrollByAuthKey ID="mod_enrollByAuthKey1" runat="server" />
<br />
<%: traduci("UserAdminInstr01") %>
<uc2:mod_enrollByEmail ID="mod_enrollByEmail1" runat="server" />
</div>
+3 -1
View File
@@ -16,12 +16,14 @@ namespace CMS_SC
checkVisibCtrl();
}
/// <summary>
/// Controlla visibilità delle sezioni (in particolare abilitazioen da utente/AuthKey)
/// Controlla visibilità delle sezioni (in particolare abilitazione da utente/AuthKey)
/// </summary>
private void checkVisibCtrl()
{
// controllo se c'è chiamata x aggiungere device da authKey e mostro panel...
mod_enrollByAuthKey1.Visible = (Request.QueryString["addDeviceByKey"] == "lvabe");
// controllo se mostrare login "semplificato"
mod_enrollUserBase.Visible = memLayer.ML.CRB("enableOpAuth");
// se è admin vede anche i controlli x abilitare richieste utenti & co...
divAdmin.Visible = userIsAdmin;
divUnauth.Visible = !userIsAdmin;
+9
View File
@@ -21,6 +21,15 @@ namespace CMS_SC {
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divUnauth;
/// <summary>
/// mod_enrollUserBase control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::CMS_SC.WebUserControls.mod_enrollUserBase mod_enrollUserBase;
/// <summary>
/// mod_enrollByAuthKey1 control.
/// </summary>
+6
View File
@@ -40,6 +40,12 @@
<add key="urlGestUtenti" value="UserAdmin" />
<add key="adminEmail" value="samuele@steamware.net" />
<add key="PageNoIndex" value="UserAdmin#Test" />
<!--gestione auth collaudatori "username-only"-->
<add key="enableOpAuth" value="true" />
<add key="authUserBaseTimeout" value="60" />
<add key="defRemAuth" value="9999" />
<add key="defMinScad" value="60" />
<!--gestione timeout "esteso" x chiamate SQL critiche, in secondi -->
<add key="sqlLongCommandTimeout" value="600" />
<!--area suggerimenti-->
@@ -0,0 +1,29 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_enrollUserBase.ascx.cs" Inherits="CMS_SC.WebUserControls.mod_enrollUserBase" %>
<div class="panel panel-warning">
<div class="panel-heading">
<div class="panel-title"><%: traduci("AuthUserBaseCollaudi") %></div>
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-4">
<asp:TextBox runat="server" ID="txtCognome" Width="100%" placeholder="Cognome" />
</div>
<div class="col-xs-4">
<asp:TextBox runat="server" ID="txtNome" Width="100%" placeholder="Nome" />
</div>
<div class="col-xs-4">
<asp:LinkButton runat="server" Width="100%" CssClass="btn btn-default btn-xs" ID="btnEnrollByAK" OnClick="btnEnrollByAK_Click"><%: traduci("btnAuthUserBase") %></asp:LinkButton>
</div>
<div class="col-xs-12" style="padding-bottom: 40px;">
<asp:Label runat="server" ID="lblOutMsg" Text="..." Visible="false" ForeColor="Red" />
</div>
<div class="col-xs-12" style="color: #696969;">
<h4><%: traduci("AuthUserBaseTitle") %></h4>
<hr />
<i><%: traduci("AuthUserBaseInstr01") %></i>
</div>
</div>
</div>
</div>
@@ -0,0 +1,56 @@
using SteamWare;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace CMS_SC.WebUserControls
{
public partial class mod_enrollUserBase : SteamWare.UserControl
{
/// <summary>
/// richiesta enroll device da chiave personale + email
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnEnrollByAK_Click(object sender, EventArgs e)
{
// leggo cognome / nome x controllare email cms nome.cognome@cms.it ...
string cognome = txtCognome.Text.Trim().ToLower();
string nome = txtNome.Text.Trim().ToLower();
string email = string.Format("{0}.{1}@cms.it", nome, cognome);
if (email != "")
{
// ora controllo che l'email SIA nell'elenco delle email degli utenti...
if (devicesAuthProxy.stObj.checkUserEmail(email))
{
#if false
// controllo se l'utente è "base" e quindi posso fare auth "semplificata"...
if (devicesAuthProxy.stObj.checkUserEmailAK(email, authKey))
{
// rimando al jumper...
Response.Redirect(string.Format("jumper?UserAuthkey={0}&USER_NAME={1}", authKey, email));
}
else
{
lblOutMsg.Text = traduci("ErrorEAK01");// "Attenzione! auth key NON valida, prego contattare amministratore!";
lblOutMsg.Visible = true;
}
#endif
}
else
{
lblOutMsg.Text = traduci("ErrorEAK02");//"Attenzione! email non trovata, prego contattare amministratore!";
lblOutMsg.Visible = true;
}
}
else
{
lblOutMsg.Text = traduci("ErrorEAK03");//"Attenzione! preogo inserire email valida!";
lblOutMsg.Visible = true;
}
}
}
}
@@ -0,0 +1,51 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CMS_SC.WebUserControls {
public partial class mod_enrollUserBase {
/// <summary>
/// txtCognome control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtCognome;
/// <summary>
/// txtNome control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtNome;
/// <summary>
/// btnEnrollByAK control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton btnEnrollByAK;
/// <summary>
/// lblOutMsg control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblOutMsg;
}
}
+16 -26
View File
@@ -34,11 +34,7 @@
<li class='<%: "dropdown " + checkShow("Anagrafiche") + liClass("AnagFamMacchine AnagMatricole AnagFasi AnagMisure AnagSchedeColl DettScheda SchemaCollFamMacc")%>'>
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-th"></i>
<span>Anagrafiche</span>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<span>Anagrafiche</span> <b class="caret"></b></a><ul class="dropdown-menu">
<li><a href="AnagFasi"><%: traduci("AnagFasi") %></a></li>
<li><a href="AnagTags"><%: traduci("AnagTags") %></a></li>
<li><a href="AnagSchedeColl"><%: traduci("AnagSchedeColl") %></a></li>
@@ -53,24 +49,17 @@
<li class='<%: "dropdown " + checkShow("Collaudi") + liClass("SchemaCollMacc ElencoSchede Collaudi")%>'>
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-copy"></i>
<span>Collaudi</span>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="SchemaCollMacc"><%: traduci("SchemaCollMacc") %></a></li>
<span>Collaudi</span> <b class="caret"></b></a><ul class="dropdown-menu">
<li class='<%: checkShow("Settings")%>' ><a href="SchemaCollMacc"><%: traduci("SchemaCollMacc") %></a></li>
<li runat="server" id="li3" class="divider"></li>
<li><a href="ElencoSchede"><%: traduci("ElencoSchede") %></a></li>
<li class='<%: checkShow("Settings")%>' ><a href="ElencoSchede"><%: traduci("ElencoSchede") %></a></li>
<li><a href="Collaudi"><%: traduci("Collaudi") %></a></li>
</ul>
</li>
<li class='<%: "dropdown " + checkShow("Reports") + liClass("ReportCompatto ReportCompleto ReportCliente")%>'>
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-print"></i>
<span>Reports</span>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<span>Reports</span> <b class="caret"></b></a><ul class="dropdown-menu">
<li><a href="ReportCompatto"><%: traduci("ReportCompatto") %></a></li>
<li><a href="ReportCompleto"><%: traduci("ReportCompleto") %></a></li>
<li><a href="ReportCliente"><%: traduci("ReportCliente") %></a></li>
@@ -79,20 +68,21 @@
<li class='<%: "dropdown " + checkShow("Settings") + liClass("Settings Vocabolario ListValues UserAdmin UpdateVoc")%>'>
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-cog"></i>
<span>Settings</span>
<b class="caret"></b>
<span>Settings</span> <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li runat="server" id="liGestVoc"><a href="Vocabolario"><%: traduci("GestVoc") %></a></li>
<li runat="server" id="liListValues"><a href="ListValues"><%: traduci("ListValuesMgmt") %></a></li>
<li runat="server" id="liUserAdmin"><a href="UserAdmin"><%: traduci("UserAdmin") %></a></li>
<li runat="server" id="liDivider" class="divider"></li>
<li runat="server" id="liUpdateVoc"><a href="UpdateVoc"><%: traduci("UpdateVoc") %></a></li>
<li id="liGestVoc"><a href="Vocabolario"><%: traduci("GestVoc") %></a></li>
<li id="liListValues"><a href="ListValues"><%: traduci("ListValuesMgmt") %></a></li>
<li id="liUserAdmin"><a href="UserAdmin"><%: traduci("UserAdmin") %></a></li>
<li class="divider" id="liDivider"></li>
<li id="liUpdateVoc"><a href="UpdateVoc"><%: traduci("UpdateVoc") %></a></li>
</ul>
</li>
</ul>
<div class="navbar-form navbar-right" role="search">
<li>
<asp:HyperLink runat="server" ID="hlUser" ToolTip='<%# usrAuthToolTip %>'>
<i class="fa fa-user fa-lg <%: usrAuthCss %>"></i>
<span><asp:Label runat="server" ID="lblMatr" Text='<%# usrAuthText %>' /></span>
</asp:HyperLink></li></ul><div class="navbar-form navbar-right" role="search">
<div class="form-group-md navbar-brand">
<asp:TextBox ID="txtSearch" runat="server" CssClass="form-control input-sm search-query" placeholder="Search" AutoPostBack="true" OnTextChanged="txtSearch_TextChanged" TextMode="Search" />
</div>
+84 -4
View File
@@ -5,6 +5,7 @@ using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
using CMS_SC_Data;
namespace CMS_SC.WebUserControls
{
@@ -239,13 +240,92 @@ namespace CMS_SC.WebUserControls
return answ;
}
/// <summary>
/// tooltip che indica se user autorizzato
/// </summary>
public string usrAuthToolTip
{
get
{
string answ = "";
try
{
if (userAuthOk)
{
answ = string.Format("{0} - {1}", traduci("UserAuthOk"), OpAuth.currAuth.CognomeNome);
}
else
{
answ = traduci("UserAuthKo");
}
}
catch
{ }
return answ;
}
}
/// <summary>
/// text x user autorizzato
/// </summary>
public string usrAuthText
{
get
{
string answ = "...";
try
{
if (userAuthOk)
{
answ = OpAuth.currAuth.CognomeNome;
}
else
{
answ = "...";
}
}
catch
{ }
return answ;
}
}
/// <summary>
/// css x colore icona user auth
/// </summary>
public string usrAuthCss
{
get
{
string answ = "";
try
{
if (userAuthOk)
{
answ = "checkOk";
}
else
{
answ = "checkKo";
}
}
catch
{ }
return answ;
}
}
protected bool userAuthOk
{
get
{
return OpAuth.isAuth;
}
}
/// <summary>
/// verifica visibilità in base al menù...
/// </summary>
/// <param name="nomeMenu"></param>
/// <returns></returns>
public string checkShow(string nomeMenu)
{
string answ = "hidden";
string answ = "hidden ";
// verifico: se è userIsSuperAdmin vede tutto
if (userIsSuperAdmin)
{
@@ -256,7 +336,7 @@ namespace CMS_SC.WebUserControls
// controllo in base a cosa richiesto...
if (nomeMenu == "Settings")
{
answ = "hidden";
answ = "hidden ";
}
else
{
@@ -268,7 +348,7 @@ namespace CMS_SC.WebUserControls
// controllo in base a cosa richiesto...
if ((nomeMenu == "Anagrafiche") || (nomeMenu == "Settings"))
{
answ = "hidden";
answ = "hidden ";
}
else
{
@@ -284,7 +364,7 @@ namespace CMS_SC.WebUserControls
}
else
{
answ = "hidden";
answ = "hidden ";
}
}
return answ;
+4 -31
View File
@@ -76,49 +76,22 @@ namespace CMS_SC.WebUserControls {
protected global::System.Web.UI.HtmlControls.HtmlGenericControl li3;
/// <summary>
/// liGestVoc control.
/// hlUser control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl liGestVoc;
protected global::System.Web.UI.WebControls.HyperLink hlUser;
/// <summary>
/// liListValues control.
/// lblMatr control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl liListValues;
/// <summary>
/// liUserAdmin control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl liUserAdmin;
/// <summary>
/// liDivider control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl liDivider;
/// <summary>
/// liUpdateVoc control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl liUpdateVoc;
protected global::System.Web.UI.WebControls.Label lblMatr;
/// <summary>
/// txtSearch control.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6
View File
@@ -40,6 +40,12 @@
<add key="urlGestUtenti" value="UserAdmin" />
<add key="adminEmail" value="samuele@steamware.net" />
<add key="PageNoIndex" value="UserAdmin#Test" />
<!--gestione auth collaudatori "username-only"-->
<add key="enableOpAuth" value="true" />
<add key="authUserBaseTimeout" value="60" />
<add key="defRemAuth" value="9999" />
<add key="defMinScad" value="60" />
<!--gestione timeout "esteso" x chiamate SQL critiche, in secondi -->
<add key="sqlLongCommandTimeout" value="600" />
<!--area suggerimenti-->
Binary file not shown.
+2 -2
View File
@@ -5,7 +5,7 @@
using System.Reflection;
[assembly: AssemblyVersion("1.9.104.356")]
[assembly: AssemblyFileVersion("1.9.104.356")]
[assembly: AssemblyVersion("1.9.109.356")]
[assembly: AssemblyFileVersion("1.9.109.356")]
[assembly: AssemblyCopyright("Steamware © 2009-2015")]
[assembly: AssemblyCompany("Steamware")]
+2 -2
View File
@@ -6,8 +6,8 @@
using System.Reflection;
[assembly: AssemblyVersion("1.9.104.<#= this.RevisionNumber #>")]
[assembly: AssemblyFileVersion("1.9.104.<#= this.RevisionNumber #>")]
[assembly: AssemblyVersion("1.9.109.<#= this.RevisionNumber #>")]
[assembly: AssemblyFileVersion("1.9.109.<#= this.RevisionNumber #>")]
[assembly: AssemblyCopyright("Steamware © 2009-<#= DateTime.Now.Year #>")]
[assembly: AssemblyCompany("Steamware")]
<#+
Binary file not shown.
Binary file not shown.