48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
|
using DeviceRepair.Models;
|
|||
|
using System;
|
|||
|
using System.Linq;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace DeviceRepairAndOptimization
|
|||
|
{
|
|||
|
public static class GlobalInfo
|
|||
|
{
|
|||
|
public static UserInfoModel CurrentUser { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 是否有权限
|
|||
|
/// </summary>
|
|||
|
/// <param name="AuthString"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static bool HasRole(string AuthString)
|
|||
|
{
|
|||
|
if (CurrentUser == null || CurrentUser.AuthItems == null)
|
|||
|
return false;
|
|||
|
|
|||
|
return CurrentUser.AuthItems.Any(x => x.AuthCode.Equals(AuthString, StringComparison.CurrentCultureIgnoreCase));
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private static HeaderModel _OperationInfo;
|
|||
|
public static HeaderModel OperationInfo
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_OperationInfo == null)
|
|||
|
{
|
|||
|
_OperationInfo = new HeaderModel();
|
|||
|
_OperationInfo.ClientMac = ComputerHelper.GetMacAddress;
|
|||
|
_OperationInfo.ClientName = ComputerHelper.GetComputerName;
|
|||
|
_OperationInfo.IPAddress = ComputerHelper.GetIPAddress;
|
|||
|
_OperationInfo.Operator = CurrentUser.AutoID;
|
|||
|
_OperationInfo.OperatorName = CurrentUser.LoginCode;
|
|||
|
}
|
|||
|
|
|||
|
return _OperationInfo;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static string token = "";
|
|||
|
public static Form _RootForm;
|
|||
|
}
|
|||
|
}
|