Feat: Sub-license count limit - LicenseLimit field in licenses.ini + context menu
- Add LicenseLimit field to LicenseInfo struct (0 = not set, unlimited) - Add GetLicenseLimit/SetLicenseLimit: read/write LicenseLimit key in licenses.ini - Append |lic:N to reserved field in TOKEN_AUTH response only when LicenseLimit > 0; absent |lic: means no limit (client defaults to 9999), so super admin authenticating to its own server is never falsely terminated - Add "Sub-license limit" item in CLicenseDlg right-click menu (1-9999, empty = clear limit); menu label shows current value in real time - Limit change takes effect when sub-client re-authenticates Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,7 @@ struct LicenseInfo {
|
||||
std::string PendingExpireDate; // 预设的新过期日期(如 20270221,空表示无预设)
|
||||
int PendingHostNum = 0; // 预设的并发连接数
|
||||
int PendingQuota = 0; // 预设的配额数量(支持多机器续期)
|
||||
int LicenseLimit = 0; // 下级数量上限(0=未设置,下发时默认10)
|
||||
};
|
||||
|
||||
// 续期信息结构体
|
||||
@@ -99,6 +100,7 @@ public:
|
||||
afx_msg void OnLicenseDelete();
|
||||
afx_msg void OnLicenseAutoFrp();
|
||||
afx_msg void OnLicenseRevokeFrp();
|
||||
afx_msg void OnLicenseSetLimit();
|
||||
};
|
||||
|
||||
// 获取所有授权信息
|
||||
@@ -130,5 +132,10 @@ int GetIPCountFromList(const std::string& ipListStr);
|
||||
std::string GetFirstIPFromList(const std::string& ipListStr);
|
||||
std::string FormatIPDisplay(const std::string& ipListStr); // 格式化显示: "[3] 192.168.1.1, ..."
|
||||
|
||||
// 下级数量限制(写 licenses.ini;读取见 GetLicenseLimit)
|
||||
bool SetLicenseLimit(const std::string& deviceID, int limit);
|
||||
// 读取下级数量上限;0 = 未设置,调用方应视为 10(默认值)
|
||||
int GetLicenseLimit(const std::string& deviceID);
|
||||
|
||||
// 检查 IP+机器名 是否在授权数据库中存在
|
||||
bool FindLicenseByIPAndMachine(const std::string& ip, const std::string& machineName, std::string* outSN = nullptr);
|
||||
|
||||
Reference in New Issue
Block a user