最近客戶有需要,同一個帳戶可以重復登錄系統,但是后登錄的賬戶需要把前面已經登錄的賬戶踢掉,例如客戶把電腦打開在別的電腦上然后換一個房間,或者換個辦公樓想登錄時就會遇到很多麻煩,遇到郁悶的情況就是死活無法登錄系統,因為那個帳戶已經在線了,或者2個帳戶都登錄了,最新消息提醒會亂套。
其實軟件是否好用都是體現在能否經得起各種折磨上,有的軟件把問題考慮得很充分,不管遇到什么麻煩事情都已經幫你處理好了,想得非常周到,下面我們看看通用權限管理系統里的處理方式。
1:首先系統里有設置,是否允許重復登錄的選項,一般情況下默認配置是不用修改的
2:我們登錄系統
3:登錄到系統后的效果如下
4:每個用戶登錄系統后,都會產生一個新的OpenId,然后把這個OpenId保存到客戶端。
5:再登錄系統后,會產生新的 OpenId。
6:由於上一個登錄的本地的OpenId與服務器上的OpenId不一樣了,所以上一個登錄系統的軟件就被迫被下線了,什么煩惱都這么簡單的解決了。
有了這個功能,客戶就可以在任何電腦上,任何辦公室,任何辦公樓里都可以隨時登錄,不用有上一個已經登錄的系統的煩惱了,爽歪歪,軟件也好用了更加人性化了。
系統管理員也有能力想讓那個用戶下線就可以讓哪個用戶下線了又簡單又好用了。
當前用戶的信息如下:

//
-----------------------------------------------------------------
// All Rights Reserved , Copyright (C) 2011 , Hairihan TECH, Ltd.
// -----------------------------------------------------------------
using System;
namespace DotNet.Utilities
{
/// <summary>
/// BaseUserInfo
/// 用戶類
///
/// 修改紀錄
///
/// 2011.09.12 JiRiGaLa 版本:2.1 公司名稱、部門名稱、工作組名稱進行重構。
/// 2011.05.11 JiRiGaLa 版本:2.0 增加安全通訊用戶名、密碼。
/// 2008.08.26 JiRiGaLa 版本:1.2 整理主鍵。
/// 2006.05.03 JiRiGaLa 版本:1.1 添加到工程項目中。
/// 2006.01.21 JiRiGaLa 版本:1.0 遠程傳遞參數用屬性才可以。
///
/// 版本:2.1
///
/// <author>
/// <name> JiRiGaLa </name>
/// <date> 2011.09.12 </date>
/// </author>
/// </summary>
[Serializable]
public class BaseUserInfo
{
public BaseUserInfo()
{
this.GetUserInfo();
}
/// <summary>
/// 遠程調用Service用戶名(為了提高軟件的安全性)
/// </summary>
private string serviceUserName = " Hairihan ";
public string ServiceUserName
{
get
{
return this.serviceUserName;
}
set
{
this.serviceUserName = value;
}
}
/// <summary>
/// 遠程調用Service密碼(為了提高軟件的安全性)
/// </summary>
private string servicePassword = " Hairihan ";
public string ServicePassword
{
get
{
return this.servicePassword;
}
set
{
this.servicePassword = value;
}
}
/// <summary>
/// 單點登錄唯一識別標識
/// </summary>
private string openId = string.Empty;
public string OpenId
{
get
{
return this.openId;
}
set
{
this.openId = value;
}
}
/// <summary>
/// 目標用戶
/// </summary>
private string targetUserId = string.Empty;
public string TargetUserId
{
get
{
return this.targetUserId;
}
set
{
this.targetUserId = value;
}
}
/// <summary>
/// 用戶主鍵
/// </summary>
private string id = string.Empty;
public string Id
{
get
{
return this.id;
}
set
{
this.id = value;
}
}
/// <summary>
/// 員工主鍵
/// </summary>
private string staffId = string.Empty;
public string StaffId
{
get
{
return this.staffId;
}
set
{
this.staffId = value;
}
}
/// <summary>
/// 用戶用戶名
/// </summary>
private string userName = string.Empty;
public string UserName
{
get
{
return this.userName;
}
set
{
this.userName = value;
}
}
/// <summary>
/// 用戶姓名
/// </summary>
private string realName = string.Empty;
public string RealName
{
get
{
return this.realName;
}
set
{
this.realName = value;
}
}
/// <summary>
/// 編號
/// </summary>
private string code = string.Empty;
public string Code
{
get
{
return this.code;
}
set
{
this.code = value;
}
}
/// <summary>
/// 當前的組織結構公司主鍵
/// </summary>
private int? companyId = null;
public int? CompanyId
{
get
{
return this.companyId;
}
set
{
this.companyId = value;
}
}
/// <summary>
/// 當前的組織結構公司編號
/// </summary>
private string companyCode = string.Empty;
public string CompanyCode
{
get
{
return this.companyCode;
}
set
{
this.companyCode = value;
}
}
/// <summary>
/// 當前的組織結構公司名稱
/// </summary>
private string companyName = string.Empty;
public string CompanyName
{
get
{
return this.companyName;
}
set
{
this.companyName = value;
}
}
/// <summary>
/// 當前的組織結構部門主鍵
/// </summary>
private int? departmentId = null;
public int? DepartmentId
{
get
{
return this.departmentId;
}
set
{
this.departmentId = value;
}
}
/// <summary>
/// 當前的組織結構部門編號
/// </summary>
private string departmentCode = string.Empty;
public string DepartmentCode
{
get
{
return this.departmentCode;
}
set
{
this.departmentCode = value;
}
}
/// <summary>
/// 當前的組織結構部門名稱
/// </summary>
private string departmentName = string.Empty;
public string DepartmentName
{
get
{
return this.departmentName;
}
set
{
this.departmentName = value;
}
}
/// <summary>
/// 當前的組織結構工作組主鍵
/// </summary>
private int? workgroupId = null;
public int? WorkgroupId
{
get
{
return this.workgroupId;
}
set
{
this.workgroupId = value;
}
}
/// <summary>
/// 當前的組織結構工作組編號
/// </summary>
private string workgroupCode = string.Empty;
public string WorkgroupCode
{
get
{
return this.workgroupCode;
}
set
{
this.workgroupCode = value;
}
}
/// <summary>
/// 當前的組織結構工作組名稱
/// </summary>
private string workgroupName = string.Empty;
public string WorkgroupName
{
get
{
return this.workgroupName;
}
set
{
this.workgroupName = value;
}
}
/// <summary>
/// 默認角色
/// </summary>
private int? roleId = null;
public int? RoleId
{
get
{
return this.roleId;
}
set
{
this.roleId = value;
}
}
/// <summary>
/// 安全級別
/// </summary>
private int securityLevel = 0;
public int SecurityLevel
{
get
{
return this.securityLevel;
}
set
{
this.securityLevel = value;
}
}
/// <summary>
/// 默認角色名稱
/// </summary>
private string roleName = string.Empty;
public string RoleName
{
get
{
return this.roleName;
}
set
{
this.roleName = value;
}
}
/// <summary>
/// 是否超級管理員
/// </summary>
private bool isAdministrator = false;
public bool IsAdministrator
{
get
{
return this.isAdministrator;
}
set
{
this.isAdministrator = value;
}
}
/// <summary>
/// 密碼
/// </summary>
private string password = string.Empty;
public string Password
{
get
{
return this.password;
}
set
{
this.password = value;
}
}
/// <summary>
/// IP地址
/// </summary>
private string ipAddress = string.Empty;
public string IPAddress
{
get
{
return this.ipAddress;
}
set
{
this.ipAddress = value;
}
}
/// <summary>
/// MAC地址
/// </summary>
private string macAddress = string.Empty;
public string MACAddress
{
get
{
return this.macAddress;
}
set
{
this.macAddress = value;
}
}
/// <summary>
/// 當前語言選擇
/// </summary>
private string currentLanguage = string.Empty;
public string CurrentLanguage
{
get
{
return this.currentLanguage;
}
set
{
this.currentLanguage = value;
}
}
/// <summary>
/// 當前布局風格選擇
/// </summary>
private string themes = string.Empty;
public string Themes
{
get
{
return this.themes;
}
set
{
this.themes = value;
}
}
/// <summary>
/// 描述
/// </summary>
private string description = string.Empty;
public string Description
{
get
{
return this.description;
}
set
{
this.description = value;
}
}
#region public void GetUserInfo()
/// <summary>
/// 獲取信息
/// </summary>
public void GetUserInfo()
{
this.ServiceUserName = BaseSystemInfo.ServiceUserName;
this.ServicePassword = BaseSystemInfo.ServicePassword;
this.CurrentLanguage = BaseSystemInfo.CurrentLanguage;
this.Themes = BaseSystemInfo.Themes;
}
#endregion
}
}
// All Rights Reserved , Copyright (C) 2011 , Hairihan TECH, Ltd.
// -----------------------------------------------------------------
using System;
namespace DotNet.Utilities
{
/// <summary>
/// BaseUserInfo
/// 用戶類
///
/// 修改紀錄
///
/// 2011.09.12 JiRiGaLa 版本:2.1 公司名稱、部門名稱、工作組名稱進行重構。
/// 2011.05.11 JiRiGaLa 版本:2.0 增加安全通訊用戶名、密碼。
/// 2008.08.26 JiRiGaLa 版本:1.2 整理主鍵。
/// 2006.05.03 JiRiGaLa 版本:1.1 添加到工程項目中。
/// 2006.01.21 JiRiGaLa 版本:1.0 遠程傳遞參數用屬性才可以。
///
/// 版本:2.1
///
/// <author>
/// <name> JiRiGaLa </name>
/// <date> 2011.09.12 </date>
/// </author>
/// </summary>
[Serializable]
public class BaseUserInfo
{
public BaseUserInfo()
{
this.GetUserInfo();
}
/// <summary>
/// 遠程調用Service用戶名(為了提高軟件的安全性)
/// </summary>
private string serviceUserName = " Hairihan ";
public string ServiceUserName
{
get
{
return this.serviceUserName;
}
set
{
this.serviceUserName = value;
}
}
/// <summary>
/// 遠程調用Service密碼(為了提高軟件的安全性)
/// </summary>
private string servicePassword = " Hairihan ";
public string ServicePassword
{
get
{
return this.servicePassword;
}
set
{
this.servicePassword = value;
}
}
/// <summary>
/// 單點登錄唯一識別標識
/// </summary>
private string openId = string.Empty;
public string OpenId
{
get
{
return this.openId;
}
set
{
this.openId = value;
}
}
/// <summary>
/// 目標用戶
/// </summary>
private string targetUserId = string.Empty;
public string TargetUserId
{
get
{
return this.targetUserId;
}
set
{
this.targetUserId = value;
}
}
/// <summary>
/// 用戶主鍵
/// </summary>
private string id = string.Empty;
public string Id
{
get
{
return this.id;
}
set
{
this.id = value;
}
}
/// <summary>
/// 員工主鍵
/// </summary>
private string staffId = string.Empty;
public string StaffId
{
get
{
return this.staffId;
}
set
{
this.staffId = value;
}
}
/// <summary>
/// 用戶用戶名
/// </summary>
private string userName = string.Empty;
public string UserName
{
get
{
return this.userName;
}
set
{
this.userName = value;
}
}
/// <summary>
/// 用戶姓名
/// </summary>
private string realName = string.Empty;
public string RealName
{
get
{
return this.realName;
}
set
{
this.realName = value;
}
}
/// <summary>
/// 編號
/// </summary>
private string code = string.Empty;
public string Code
{
get
{
return this.code;
}
set
{
this.code = value;
}
}
/// <summary>
/// 當前的組織結構公司主鍵
/// </summary>
private int? companyId = null;
public int? CompanyId
{
get
{
return this.companyId;
}
set
{
this.companyId = value;
}
}
/// <summary>
/// 當前的組織結構公司編號
/// </summary>
private string companyCode = string.Empty;
public string CompanyCode
{
get
{
return this.companyCode;
}
set
{
this.companyCode = value;
}
}
/// <summary>
/// 當前的組織結構公司名稱
/// </summary>
private string companyName = string.Empty;
public string CompanyName
{
get
{
return this.companyName;
}
set
{
this.companyName = value;
}
}
/// <summary>
/// 當前的組織結構部門主鍵
/// </summary>
private int? departmentId = null;
public int? DepartmentId
{
get
{
return this.departmentId;
}
set
{
this.departmentId = value;
}
}
/// <summary>
/// 當前的組織結構部門編號
/// </summary>
private string departmentCode = string.Empty;
public string DepartmentCode
{
get
{
return this.departmentCode;
}
set
{
this.departmentCode = value;
}
}
/// <summary>
/// 當前的組織結構部門名稱
/// </summary>
private string departmentName = string.Empty;
public string DepartmentName
{
get
{
return this.departmentName;
}
set
{
this.departmentName = value;
}
}
/// <summary>
/// 當前的組織結構工作組主鍵
/// </summary>
private int? workgroupId = null;
public int? WorkgroupId
{
get
{
return this.workgroupId;
}
set
{
this.workgroupId = value;
}
}
/// <summary>
/// 當前的組織結構工作組編號
/// </summary>
private string workgroupCode = string.Empty;
public string WorkgroupCode
{
get
{
return this.workgroupCode;
}
set
{
this.workgroupCode = value;
}
}
/// <summary>
/// 當前的組織結構工作組名稱
/// </summary>
private string workgroupName = string.Empty;
public string WorkgroupName
{
get
{
return this.workgroupName;
}
set
{
this.workgroupName = value;
}
}
/// <summary>
/// 默認角色
/// </summary>
private int? roleId = null;
public int? RoleId
{
get
{
return this.roleId;
}
set
{
this.roleId = value;
}
}
/// <summary>
/// 安全級別
/// </summary>
private int securityLevel = 0;
public int SecurityLevel
{
get
{
return this.securityLevel;
}
set
{
this.securityLevel = value;
}
}
/// <summary>
/// 默認角色名稱
/// </summary>
private string roleName = string.Empty;
public string RoleName
{
get
{
return this.roleName;
}
set
{
this.roleName = value;
}
}
/// <summary>
/// 是否超級管理員
/// </summary>
private bool isAdministrator = false;
public bool IsAdministrator
{
get
{
return this.isAdministrator;
}
set
{
this.isAdministrator = value;
}
}
/// <summary>
/// 密碼
/// </summary>
private string password = string.Empty;
public string Password
{
get
{
return this.password;
}
set
{
this.password = value;
}
}
/// <summary>
/// IP地址
/// </summary>
private string ipAddress = string.Empty;
public string IPAddress
{
get
{
return this.ipAddress;
}
set
{
this.ipAddress = value;
}
}
/// <summary>
/// MAC地址
/// </summary>
private string macAddress = string.Empty;
public string MACAddress
{
get
{
return this.macAddress;
}
set
{
this.macAddress = value;
}
}
/// <summary>
/// 當前語言選擇
/// </summary>
private string currentLanguage = string.Empty;
public string CurrentLanguage
{
get
{
return this.currentLanguage;
}
set
{
this.currentLanguage = value;
}
}
/// <summary>
/// 當前布局風格選擇
/// </summary>
private string themes = string.Empty;
public string Themes
{
get
{
return this.themes;
}
set
{
this.themes = value;
}
}
/// <summary>
/// 描述
/// </summary>
private string description = string.Empty;
public string Description
{
get
{
return this.description;
}
set
{
this.description = value;
}
}
#region public void GetUserInfo()
/// <summary>
/// 獲取信息
/// </summary>
public void GetUserInfo()
{
this.ServiceUserName = BaseSystemInfo.ServiceUserName;
this.ServicePassword = BaseSystemInfo.ServicePassword;
this.CurrentLanguage = BaseSystemInfo.CurrentLanguage;
this.Themes = BaseSystemInfo.Themes;
}
#endregion
}
}