Files
mapo-core/MP.SPEC/Data/MsgServiceSpec.cs
T
Samuele Locatelli 71fc5a81d4 SPEC:
- fix gestione permessi x nagMan + check buttons
2025-04-16 17:44:34 +02:00

80 lines
1.8 KiB
C#

using MP.AppAuth.Models;
namespace MP.SPEC.Data
{
public class MsgServiceSpec
{
#region Public Events
public event Action EA_BroadCastMsg = null!;
#endregion Public Events
#region Public Properties
/// <summary>
/// Dominio utente
/// </summary>
public string DomainName { get; set; } = "";
public string newBCMsg
{
get => _newBCMsg;
set
{
if (_newBCMsg != value)
{
_newBCMsg = value;
reportMsg();
}
}
}
/// <summary>
/// Username utente
/// </summary>
public string UserName { get; set; } = "";
/// <summary>
/// Diritti utente (solo Funzione/Ruolo)
/// </summary>
public List<string> UserRight { get; set; } = new List<string>();
/// <summary>
/// Verifica ruolo utente
/// </summary>
/// <param name="Ruolo"></param>
/// <returns></returns>
public bool HasRole(string Ruolo)
{
bool answ = false;
if (UserRight != null && UserRight.Count > 0)
{
answ = UserRight
.Where(x => x.Equals(Ruolo, StringComparison.InvariantCultureIgnoreCase))
.Count() > 0;
}
return answ;
}
#endregion Public Properties
#region Protected Methods
protected void reportMsg()
{
if (EA_BroadCastMsg != null)
{
EA_BroadCastMsg?.Invoke();
}
}
#endregion Protected Methods
#region Private Properties
private string _newBCMsg { get; set; } = "";
#endregion Private Properties
}
}