Commit 8e93e3be authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Merged revision(s) 66270 from AVS/Sources/TeamlabOffice/branches/server_3.5.0-212_CanBranding:

canBranding для всех false, кроме тех, у кого есть лицензия, пусть даже и просроченная
........


git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66316 954022d7-b5bf-4e40-9824-e11837661b57
parent 91cfb395
"use strict";
var g_oLicenseResult = {
Error : 1,
Expired : 2,
Success : 3
};
var g_sLicenseDefaultUrl = "/license";
var g_sPublicRSAKey = '-----BEGIN CERTIFICATE-----MIIBvTCCASYCCQD55fNzc0WF7TANBgkqhkiG9w0BAQUFADAjMQswCQYDVQQGEwJKUDEUMBIGA1UEChMLMDAtVEVTVC1SU0EwHhcNMTAwNTI4MDIwODUxWhcNMjAwNTI1MDIwODUxWjAjMQswCQYDVQQGEwJKUDEUMBIGA1UEChMLMDAtVEVTVC1SU0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANGEYXtfgDRlWUSDn3haY4NVVQiKI9CzThoua9+DxJuiseyzmBBe7Roh1RPqdvmtOHmEPbJ+kXZYhbozzPRbFGHCJyBfCLzQfVos9/qUQ88u83b0SFA2MGmQWQAlRtLy66EkR4rDRwTj2DzR4EEXgEKpIvo8VBs/3+sHLF3ESgAhAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAEZ6mXFFq3AzfaqWHmCy1ARjlauYAa8ZmUFnLm0emg9dkVBJ63aEqARhtok6bDQDzSJxiLpCEF6G4b/Nv/M/MLyhP+OoOTmETMegAVQMq71choVJyOFE5BtQa6M/lCHEOya5QUfoRF2HF9EjRF44K3OK+u3ivTSj3zwjtpudY5Xo=-----END CERTIFICATE-----';
......@@ -7,7 +13,7 @@ function CheckLicense(licenseUrl, customerId, userId, userFirstName, userLastNam
licenseUrl = licenseUrl ? licenseUrl : g_sLicenseDefaultUrl;
g_fGetJSZipUtils().getBinaryContent(licenseUrl, function(err, data) {
if (err) {
callback(true, false);
callback(true, g_oLicenseResult.Error);
return;
}
......@@ -27,9 +33,9 @@ function CheckLicense(licenseUrl, customerId, userId, userFirstName, userLastNam
var x509 = new X509();
x509.readCertPEM(g_sPublicRSAKey);
var isValid = x509.subjectPublicKeyRSA.verifyString(JSON.stringify(oLicense), hSig);
callback(false, isValid ? CheckUserInLicense(customerId, userId, userFirstName, userLastName, oLicense) : false);
callback(false, isValid ? CheckUserInLicense(customerId, userId, userFirstName, userLastName, oLicense) : g_oLicenseResult.Error);
} catch (e) {
callback(true, false);
callback(true, g_oLicenseResult.Error);
}
});
}
......@@ -43,7 +49,7 @@ function CheckLicense(licenseUrl, customerId, userId, userFirstName, userLastNam
* @returns {boolean}
*/
function CheckUserInLicense(customerId, userId, userFirstName, userLastName, oLicense) {
var res = false;
var res = g_oLicenseResult.Error;
var superuser = 'onlyoffice';
try {
if (oLicense['users']) {
......@@ -56,11 +62,11 @@ function CheckUserInLicense(customerId, userId, userFirstName, userLastName, oLi
}
if (checkUserHash) {
var endDate = new Date(oLicense['end_date']);
res = endDate >= new Date();
res = (endDate >= new Date()) ? g_oLicenseResult.Success : g_oLicenseResult.Expired;
}
}
} catch (e) {
res = false;
res = g_oLicenseResult.Error;
}
return res;
}
......
......@@ -20,30 +20,14 @@
* @memberOf Asc
*/
function asc_CAscEditorPermissions (settings) {
if ( !(this instanceof asc_CAscEditorPermissions) ) {
return new asc_CAscEditorPermissions();
}
if(settings) {
this.canLicense = settings["canLicense"];
this.canEdit = settings["canEdit"];
this.canDownload = settings["canDownload"];
this.canCoAuthoring = settings["canCoAuthoring"];
this.canReaderMode = settings["canReaderMode"];
this.canBranding = settings["canBranding"];
this.isAutosaveEnable = settings["isAutosaveEnable"];
this.AutosaveMinInterval = settings["AutosaveMinInterval"];
this.isAnalyticsEnable = settings["isAnalyticsEnable"];
} else {
this.canEdit = true;
this.canDownload = true;
this.canCoAuthoring = true;
this.canReaderMode = true;
this.canBranding = true;
this.isAutosaveEnable = true;
this.AutosaveMinInterval = 300;
this.isAnalyticsEnable = false;
}
this.canEdit = true;
this.canDownload = true;
this.canCoAuthoring = true;
this.canReaderMode = true;
this.canBranding = false;
this.isAutosaveEnable = true;
this.AutosaveMinInterval = 300;
this.isAnalyticsEnable = false;
return this;
}
......@@ -61,15 +45,7 @@
asc_getIsAnalyticsEnable: function(){ return this.isAnalyticsEnable; },
asc_setCanLicense: function(v){ this.canLicense = v; },
asc_setCanEdit: function(v){ this.canEdit = v; },
asc_setCanDownload: function(v){ this.canDownload = v; },
asc_setCanCoAuthoring: function(v){ this.canCoAuthoring = v; },
asc_setCanReaderMode: function(v){ this.canReaderMode = v; },
asc_setCanBranding: function(v){ this.canBranding = v; },
asc_setIsAutosaveEnable: function(v){ this.isAutosaveEnable = v; },
asc_setAutosaveMinInterval: function(v){ this.AutosaveMinInterval = v; },
asc_setIsAnalyticsEnable: function(v){ this.isAnalyticsEnable = v; }
asc_setCanBranding: function(v){ this.canBranding = v; }
};
/*
......
......@@ -30,14 +30,15 @@
});
} else {
// Фиктивный вызов
this._onCheckLicenseEnd(true, false);
this._onCheckLicenseEnd(true, g_oLicenseResult.Error);
}
this._coAuthoringInit();
};
asc['spreadsheet_api'].prototype._onEndPermissions = function() {
if (null !== this.licenseResult && this.isOnFirstConnectEnd) {
var oResult = new asc.asc_CAscEditorPermissions();
oResult.asc_setCanLicense(this.licenseResult.res);
oResult.asc_setCanLicense(g_oLicenseResult.Success === this.licenseResult.res);
oResult.asc_setCanBranding(g_oLicenseResult.Error !== this.licenseResult.res); // Для тех, у кого есть лицензия, branding доступен
this.handlers.trigger('asc_onGetEditorPermissions', oResult);
}
};
......
......@@ -14,14 +14,15 @@ asc_docs_api.prototype.asc_getEditorPermissions = function(licenseUrl, customerI
});
} else {
// Фиктивный вызов
this._onCheckLicenseEnd(true, false);
this._onCheckLicenseEnd(true, g_oLicenseResult.Error);
}
this._coAuthoringInit();
};
asc_docs_api.prototype._onEndPermissions = function() {
if (null !== this.licenseResult && this.isOnFirstConnectEnd) {
var oResult = new window['Asc'].asc_CAscEditorPermissions();
oResult.asc_setCanLicense(this.licenseResult.res);
oResult.asc_setCanLicense(g_oLicenseResult.Success === this.licenseResult.res);
oResult.asc_setCanBranding(g_oLicenseResult.Error !== this.licenseResult.res); // Для тех, у кого есть лицензия, branding доступен
this.asc_fireCallback('asc_onGetEditorPermissions', oResult);
}
};
\ No newline at end of file
......@@ -7,7 +7,7 @@
*/
/**
*
*
* @constructor
* @extends {CCollaborativeEditingBase}
*/
......
......@@ -15,14 +15,15 @@ asc_docs_api.prototype.asc_getEditorPermissions = function(licenseUrl, customerI
});
} else {
// Фиктивный вызов
this._onCheckLicenseEnd(true, false);
this._onCheckLicenseEnd(true, g_oLicenseResult.Error);
}
this._coAuthoringInit();
};
asc_docs_api.prototype._onEndPermissions = function() {
if (null !== this.licenseResult && this.isOnFirstConnectEnd) {
var oResult = new window['Asc'].asc_CAscEditorPermissions();
oResult.asc_setCanLicense(this.licenseResult.res);
oResult.asc_setCanLicense(g_oLicenseResult.Success === this.licenseResult.res);
oResult.asc_setCanBranding(g_oLicenseResult.Error !== this.licenseResult.res); // Для тех, у кого есть лицензия, branding доступен
this.asc_fireCallback('asc_onGetEditorPermissions', oResult);
}
};
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment