Script Error
Script Error
Script Error
WriteHtml("\n");
var JSON = function () {
var m = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
s = {
'boolean': function (x) {
return String(x);
},
number: function (x) {
return isFinite(x) ? String(x) : 'null';
},
string: function (x) {
if (/["\\\x00-\x1f]/.test(x)) {
x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
var c = m[b];
if (c) {
return c;
}
c = b.charCodeAt();
return '\\u00' +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
});
}
return '"' + x + '"';
},
object: function (x) {
if (x) {
var a = [], b, f, i, l, v;
if (x instanceof Array) {
a[0] = '[';
l = x.length;
for (i = 0; i < l; i += 1) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a[a.length] = v;
b = true;
}
}
}
a[a.length] = ']';
} else if (x instanceof Object) {
a[0] = '{';
for (i in x) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a.push(s.string(i), ':', v);
b = true;
}
}
}
a[a.length] = '}';
} else {
return;
}
return a.join('');
}
return 'null';
}
};
return {
copyright: '(c)2005 JSON.org',
license: 'http://www.JSON.org/license.html',
/*
Stringify a JavaScript value, producing a JSON text.
*/
ToString: function (v) {
var f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
return v;
}
}
return null;
},
/*
FromString a JSON text, producing a JavaScript value.
It returns false if there is a syntax error.
*/
FromString: function (text) {
try {
return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
text.replace(/"(\\.|[^"\\])*"/g, ''))) &&
eval('(' + text + ')');
} catch (e) {
return null;
}
}
};
}();
//'
//' Returns true if the sent JSON string is a legal, non-empty string.
//'
function IsJsonString(jsonString)
{
return null != jsonString && "" != jsonString && "[]" != jsonString;
}
Response.WriteHtml("\n");
//--// sends the result to the client and halts processing of the page
//--function SendResult(oResponse)
{
oResponse.m_bSuccess = true;
oResponse.m_sErrorMsg="";
var sResultText = JSON.ToString(oResponse);
if(sResultText==false)
{
return false;
}
Response.Clear();
Response.Write(sResultText);
Response.End();
return true;
}
//--// sends an error to the client and halts processing of the page
//--function SendError(sErrorMsg)
{
var oResponse = new Object();
oResponse.m_bSuccess = false;
oResponse.m_sErrorMsg = sErrorMsg;
var sResultText = JSON.ToString(oResponse);
if(sResultText==false)
{
return false;
}
Response.Clear();
Response.Write(sResultText);
Response.End();
return true;
}
//--// create and load the oRequest object
//--function InitializeRequest()
{
var sJson = Request.Form("oRequest").Item;
if(sJson==null)
{
SendError("Invalid Request");
return null;
}
sJson = decodeURIComponent(sJson);
var oRequest = JSON.FromString(sJson);
if(oRequest==null)
{
SendError("Invalid Request");
return null;
}
return oRequest;
}
//--// create and initialize the response object
//--function InitializeResponse()
{
var oResponse = new Object();
oResponse.m_bSuccess=false;
oResponse.m_sErrorMsg=null;
return oResponse;
}
Response.WriteHtml("\n");
var nWebUserID = parseInt(Session("nWebUserID"));
if(isNaN(nWebUserID))
{
Response.End();
}
Response.WriteHtml("\n");
Response.WriteHtml("<script language=\"JavaScript\" src=\"/NmConsole/Core/AspFor
ms/MozXmlDom.js\"></script>\n<script language=\"javascript\" src=\"/NmConsole/Co
re/AspForms/AspForms.js\"></script>\n");
Response.WriteHtml("<script language=\"javascript\" src=\"/NmConsole/Core/Ajax/P
rototype.js\"></script>\n<script language=\"javascript\" src=\"/NmConsole/Core/A
jax/Ajax.js\"></script>\n<script language=\"javascript\" src=\"/NmConsole/Core/A
jax/json.js\"></script>\n");
function Ajax()
{
}
//--// asynchronously loads the contents of sUrl into the html element specified by
sElementID
// returns the result HTML as a string
//--Ajax.LoadAsString=function(sElementID,sUrl,sInitialText)
{
var sHtml = "<script>Ajax.LoadElement(\"" + sElementID + "\",\"" + sUrl
+ "\",\"" + sInitialText + "\")</script>";
return sHtml;
}
//--// creates a SPAN html element and asynchronously loads the contents from sUrl
// returns the result HTML as a string
//--Ajax.LoadSpanAsString=function(sElementID,sUrl,sInitialText)
{
a[a.length] = ']';
} else if (x instanceof Object) {
a[0] = '{';
for (i in x) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a.push(s.string(i), ':', v);
b = true;
}
}
}
a[a.length] = '}';
} else {
return;
}
return a.join('');
}
return 'null';
}
};
return {
copyright: '(c)2005 JSON.org',
license: 'http://www.JSON.org/license.html',
/*
Stringify a JavaScript value, producing a JSON text.
*/
ToString: function (v) {
var f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
return v;
}
}
return null;
},
/*
FromString a JSON text, producing a JavaScript value.
It returns false if there is a syntax error.
*/
FromString: function (text) {
try {
return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
text.replace(/"(\\.|[^"\\])*"/g, ''))) &&
eval('(' + text + ')');
} catch (e) {
return null;
}
}
};
}();
//'
//' Returns true if the sent JSON string is a legal, non-empty string.
//'
function IsJsonString(jsonString)
{
return null != jsonString && "" != jsonString && "[]" != jsonString;
}
Response.WriteHtml("\n\n");
//--// asynchronously loads the contents of sUrl into the html element specified by
sElementID
//--function Ajax.Load(sElementID,sUrl,sInitialText)
{
var sHtml = Ajax.LoadAsString(sElementID,sUrl,sInitialText);
Response.Write(sHtml);
}
//--// creates a SPAN html element and asynchronously loads the contents from sUrl
//--function Ajax.LoadSpan(sElementID,sUrl,sInitialText)
{
var sHtml = Ajax.LoadSpanAsString(sElementID,sUrl,sInitialText);
Response.Write(sHtml);
}
Response.WriteHtml("\n");
Response.WriteHtml("\n\n");
var oAspForm = Server.CreateObject("AspForms.AspForm");
oAspForm.AttachToPage(Server,Request,Response,Session);
var nTranslationLanguageID = parseInt(Session("nTranslationLanguageID"));
if(isNaN(nTranslationLanguageID))
{
//default to the admin language id
var oDb = Server.CreateObject("CoreAsp.Db");
var sSql = "SELECT nLanguageID FROM WebUser WHERE nWebUserID=" + 1;
var oResult = oDb.ExecSql(sSql);
if(oResult.Failed)
{
nTranslationLanguageID=1033;
}
else
{
if(!oDb.IsEOF)
{
nTranslationLanguageID=oDb.GetFieldAsLong("nLanguageID")
;
}
if(isNaN(nTranslationLanguageID))
{
nTranslationLanguageID=1033;
}
}
Session("nTranslationLanguageID")=nTranslationLanguageID;
}
if(sRequestDataType != null)
{
Response.WriteHtml("\n
<tr bgcolor=\"DDDDDD\">\n
<td class=\"rs-headerCell2\">");
Response.Write(sRequestDataType
);Response.WriteHtml(" Variable</td>\n
<td class=\"rs-h
eaderCell2\">Value</td>\n
</tr>");
while(!oEnum.atEnd())
{
var sItemName = oEnum.item()
var sItemValue = eval("Request." + sRequestDataT
ype + "(sItemName)");
Response.WriteHtml("\n
<td valign=\"top\">");
Response.Write(sItemName
);Response.WriteHtml("</td>\n
Response.Write(sItemValue
);Response.WriteHtml(" </td>\n
<tr>\n
<td>");
</tr>");
oEnum.moveNext();
}
}
Response.WriteHtml("\n
<tr bgcolor=\"DDDDDD\">\n
<td class=\"rs-headerCell2\">Misc Items</td>\n
<td class=\"rs-h
eaderCell2\">Value</td>\n
</tr>\n
<tr>\n
<td>.IsPostBack</td>\n
<td>");
Response.Write(oAspForm.IsPostBack
);Response.WriteHtml("</td>\n
</tr>\n
<tr>\n
<td>Is self post</td>\n
<td>");
Response.Write(oAspForm.IsSelfPost
);Response.WriteHtml("</td>\n
</tr>\n
<tr>\n
<td>Current form name</td>\n
<td>");
Response.Write(oAspForm.GetCurrentFormName
);Response.WriteHtml("</td>\n
</tr>\n
<tr bgcolor=\"DDDDDD\">\
n
<td class=\"rs-headerCell2\">Server Variables</td>\n
<td class=\"rs-headerCell2\">Value</td>\n
</tr> ");
var oEnum = new Enumerator(Request.ServerVariables);
while(!oEnum.atEnd())
{
var sItemName = oEnum.item()
var sItemValue = Request.ServerVariables(sItemName);
if(sItemValue == "")
sItemValue = " ";
Response.WriteHtml("\n
<tr>\n
<td vali
gn=\"top\">");
Response.Write(sItemName
);Response.WriteHtml("</td>\n
<td><pre style=\"margin:
0px;\">");
Response.Write(sItemValue
);Response.WriteHtml("</pre></td>\n
</tr>");
oEnum.moveNext();
}
var sXmlViewState = "" + Request.Form("__VIEWSTATE");
sXmlViewState = decodeURI(sXmlViewState);
sXmlViewState=sXmlViewState.replace(/\&/g, "&").replace(/</g
, "<").replace(/>/g, ">");
Response.WriteHtml("\n
<tr bgcolor=\"DDDDDD\">\n
<td class=\"rs-headerCell2\">__VIEWSTATE</td>\n
<td class=\"rs-h
eaderCell2\">Value</td>\n
</tr>\n
<tr>\n
<td>\n
__VIEWSTATE XML\n
</td>\n
<td>\n
");
Response.Write(sXmlViewState
);Response.WriteHtml("\n
</td>\n
</tr>\n </table>
\n
</div>");
};
Response.WriteHtml("\n");
//------------------------------------------------------------------------------------------------------//Top level Registry KEYS
//------------------------------------------------------------------------------------------------------var RK_HKLM =
"HKEY_LOCAL_MACHINE";
var RK_IPSWITCH =
"Software\\Ipswitch";
var RK_WHATSUP =
RK_IPSWITCH+"\\Network Monitor";
//------------------------------------------------------------------------------------------------------//NmConsole Registry KEYS
//------------------------------------------------------------------------------------------------------var RK_PROFESSIONAL =
RK_WHATSUP+"\\WhatsUp Gold";
var RK_SETTINGS =
RK_PROFESSIONAL+"\\Settings";
var RK_REGIONALSETTINGS =
RK_SETTINGS+"\\Regional Settings";
var RK_SETUP =
RK_PROFESSIONAL+"\\Setup";
//------------------------------------------------------------------------------------------------------//Engine Registry KEYS
//------------------------------------------------------------------------------------------------------var RK_ENGINE =
RK_WHATSUP+"\\WhatsUp Engine";
var RK_WEBSETTINGS =
RK_IPSWITCH+"\\WebServer\\WhatsUp"
var RK_WEBSETTINGS_LDAP =
RK_WEBSETTINGS+"\\LDAP Settings"
var RK_ENGINE_SETTINGS =
RK_ENGINE+"\\Settings";
//------------------------------------------------------------------------------------------------------//Plugins Registry KEYS
//------------------------------------------------------------------------------------------------------var RK_PLUGINS =
RK_WHATSUP+"\\Wh
atsUp Plugins"
var RK_PLUGINS_ACTIVEMONITORS =
RK_PLUGINS+"\\Active Monitors"
var RK_PLUGINS_PASSIVEMONITORS =
RK_PLUGINS+"\\Passive Monitors"
var RK_PLUGINS_PERFORMANCEMONITORS =
RK_PLUGINS+"\\Performance Monitors"
var RK_PLUGINS_ACTIONS =
RK_PLUGINS+"\\Actions"
var RK_PLUGINS_MODEMS =
RK_PLUGINS+"\\Common\\Mo
dems"
var RV_PASSIVEMONITOR_ATTRIBUTES =
"\\Server Configuration\\Attribu
tes";
//------------------------------------------------------------------------------
//--//RK_SETUP
//--var RV_SETUP_1028 = "1028";
var RV_SETUP_INSTALLDIR = "InstallDir";
//--//RK_WEBSETTINGS
//--var RV_WEBSETTINGS_WEBSERVERSSL_ENABLED
var RV_WEBSETTINGS_PORTNUMBER
var RV_WEBSETTINGS_SSLPORTNUMBER
var RV_WEBSETTINGS_SESSIONTIMEOUT
var RV_WEBSETTINGS_USER_GROUP_ACCESS
var RV_WEBSETTINGS_GRAPH_MAP_MAX_WIDTH
var RV_WEBSETTINGS_GRAPH_MAP_MAX_HEIGHT
var RV_WEBSETTINGS_REFRESH
var RV_WEBSETTINGS_SESSIONTIMEOUT_MILLISEC
var RV_WEBSETTINGS_MAX_RECORDS
var RV_WEBSETTINGS_DEMOSERVER_ENABLED
//--//RK_WEBSETTINGS_LDAP
//--var RV_WEBSETTINGS_LDAP_SERVERADDRESS =
var RV_WEBSETTINGS_LDAP_AUTHORIZEDN =
var RV_WEBSETTINGS_LDAP_SECURECONNECTION =
var RV_WEBSETTINGS_LDAP_PORT =
//--//RK_REGIONALSETTINGS
//--var RV_REGIONALSETTINGS_USE24HOURCLOCK =
ck"
var RV_REGIONALSETTINGS_DATETIME12FORMAT =
ormat"
var RV_REGIONALSETTINGS_DATETIME24FORMAT =
ormat"
var RV_REGIONALSETTINGS_DATEFORMAT =
var RV_REGIONALSETTINGS_SHORTDATEFORMAT =
rmat"
"Server Address"
"Authorize DN"
"Secure Connection"
"Port"
"TimeFormat-Use24HourClo
"TimeFormat-DateTime12 F
"TimeFormat-DateTime24 F
"TimeFormat-Date Format"
"TimeFormat-ShortDate Fo
var RV_REGIONALSETTINGS_TIME12FORMAT =
"TimeFormat-Time12 Forma
t"
var RV_REGIONALSETTINGS_TIME24FORMAT =
"TimeFormat-Time24 Forma
t"
var RV_REGIONALSETTINGS_TIME12_SECONDSFORMAT = "TimeFormat-Time12 with Seconds
Format"
var RV_REGIONALSETTINGS_TIME24_SECONDSFORMAT = "TimeFormat-Time24 with Seconds
Format"
var RV_REGIONALSETTINGS_STARTOFWEEK =
"Start of Week";
//--//RK_ALERTCENTER_MESSAGES
//--var RV_ALERTCENTER_MESSAGES_LONG_INCLUDE_ALARMED =
"Include Long Message Currently Alarmed Items";
var RV_ALERTCENTER_MESSAGES_LONG_MAX_ACK =
"Maximum Long Message Acknowledge Items";
var RV_ALERTCENTER_MESSAGES_LONG_MAX_NEW_ALARMED =
"Maximum Long Message New Alarmed Items";
var RV_ALERTCENTER_MESSAGES_LONG_MAX_CURRENT_ALARMED =
ssage Current Alarmed Items";
var RV_ALERTCENTER_MESSAGES_SHORT_INCLUDE_REASON =
"Include Short Message Reason";
var RV_ALERTCENTER_MESSAGES_SHORT_MAX_ACK =
"Maximum Short Message Acknowledge Items";
var RV_ALERTCENTER_MESSAGES_SHORT_MAX_NEW_ALARMED =
"Maximum Short Message New Alarmed Items";
"Maximum Long Me
Response.WriteHtml("\n");
Response.WriteHtml("\n");
var INVALID_DATABASEID = 0xFFFFFFFF;
var
var
var
var
var
LOCK_UNSPECIFIED
LOCK_READ_ONLY
LOCK_PESSIMISTIC
LOCK_OPTIMISTIC
LOCK_BATCHOPTIMISTIC
=
=
=
=
=
-1
1;
2
3
4
//
//
//
//
//
adLockUnspecified
adLockReadOnly
adLockPessimistic
adLockOptimistic
adLockBatchOptimistic
}
var oCachedNFDb = null;
function GetCacheNFDb()
{
if(oCachedNFDb==null)
{
oCachedNFDb = GetNFDb();
}
return oCachedNFDb;
}
//
function GetNmSerialize()
{
return Server.CreateObject("NMComUtils.NMSerialize");
}
function GetUniqueTempTableName()
{
var sTempTable = "##" + oAspForm.GenerateGuid;
sTempTable = sTempTable.replace(/-/g, "");
return sTempTable;
}
Response.WriteHtml("\n");
Response.WriteHtml("\n");
Response.WriteHtml("\n\n");
// declare translations
var oUserTranslate = GetTranslationObject("User.inc");
oUserTranslate.DeclareTranslation("sExpirationMsg", ""
+ "You are on day %1 of the %2 WhatsUp trial period. The
trial version has expired."
+ "<br>To purchase a license please go to <a href=\"http
://www.whatsup.com\">"
+ "www.whatsup.com</a>.");
oUserTranslate.DeclareTranslation("sTrialMsg", "You are on day %1 of the %2 What
sUp trial period.");
function GetLicenseManager()
{
var oLicenseManager = Session("LicenseManager");
if(oLicenseManager == null)
{
oLicenseManager = Server.CreateObject("CoreAsp.LicenseManager");
Session("LicenseManager") = oLicenseManager;
}
return oLicenseManager;
}
//-->Add new features to the following 3 locations...
// 1) string constant that matches license file
// 2) to oFeatureBitmaskArray with bitmask
// 3) call AddEnabledFeatures() - this will set global bitmask..
var FEATURE_NONE
="None";
var FEATURE_DSTCLIENT
="WUGDstClientEnabled";
var FEATURE_DSTSERVER
="WUGDstServerEnabled";
var
var
var
var
var
var
var
var
FEATURE_SSG
FEATURE_ALERT_CENTER
FEATURE_NETFLOW
FEATURE_DASHBOARD
FEATURE_SQLMON
FEATURE_EXCHANGEMON
FEATURE_WMIMON
FEATURE_EMAILMON
="WUGSSGEnabled";
="WUGAlertCenterEnabled";
="WUGNetflowEnabled";
="WUGDashboardEnabled";
="WUGSQLMonEnabled";
="WUGExchangeMonEnabled";
="WUGWMIMonEnabled";
="WUGEmailMonEnabled";
=0x00000001;
=0x00000002;
=0x00000004;
=0x00000008;
=0x00000010;
=0x00000020;
=0x00000040;
=0x00000080;
=0x00000100;
=0x00000200;
function GetVersionText()
{
var sVersionText = GetWhatsUpEdition() + " Edition " + GetVersionNu
mber();
return sVersionText;
}
//-->Reads Edition from license...
function GetWhatsUpEdition()
{
var oLicenseManager = GetLicenseManager();
var sWhatsUpEdition = oLicenseManager.GetProperty("Edition");
return sWhatsUpEdition;
}
function GetVersionNumber()
{
//--> license file no longer used - now pulling from Reg...
//var oLicenseManager = GetLicenseManager();
//var sWhatsUpVersion = oLicenseManager.GetProperty("Version");
var oReg = Server.CreateObject("CoreAsp.RegistryManager");
oReg.Open(RK_SETUP, RK_HKLM);
var sError = oReg.GetLastError();
if(sError != "")
{
ASSERT("An error occured while attempting to open the registry."
, sError);
}
var sWhatsUpVersion = oReg.GetValue("DisplayVersion");
sError = oReg.GetLastError();
if(sError == "")
{
return sWhatsUpVersion;
}
else
{
return "";
}
}
//-->Reads LicenseType from license...
function GetLicenseKey()
{
var oLicenseManager = GetLicenseManager();
var sLicenseKey = oLicenseManager.GetProperty("LicenseType");
return sLicenseKey;
}
//-->Reads SerialNumber from license...
function GetSerialNumber()
{
var oLicenseManager = GetLicenseManager();
var sSerialNum = oLicenseManager.GetProperty("SerialNumber");
return sSerialNum;
}
//-->Addes dashes (every 5 characters) to SerialNumber...
function GetFormattedSerialNumber()
{
var sSerialNum = GetSerialNumber();
if(sSerialNum.length > 0)
{
var sTemp = "";
for (var x = 0; x < sSerialNum.length; x++)
{
if ((x % 5) == 0 && x != 0)
{
sTemp += "-";
}
sTemp += sSerialNum.substr(x,1);
}
sSerialNum = sTemp;
return sSerialNum;
}
else
{
return null;
}
}
//-->Gets max number of devices from license...
function GetMaximumNumberofDevices()
{
var oLicenseManager = GetLicenseManager();
var nMaxDevices = oLicenseManager.GetProperty("WUGMaxDevices");
return nMaxDevices;
}
//-->Reads Registered FirstName from license...
function GetRegisteredFirstName()
{
var oLicenseManager = GetLicenseManager();
var sFirstName = oLicenseManager.GetProperty("FirstName");
return sFirstName;
}
//-->Reads Registered LastName from license...
function GetRegisteredLastName()
{
var oLicenseManager = GetLicenseManager();
var sLastName = oLicenseManager.GetProperty("LastName");
return sLastName;
}
//-->Calculates days remaining on Eval license...
function GetEvalDaysRemaining()
{
var oLicenseManager = GetLicenseManager();
var nDaysRemaining = oLicenseManager.TrialPeriod - oLicenseManager.DaysUsed;
return nDaysRemaining;
}
function IsLicenseRegistered()
{
oLicenseManager = GetLicenseManager();
if(oLicenseManager.IsRegistered == true)
{
return true;
}
return false;
}
function IsValidLicense()
{
if((IsLicenseRegistered() == true || IsEval() == true) && IsEvalExpired() ==
false && IsSubscriptionExpired() == false)
{
return true;
}
return false;
}
function IsEval()
{
oLicenseManager = GetLicenseManager();
if(oLicenseManager.IsEvaluation == true)
{
return true;
}
return false;
}
function IsEvalExpired()
{
oLicenseManager = GetLicenseManager();
if(oLicenseManager.IsExpired && IsEval() == true)
{
return true;
}
return false;
}
function IsSubscriptionExpired()
{
oLicenseManager = GetLicenseManager();
if(oLicenseManager.IsExpired && IsSubscription() == true)
{
return true;
}
return false;
}
function GetLicenseExpirationMessage()
{
oLicenseManager = GetLicenseManager();
if(oLicenseManager==null)
{
return null;
}
if(oLicenseManager.IsRegistered)
{
return null;
}
if(oLicenseManager.IsExpired)
{
<tr>\n
");
}
function GetLicenseExpirationDate()
{
var oLicenseManager = GetLicenseManager();
var sLicenseExpires = oLicenseManager.GetProperty("LicenseExpires");
return sLicenseExpires;
}
function IsSubscription()
{
oLicenseManager = GetLicenseManager();
if(oLicenseManager.IsSubscription == true)
{
return true;
}
return false;
}
Response.WriteHtml("\n\n<script>\n
var g_nEnabledFeatureMask = '");
Response.Write(g_nEnabledFeatureMask
);Response.WriteHtml("';\n</script>\n<script language=\"JavaScript\" src=\"/NmCo
nsole/CoreNm/Framework/License.js\"></script>");
Response.WriteHtml("\n\n");
// standard user constants
var ADMIN_USERID =
1;
var ADMIN_USERNAME =
var GROUPID_MYNETWORK =
var LANGUAGEID_ENGLISH =
"ADMIN";
0;
1033;
=0;
//'
l
//'
//'
//'
var
=2;
//
Authenication types - LDAP and our internal login
var AUTHENTICATIONTYPE_INTERNAL =1;
var AUTHENTICATIONTYPE_LDAP
=2;
// User Rights Bits
var USERRIGHT_ALL
=0xFFFFFFFF;
var USERRIGHT_MANAGEUSERS
001;
var USERRIGHT_CONFIGURELDAPCREDENTIALS
var USERRIGHT_CHANGEYOURPASSWORD
var USERRIGHT_CONFIGUREACTIVEMONITORS
var USERRIGHT_CONFIGUREACTIONS
var USERRIGHT_TRANSLATION
020;
var USERRIGHT_CONFIGUREPASSIVEMONITORS
var USERRIGHT_CONFIGURECREDENTIALS
var USERRIGHT_MANAGEGROUPS
100;
var USERRIGHT_MANAGEDEVICES
200;
var USERRIGHT_ACCESSGROUPANDDEVICEREPORTS
var USERRIGHT_MANAGEIPSECURITY
var USERRIGHT_MANAGEWEBSERVER
var USERRIGHT_ACCESSSYSTEMREPORTS
var USERRIGHT_MANAGERECURRINGACTIONS
var USERRIGHT_CONFIGUREPERFORMANCEMONITORS
var USERRIGHT_MANAGEWORKSPACEVIEWS
var USERRIGHT_CONFIGUREACTIONPOLICIES
var USERRIGHT_ACCESSACTIVEDISCOVERY
var USERRIGHT_CONFIGUREWORKSPACES
var USERRIGHT_ACCESSREMOTEREPORTS
var USERRIGHT_CONFIGUREMIBS
000;
var USERRIGHT_CONFIGUREREMOTESERVERS
var USERRIGHT_ACCESSSSGREPORTS
var USERRIGHT_ACCESSALERTCENTERREPORTS
var USERRIGHT_CONFIGUREALERTCENTER
var USERRIGHT_ACCESSNETFLOWREPORTS
var USERRIGHT_NETFLOWCONFIGURE
//---
=0x00000
=0x00000002;
=0x00000004;
=0x00000008;
=0x00000010;
=0x00000
=0x00000040;
=0x00000080;
=0x00000
=0x00000
=0x00000400;
=0x00000800;
=0x00001000;
=0x00002000;
=0x00004000;
=0x00008000;
=0x00010000;
=0x00020000;
=0x00040000;
=0x00080000;
=0x00100000;
=0x00200
=0x00400000;
=0x00800000;
=0x01000000;
=0x02000000;
=0x04000000;
=0x08000000;
= 120;
="WorkspaceReportRefreshInterval
="FullReportRefreshInter
="DevicesTabRefreshInter
="WebAlarmsRefreshInterv
="ShowBubbleOnWorkspaceReports";
="ShowBubbleOnFullReports";
="DynamicSsgLege
="ShowNetFlowTooltips";
="true";
="true";
="IsDemo
Response.WriteHtml("\n\n");
// declare translations
var oUserTranslate = GetTranslationObject("User.inc");
oUserTranslate.DeclareTranslation("UserLoginError", "Login failed: %1");
oUserTranslate.DeclareTranslation("DemoUserLoginError", "Login failed: The user
account being logged in is a demo user account and the demo server is currently
disabled.");
oUserTranslate.DeclareTranslation("GetAdminUserLanguageID_Error", "Failed get th
e admin language ID. Error: %1");
oUserTranslate.DeclareTranslation("GetUsersRootDeviceGroupID_Error", "Failed get
the parent group ID. Error: %1");
oUserTranslate.DeclareTranslation("DemoUserRestricted", "This feature is not all
owed for demo users... %1");
oUserTranslate.DeclareTranslation("DemoUserRestrictedJs", "This feature is not a
llowed for demo users...");
oUserTranslate.DeclareTranslation("WebUserTableReadError", "Error occurred readi
ng the WebUser table. SQL error=%1");
oUserTranslate.DeclareTranslation("GetWebUserData_Error", "Failed to do a select
on WebUserData table Error: %1");
oUserTranslate.DeclareTranslation("DemoUserLoginMessage", "You have successfully
logged in as a demo server user. Some features are not fully functional. Click
help for more information.");
oUserTranslate.DeclareTranslation("DemoUserCloseButton", "Close");
oUserTranslate.DeclareTranslation("DemoUserHelpButton", "Help");
//-->Checks for valid product license...
function _CheckProductLicense()
{
// if on the login screen, restriced access screen, invalid license screen,
//
or a valid user id then do check license
var sScriptName = Request.ServerVariables("SCRIPT_NAME").Item;
if(sScriptName.toLowerCase().indexOf("dlgrestrictedaccess.asp") == -1
&& sScriptName.toLowerCase().indexOf("_demo") == -1
&& sScriptName.toLowerCase().indexOf("dlginvalidlicense.asp") ==
-1
)
{
var bIsValidLicense = IsValidLicense();
if(bIsValidLicense == false)
{
//--> Send to help file showing how to enable license...
oAspForm.ShowModalDialog("/NmConsole/CoreNm/User/DlgInvalidLicense/D
lgInvalidLicense.asp");
}
}
}
//--// Checks for browser type (IE 5+, Firefox 1+)
//
and tests for Javascript and Cookies
// The sBtf querystring variable stands for Browser Test Failed
//
the three valid cases are js (javascript), ck (cookie), and bt (
browser type)
//--function _CheckBrowser()
{
// let the webarchive (recurring reports) through
if(IsUserAWebArchive())
{
return;
}
var oBrowserCheckUrl;
try
{
// the url that handles failed browser tests
oBrowserCheckUrl = new CUrl("/NmConsole/CoreNm/User/BrowserCheck
/BrowserCheck.asp");
oInvalidRecuringReportUrl = new CUrl("/NmConsole/CoreNm/User/Inv
alidAddress/InvalidAddress.asp");
}
catch(e)
{
// if the curl include is not included then it is not a normal
// page so forget the browser check
return;
}
// test the browser type and version
var sUserAgent = Request.ServerVariables("HTTP_USER_AGENT").Item.toLower
Case();
var bSupportedBrowser = false;
var biPhone = false;
if(sUserAgent.indexOf("wget") > -1)
{
// let testing scripts through
return;
}
else if(sUserAgent.indexOf("msie") > -1)
{
var oUserAgentParts = sUserAgent.split("msie ");
+
+
+
+
?sBtf=ck\";"
+ "}"
+ "</script>");
}
}
var _oUserRights = new Array();
function _AddUserRight(nUserRight, sEnglishName, sCategory, sFeature)
{
// note: this translation is ok since all rights are translated at once
var oRegEx = new RegExp("(\\s+)","g");
var sControlName = "UserRight_" + sEnglishName.replace(oRegEx, "");
var sTranslatedName = oUserTranslate.Translate(sControlName, sEnglishNam
e);
var sCategoryControlName = "UserRightCategory_" + sCategory.replace(oReg
Ex, "");
var sTranslatedCategory = oUserTranslate.Translate(sCategoryControlName,
sCategory);
// if the feature is not enabled then do not add the right
if(IsFeatureEnabled(sFeature)==false)
{
return;
}
var oUserRight = new Object();
oUserRight.m_nUserRight = nUserRight;
oUserRight.m_sEnglishName = sEnglishName;
oUserRight.m_sTranslatedName = sTranslatedName;
oUserRight.m_sCagetory = sTranslatedCategory;
oUserRight.m_sFeature = sFeature;
_oUserRights.push(oUserRight);
}
// Gets the user right mask for the current user
function _GetUserRightsMask()
{
// If the user is a webarchive then return just report access rights
if(IsUserAWebArchive())
{
return USERRIGHT_ACCESSGROUPANDDEVICEREPORTS | USERRIGHT_ACCESSS
YSTEMREPORTS | USERRIGHT_ACCESSREMOTEREPORTS;
}
// if there is no right (user not logged in?) then return 0 "no rights"
else if(Session("nUserRightsMask") == null)
{
return 0;
}
// return the current users rights from the session
else
{
return parseInt(Session("nUserRightsMask"));
}
}
//--// Get the user home group id... this could return null
//
if the user does not have a home group and we do not want to return
//
0 because this could cause an access violation
//--function _GetUsersHomeDeviceGroupID(nWebUserID)
{
if(nWebUserID == null)
{
ASSERT("The user id is required.");
}
var sSql = ""
+ "SELECT "
+ "
ISNULL(nHomeDeviceGroupID, 0) AS nHomeDeviceGroupID "
+ "FROM WebUser "
+ "WHERE nWebUserID = " + nWebUserID;
var oDb = GetDb();
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranslatedError = oUserTranslate.TranslateEx("WebUserTableR
eadError", oResult.GetErrorMsg);
oAspForm.SetError(sTranslatedError);
return null;
}
if(oDb.IsEOF)
{
return null;
}
var nHomeDeviceGroupID = oDb.GetFieldAsLong("nHomeDeviceGroupID");
oDb.Close;
return nHomeDeviceGroupID;
}
//--// Attempts to login the user using sUserName and sPassword supplied
// by the query string (this is picked up by aspForms
//--function _AutomaticLogin()
{
// if there is a username on the querystring and it is not the
// current user signed in (or there is no user signed in
// then attempt the automatic login
var sUserName = oAspForm.GetValueAsString("sUserName");
var sPassword = oAspForm.GetValueAsString("sPassword");
if(sUserName != null &&
sUserName != GetUserName()
&& Request.ServerVariables("SCRIPT_NAME").Item.toLowerCase().ind
exOf("dlguserlogin.asp") == -1
&& Request.ServerVariables("SCRIPT_NAME").Item.toLowerCase().ind
exOf("_demo") == -1)
{
// make sure all sensitive session data is cleared
// by calling logout
UserLogout();
// if UserLogin fails it will send the appropriate message to th
e user
var bLoginSuccess = UserLogin(sUserName, sPassword);
if(bLoginSuccess)
{
// remove the username and password and redirect
Response.Redirect(GetScriptNameUrl().AsString());
}
}
else if(sUserName != null && sUserName == GetUserName()&& Request.Server
Variables("SCRIPT_NAME").Item.toLowerCase().indexOf("dlguserlogin.asp") == -1
&& Request.ServerVariables("SCRIPT_NAME").Item.toLowerCase().ind
exOf("_demo") == -1)
{
//--> if sUserName is same as sUserName in session - strip user & pa
ss from url and redirect...
Response.Redirect(GetScriptNameUrl().AsString());
}
}
// get current page url, add querystring items, remove username and password (if
applicable)
function GetScriptNameUrl()
{
var oRedirectUrl = new CUrl(String(Request.ServerVariables("SCRIPT_NAME")));
var oEnum = new Enumerator(Request.QueryString);
while(!oEnum.atEnd())
{
var sItemName = oEnum.item();
var sItemValue = String(Request.QueryString(sItemName));
oRedirectUrl.Add(sItemName, sItemValue);
oEnum.moveNext();
}
oRedirectUrl.RemoveProperty("sUserName");
oRedirectUrl.RemoveProperty("sPassword");
return oRedirectUrl;
}
//--// Retrieves the group access rights for the specified group
// these rights are stored off in the session until the user logs off
//--function _GetUserGroupRights(nDeviceGroupID)
{
var oRights = new Array();
var oUserGroupAccess = Session("USER_GROUP_ACCESS_" + GetUserIDForGroupA
ccess());
if(oUserGroupAccess == null)
{
oUserGroupAccess = Server.CreateObject("Scripting.Dictionary");
}
// If the rights for the group have already been read, then get them fro
m the session
if(oUserGroupAccess.Exists(nDeviceGroupID))
{
oRights = oUserGroupAccess.Item(nDeviceGroupID).split(",");
}
else
{
var sSql = ""
+ "SELECT "
+ "
bGroupRead, bGroupWrite, bDeviceRead, bDeviceWri
te, DeviceGroup.bDynamicGroup "
+ "FROM DeviceGroup "
+ "
LEFT OUTER JOIN PivotWebUserToDeviceGroup "
+ "
ON DeviceGroup.nDeviceGroupID = PivotWeb
UserToDeviceGroup.nDeviceGroupID "
+ "
AND PivotWebUserToDeviceGroup.nWebUserID
= " + GetUserIDForGroupAccess() + " "
+ "WHERE DeviceGroup.nDeviceGroupID = " + nDeviceGroupID
;
var oDb = GetDb();
var oResult = oDb.ExecSQL(sSql);
if(oResult.Failed)
{
ASSERT("The database object failed to initialize." + oRe
sult.GetErrorMsg);
}
// if there is no record then the user has no access
if(oDb.IsEOF)
{
oRights = [0, 0, 0, 0];
}
else
{
// set each access right
if(oDb.GetFieldAsBool("bGroupRead") == true || oDb.GetFi
eldAsBool("bDynamicGroup") == true)
{
oRights[GROUP_READ] = 1;
}
else
{
oRights[GROUP_READ] = 0;
}
if(oDb.GetFieldAsBool("bGroupWrite") == true)
{
oRights[GROUP_WRITE] = 1;
}
else
{
oRights[GROUP_WRITE] = 0;
}
if(oDb.GetFieldAsBool("bDeviceRead") == true)
{
oRights[DEVICE_READ] = 1;
}
else
{
oRights[DEVICE_READ] = 0;
}
if(oDb.GetFieldAsBool("bDeviceWrite") == true)
{
oRights[DEVICE_WRITE] = 1;
}
else
{
oRights[DEVICE_WRITE] = 0;
}
}
// Add the rights to the session
oUserGroupAccess.Add(nDeviceGroupID, oRights.join(","));
Session("USER_GROUP_ACCESS_" + GetUserIDForGroupAccess()) = oUse
rGroupAccess;
}
return oRights;
}
//--// Retrieves the device access rights for the specified device
// these rights are stored off in the session until the user logs off
//--function _GetUserDeviceRights(nDeviceID)
{
var oRights = new Array();
var oUserDeviceAccess = Session("USER_DEVICE_ACCESS_" + GetUserIDForGrou
pAccess());
if(oUserDeviceAccess == null)
{
oUserDeviceAccess = Server.CreateObject("Scripting.Dictionary");
}
// If the rights for the device have already been read, then get them fr
om the session
if(oUserDeviceAccess.Exists(nDeviceID))
{
oRights = oUserDeviceAccess.Item(nDeviceID).split(",");
}
else
{
var sSql = ""
+ "SELECT SUM(CONVERT(TINYINT, PivotWebUserToDeviceGroup
.bDeviceRead)) AS bDeviceRead, "
+ "
SUM(CONVERT(TINYINT, PivotWebUserToDeviceGroup.b
DeviceWrite)) AS bDeviceWrite "
+ "FROM DeviceGroup "
+ "
INNER JOIN PivotDeviceToGroup ON "
+ "
PivotDeviceToGroup.nDeviceGroupID = Devi
ceGroup.nDeviceGroupID "
+ " INNER JOIN Device ON "
+ "
Device.nDeviceID = PivotDeviceToGroup.nD
eviceID "
+ "
INNER JOIN PivotWebUserToDeviceGroup ON "
+ "
PivotWebUserToDeviceGroup.nDeviceGroupID
= DeviceGroup.nDeviceGroupID "
+ "WHERE Device.nDeviceID = " + nDeviceID
+ "
AND PivotWebUserToDeviceGroup.nWebUserID = " + G
etUserIDForGroupAccess();
var oDb = GetDb();
var oResult = oDb.ExecSQL(sSql);
if (oResult.Failed)
{
ASSERT("The database object failed to initialize." + oRe
sult.GetErrorMsg);
}
// if there is no record then the user has no access
if(oDb.IsEOF)
{
oRights = [0, 0];
}
else
{
// set each access right
if(oDb.GetFieldAsBool("bDeviceRead") == true)
{
oRights[DEVICE_READ] = 1;
}
else
{
oRights[DEVICE_READ] = 0;
}
if( oDb.GetFieldAsBool("bDeviceWrite") == true)
{
oRights[DEVICE_WRITE] = 1;
}
else
{
oRights[DEVICE_WRITE] = 0;
}
}
// Add the rights to the session
oUserDeviceAccess.Add(nDeviceID, oRights.join(","));
Session("USER_DEVICE_ACCESS_" + GetUserIDForGroupAccess()) = oUs
erDeviceAccess;
}
return oRights;
}
//-// Sets the registry value which enables or disables the access rights
//-function _SetUserGroupAccess(bIsEnabled)
{
if(IsUserDemoUser())
{
return;
}
// Convert bIsEnabled to a number if it is not one already
var nIsEnabled = 0;
if(isNaN(parseInt(bIsEnabled)))
{
if(bIsEnabled == true)
{
nIsEnabled = 1;
}
else
{
nIsEnabled = 0;
}
}
else
{
nIsEnabled = bIsEnabled;
}
var oReg = Server.CreateObject("CoreAsp.RegistryManager");
oReg.Open(RK_WEBSETTINGS, RK_HKLM);
var sError = oReg.GetLastError();
if(sError != "")
{
ASSERT("An error occured while attempting to open the registry."
, sError);
}
// Set the value
oReg.SetValue(RV_WEBSETTINGS_USER_GROUP_ACCESS, nIsEnabled);
sError = oReg.GetLastError();
if(sError != "")
{
ASSERT("An error occured while attempting to set the registry va
lue : " + RV_WEBSETTINGS_USER_GROUP_ACCESS, sError);
}
// store the value in the session
Session(RV_WEBSETTINGS_USER_GROUP_ACCESS) = nIsEnabled;
}
//-// Returns true if the registry value which enables the access rights is 1, othe
rwise false
//-function _IsUserGroupAccessEnabled()
{
// try to get the value from the session
var nIsEnabled = Session(RV_WEBSETTINGS_USER_GROUP_ACCESS);
// if the value was not in the session, read from the registry
if(nIsEnabled == null)
{
var oReg = Server.CreateObject("CoreAsp.RegistryManager");
oReg.Open(RK_WEBSETTINGS, RK_HKLM);
var sError = oReg.GetLastError();
if(sError != "")
{
ASSERT("An error occured while attempting to open the re
gistry.", sError);
}
nIsEnabled = oReg.GetValue(RV_WEBSETTINGS_USER_GROUP_ACCESS);
sError = oReg.GetLastError();
if(sError != "")
{
// create the reg key - this will also assert if any err
ors occures in the creation
_SetUserGroupAccess(false);
nIsEnabled = 0;
}
}
// return true or false, not 0 or 1
if(nIsEnabled == 0)
{
return false;
}
else
{
return true;
}
}
// makes the users configure rights available to the client for
// building the dynamic configure menu
function _WriteConfigureMenuAccessRights()
{
var oUsersConfigureRights = new Array();
if(UserHasRight(USERRIGHT_CONFIGUREPERFORMANCEMONITORS))
{
oUsersConfigureRights.push("Performance Monitor Library");
}
if(UserHasRight(USERRIGHT_CONFIGUREACTIVEMONITORS))
{
oUsersConfigureRights.push("Active Monitor Library");
}
if(UserHasRight(USERRIGHT_CONFIGUREPASSIVEMONITORS))
{
oUsersConfigureRights.push("Passive Monitor Library");
}
if(UserHasRight(USERRIGHT_CONFIGUREACTIONS))
{
oUsersConfigureRights.push("Action Library");
}
if(UserHasRight(USERRIGHT_CONFIGUREACTIONPOLICIES))
{
oUsersConfigureRights.push("Action Policies");
}
if(UserHasRight(USERRIGHT_CONFIGURECREDENTIALS))
{
oUsersConfigureRights.push("Credentials Library");
}
if(UserHasRight(USERRIGHT_MANAGEWORKSPACEVIEWS))
{
oUsersConfigureRights.push("Workspace Library");
}
if(UserHasRight(USERRIGHT_CONFIGUREREMOTESERVERS) && IsFeatureEnabled(FE
ATURE_DSTSERVER) == true)
{
oUsersConfigureRights.push("Remote Sites");
}
if(UserHasRight(USERRIGHT_MANAGERECURRINGACTIONS))
{
oUsersConfigureRights.push("Recurring Actions");
}
if(UserHasRight(USERRIGHT_MANAGEWEBSERVER))
{
oUsersConfigureRights.push("Manage Web Server");
}
if(UserHasRight(USERRIGHT_MANAGEUSERS))
{
oUsersConfigureRights.push("Manage Users");
}
if(UserHasRight(USERRIGHT_CONFIGUREMIBS))
{
oUsersConfigureRights.push("Manage SNMP MIBs");
}
if(UserHasRight(USERRIGHT_CONFIGURELDAPCREDENTIALS))
{
oUsersConfigureRights.push("LDAP Credentials");
}
if(UserHasRight(USERRIGHT_MANAGEIPSECURITY))
{
oUsersConfigureRights.push("IP Security");
}
if(UserHasRight(USERRIGHT_TRANSLATION))
{
oUsersConfigureRights.push("Translation");
}
if(UserHasRight(USERRIGHT_CONFIGUREALERTCENTER))
{
oUsersConfigureRights.push("AlertCenterConfigure");
}
if(UserHasRight(USERRIGHT_NETFLOWCONFIGURE))
{
oUsersConfigureRights.push("NetflowConfigure");
}
Response.WriteHtml("\n <script>\n
var sUsersConfigureRights = \"");
Response.Write(oUsersConfigureRights.join(",")
);Response.WriteHtml("\";\n
</script>\n
");
}
// Loads all the webuserdata for the current user if not already loaded
// this is stored in the session to save a database lookup on every page
// then returns the the value associated with sName
function _GetWebUserData(sName)
{
var sWebUserData = Session("WebUserData");
if(sWebUserData == null)
{
var sWebUserData = "";
var oDb = GetDb();
var sSql = "SELECT sName, sValue FROM WebUserData WHERE nWebUser
ID = " + GetUserID();
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("GetW
ebUserData_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return null;
}
while(!oDb.IsEOF)
{
sWebUserData += oDb.GetFieldAsString("sName") + "," + oD
b.GetFieldAsString("sValue") + "|";
oDb.MoveNext();
}
Session("WebUserData") = sWebUserData;
}
var oWebUserData = sWebUserData.split("|");
for(var i = 0; i < oWebUserData.length; i++)
{
var oData = oWebUserData[i].split(",");
if(oData[0] == sName)
{
return oData[1];
}
}
return null;
}
// checks the registry to see if the demo server is enabled
var g_IsDemoServerEnabled = null;
function IsDemoServerEnabled()
{
if(g_IsDemoServerEnabled != null)
{
return g_IsDemoServerEnabled;
}
var oReg = Server.CreateObject("CoreAsp.RegistryManager");
oReg.Open(RK_WEBSETTINGS, RK_HKLM);
var sError = oReg.GetLastError();
if(sError != "")
{
oAspForm.SetError("An error occured while attempting to open the
registry.\n" + sError);
return false;
}
var nIsDemoServerEnabled = oReg.GetValue(RV_WEBSETTINGS_DEMOSERVER_ENABL
ED);
sError = oReg.GetLastError();
if(sError != "")
{
oReg.SetValue(RV_WEBSETTINGS_DEMOSERVER_ENABLED, 0);
nIsDemoServerEnabled = 0;
sError = oReg.GetLastError();
}
if(sError != "")
{
ASSERT("An error occured while attempting to read the registry."
, sError);
}
if(nIsDemoServerEnabled == 1)
{
g_IsDemoServerEnabled = true;
}
else
{
g_IsDemoServerEnabled = false;
}
return g_IsDemoServerEnabled;
}
function _ShowDemoUserMessage()
{
var bShowDemoUserMessage = Session("bShowDemoUserMessage");
if(null==bShowDemoUserMessage || false==bShowDemoUserMessage)
{
return;
}
var sMessage = oUserTranslate.TranslateEx("DemoUserLoginMessage");
var sCloseButton = "<a href=\"javascript:CloseDemoUserMessage();\" style
=\"text-decoration:underline;\">" + oUserTranslate.TranslateEx("DemoUserCloseBut
ton") + "</a>";
var sHelpButton = "<a href=\"javascript:oAspForm.OpenHelpTopic(HELP_DEMO
SERVER_URL);\" style=\"text-decoration:underline;\">" + oUserTranslate.Translate
Ex("DemoUserHelpButton") + "</a>";
Response.WriteHtml("\n <div id=\"oDemoUserMessage\" style=\"position:absolute;t
op:0;border:2px outset;background:#ECE9D8;padding:10px;width:300px;\" class=\"As
pf-Font\">\n
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n
<tr>\n
<td>");
Response.Write(sMessage
);Response.Write(oAspForm.AddSpacer()
);Response.WriteHtml("</td>\n
</tr>\n
<tr>\n
<td align=\"right\">\n
");
Response.Write(sHelpButton
);Response.WriteHtml(" | ");
Response.Write(sCloseButton
);Response.WriteHtml("\n
</td>\n
</tr>\n </table>
\n
</div>\n
<script>\n
JsCenterDiv(document.getElementById(\"oD
emoUserMessage\"));\n function CloseDemoUserMessage()\n
{\n
document.getElementById(\"oDemoUserMessage\").style.display = \"none\";\n
}\n
</script>\n
");
Session("bShowDemoUserMessage") = false;
}
Response.WriteHtml("\n");
//-// Helper functions for the user activity log
//-//
//
//
var
var
var
var
var
var
var
var
Categories
BULK_FIELD_CHANGE = "Bulk Field Change";
DEVICE_DETAILS
= "Device Properties";
DEVICES
= "Devices";
ACTIVE_MONITOR
= "Active Monitor";
PASSIVE_MONITOR
= "Passive Monitor";
PERFORMANCE_MONITOR = "Performance Monitor";
CREDENTIALS
= "Credentials";
ACTION_POLICY
= "Action Policy";
var
var
var
var
var
var
var
RECURRING_ACTION
LOGIN
ACTION
USER
WORKSPACE
SYSTEM
REMOTE_SITE
= "Recurring Action";
= "Login";
= "Action";
= "User";
= "Workspace";
= "System";
= "Remote Site";
// declare translations
var oUserTranslate = GetTranslationObject("User.inc");
oUserTranslate.DeclareTranslation("AnonymousUserName", "Anonymous");
oUserTranslate.DeclareTranslation("_LogUserMessage_Error", "Failed to add the we
b user activity log record. Error: %1");
oUserTranslate.DeclareTranslation("_GetDeviceDisplayNameForLog_Error", "Failed t
o get the device display name. Error: %1");
oUserTranslate.DeclareTranslation("_GetMultipleDeviceDisplayNamesForLog_Error",
"Failed to get multiple device display names. Error: %1");
oUserTranslate.DeclareTranslation("GetDeviceGroupDisplayNameForLog_Error", "Fail
ed to get the device group display name. Error: %1");
oUserTranslate.DeclareTranslation("_GetCredentialTypeNameForLog_Error", "Failed
to get the credential type name. Error: %1");
oUserTranslate.DeclareTranslation("_GetActiveMonitorTypeNameForLog_Error", "Fail
ed to get the active monitor type name. Error: %1");
oUserTranslate.DeclareTranslation("_GetWebUserNameForLog_Error", "Failed to get
the web user name. Error: %1");
oUserTranslate.DeclareTranslation("_GetActionPolicyNameForLog_Error", "Failed to
get the action type name. Error: %1");
oUserTranslate.DeclareTranslation("_GetActionTypeNameForLog_Error", "Failed to g
et the action type name. Error: %1");
oUserTranslate.DeclareTranslation("_GetActiveMonitorTypeNameForLogFromPivot_Erro
r", "Failed to get the monitor type name from pivot id. Error: %1");
oUserTranslate.DeclareTranslation("_GetPassiveMonitorTypeNameFromPivotForLog_Err
or", "Failed to get the passive monitor type name from pivot id. Error: %1");
oUserTranslate.DeclareTranslation("_GetPerfromanceMonitorTypeNameForLog_Error",
"Failed to get the performance monitor type name. Error: %1");
oUserTranslate.DeclareTranslation("_GetPassiveMonitorTypeNameForLog_Error", "Fai
led to get the passive monitor type name. Error: %1");
oUserTranslate.DeclareTranslation("_GetRecurringActionNameForLog_Error", "Failed
to get the recurring action name. Error: %1");
oUserTranslate.DeclareTranslation("_GetWorkspaceNameForLog_Error", "Failed to ge
t the workspace name. Error: %1");
oUserTranslate.DeclareTranslation("_GetDeviceDisplayNameFromWebAlarmIDForLog_Err
or", "Failed to get device display name from web alarm id. Error: %1");
oUserTranslate.DeclareTranslation("_GetDevDisNameFromActDiscDevIDForLog", "Faile
d to get device display name from active discovery device detail id. Error: %1")
;
oUserTranslate.DeclareTranslation("_GetActMonTypeNameFromActDiscServIDForLog_Err
or", "Failed to get monitorname from active discovery service detail id. Error:
%1");
oUserTranslate.DeclareTranslation("_GetStatMonNameActDiscStatMonIDLog_Error", "F
ailed to get monitor name from active discovery performance monitor detail id. E
rror: %1");
oUserTranslate.DeclareTranslation("_GetRemoteServerDisplayNameForLog_Error", "Fa
iled to get the remote site display name. Error: %1");
// translate the logging categories
var oUserTranslateForAdmin = GetTranslationObjectForAdminUser();
_DeclareTranslatedCategory(BULK_FIELD_CHANGE);
_DeclareTranslatedCategory(DEVICE_DETAILS);
_DeclareTranslatedCategory(DEVICES);
_DeclareTranslatedCategory(ACTIVE_MONITOR);
_DeclareTranslatedCategory(PASSIVE_MONITOR);
_DeclareTranslatedCategory(PERFORMANCE_MONITOR);
_DeclareTranslatedCategory(CREDENTIALS);
_DeclareTranslatedCategory(ACTION_POLICY);
_DeclareTranslatedCategory(RECURRING_ACTION);
_DeclareTranslatedCategory(LOGIN);
_DeclareTranslatedCategory(ACTION);
_DeclareTranslatedCategory(USER);
_DeclareTranslatedCategory(WORKSPACE);
_DeclareTranslatedCategory(SYSTEM);
_DeclareTranslatedCategory(REMOTE_SITE);
// translate the log messages
oUserTranslateForAdmin.DeclareTranslation("LogCreateDevice_Message", "Added devi
ce '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogMoveDevice_Message", "Moved device
'%1' from the '%2' group to the '%3' group");
oUserTranslateForAdmin.DeclareTranslation("LogCopyDevice_Message", "Copied devic
e '%1' to the '%2' group");
oUserTranslateForAdmin.DeclareTranslation("LogUpdateGeneralDevice_Message", "Mod
ified general device properties of '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogModifiedDeviceCredentials_Message"
, "Modified credentials on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogModifiedDevicePolling_Message", "M
odified polling properties on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogDevicePassiveMonitorProperties_Mes
sage", "%1 the '%2' passive monitor on '%3'");
oUserTranslateForAdmin.DeclareTranslation("LogModifiedDeviceActiveMonitor_Messag
e", "Modified active monitor on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogDeviceActiveMonitorProperties_Mess
age", "%1 the '%2' active monitor on '%3'");
oUserTranslateForAdmin.DeclareTranslation("LogDevicePerformanceMonitorProperties
_Message", "%1 the '%2' performance monitor on '%3'");
oUserTranslateForAdmin.DeclareTranslation("LogModifiedDeviceNotes_Message", "Mod
ified notes on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogModifiedDeviceCustomLinks_Message"
, "Modified custom links on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogModifiedDeviceAttributes_Message",
"Modified attributes on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogDeletedDevice_Message", "Deleted d
evice '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogAcknowledgeDevice_Message", "Ackno
wledged '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogModifiedDeviceAction_Message", "Mo
dified actions on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogBFCDevicePerformanceMonitor_Messag
e", "Performance monitor bulk field changes on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogBFCDeviceAttributes_Message", "Att
ribute bulk field changes on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogBFCDeviceNotes_Message", "Note bul
k field changes on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogBFCActiveMonitorType_Message", "Ac
tive Monitor type bulk field changes on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogBFCDeviceCredentials_Message", "Cr
edential bulk field changes on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogBFCDeviceActionPolicy_Message", "A
ction Policy bulk field changes on '%1'");
oUserTranslateForAdmin.DeclareTranslation("LogBFCDeviceMaintenance_Message", "Ma
{
var oDb = GetCacheDb();
var sSql = "SELECT sDisplayName FROM Device WHERE nDeviceID = " + nDevic
eID;
var oResult = oDb.ExecSql(sSql);
if(oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("_GetDeviceDi
splayNameForLog_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return "unknown";
}
var sDisplayName = "";
if(!oDb.IsEOF)
{
sDisplayName = oDb.GetFieldAsString("sDisplayName");
}
return sDisplayName;
}
// Gets a comma seperated string of device display names
// given an array of device ids
function _GetMultipleDeviceDisplayNamesForLog(oDeviceIDs)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SELECT TOP 20 sDisplayName "
+ "FROM Device "
+ "WHERE nDeviceID IN (" + oDeviceIDs.toString() + ")";
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("_GetMultiple
DeviceDisplayNamesForLog_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sDisplayNames = "";
while(!oDb.IsEOF)
{
sDisplayNames += oDb.GetFieldAsString("sDisplayName");
oDb.MoveNext();
}
if(sDisplayNames.charAt(sDisplayNames.length - 2) == ",")
{
sDisplayNames = sDisplayNames.substring(0, sDisplayNames.length
- 2);
}
return sDisplayNames;
}
// Gets the group display name
function GetDeviceGroupDisplayNameForLog(nDeviceGroupID)
{
var oDb = GetCacheDb();
var sSql = "SELECT sGroupName FROM DeviceGroup WHERE nDeviceGroupID = "
+ nDeviceGroupID;
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("GetDeviceGro
upDisplayNameForLog_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sGroupName = "";
if(!oDb.IsEOF)
{
sGroupName = oDb.GetFieldAsString("sGroupName");
}
return sGroupName;
}
// Gets the credential type name
function _GetCredentialTypeNameForLog(nCredentialTypeID)
{
var oDb = GetCacheDb();
var sSql = "SELECT sDisplayName FROM CredentialType WHERE nCredentialTyp
eID = " + nCredentialTypeID;
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("_GetCredenti
alTypeNameForLog_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sDisplayName = "";
if(!oDb.IsEOF)
{
sDisplayName = oDb.GetFieldAsString("sDisplayName");
}
return sDisplayName;
}
// Gets the active monitor type name
function _GetActiveMonitorTypeNameForLog(nActiveMonitorTypeID)
{
var oDb = GetCacheDb();
var sSql = "SELECT sMonitorTypeName FROM ActiveMonitorType WHERE nActive
MonitorTypeID = " + nActiveMonitorTypeID;
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("_GetActiveMo
nitorTypeNameForLog_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sMonitorTypeName = "";
if(!oDb.IsEOF)
{
sMonitorTypeName = oDb.GetFieldAsString("sMonitorTypeName");
}
return sMonitorTypeName;
}
// Gets the user name
function _GetWebUserNameForLog(nWebUserID)
{
var oDb = GetCacheDb();
var sSql = "SELECT sUserName FROM WebUser WHERE nWebUserID = " + nWebUse
rID;
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("_GetWebUserN
ameForLog_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sUserName = "";
if(!oDb.IsEOF)
{
sUserName = oDb.GetFieldAsString("sUserName");
}
return sUserName;
}
//
Gets the action policy name
function _GetActionPolicyNameForLog(nActionPolicyID)
{
var oDb = GetCacheDb();
var sSql =
"SELECT nActionPolicyID, " +
"
sPolicyName " +
"FROM ActionPolicy " +
"WHERE nActionPolicyID = " + nActionPolicyID;
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("_GetActionPo
licyNameForLog_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sActionPolicyName = "";
if(!oDb.IsEOF)
{
sActionPolicyName = oDb.GetFieldAsString("sPolicyName");
}
return sActionPolicyName;
}
// Gets the action type name
function _GetActionTypeNameForLog(nActionTypeID)
{
var oDb = GetCacheDb();
var sSql = "SELECT sActionTypeName FROM ActionType WHERE nActionTypeID =
" + nActionTypeID;
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("_GetActionTy
peNameForLog_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sActionTypeName = "";
if(!oDb.IsEOF)
{
sActionTypeName = oDb.GetFieldAsString("sActionTypeName");
}
return sActionTypeName;
}
// Gets the active monitor type name
function _GetActiveMonitorTypeNameForLogFromPivot(nPivotActiveMonitorTypeToDevic
eID)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SELECT sMonitorTypeName "
+ "FROM PivotActiveMonitorTypeToDevice "
+ "INNER JOIN ActiveMonitorType ON ActiveMonitorType.nActiveMoni
torTypeID=PivotActiveMonitorTypeToDevice.nActiveMonitorTypeID "
+ "WHERE nPivotActiveMonitorTypeToDeviceID = " + nPivotActiveMon
itorTypeToDeviceID;
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("_GetActiveMo
nitorTypeNameForLogFromPivot_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sMonitorTypeName = "";
if(!oDb.IsEOF)
{
sMonitorTypeName = oDb.GetFieldAsString("sMonitorTypeName");
}
return sMonitorTypeName;
}
// Gets the passive monitor type name given the pivot id
function _GetPassiveMonitorTypeNameFromPivotForLog(nPivotPassiveMonitorTypeToDev
iceID)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SELECT sMonitorTypeName, nCLSID "
+ "FROM PivotPassiveMonitorTypeToDevice "
+ "INNER JOIN PassiveMonitorType ON PassiveMonitorType.nPassiveM
onitorTypeID=PivotPassiveMonitorTypeToDevice.nPassiveMonitorTypeID "
+ "WHERE nPivotPassiveMonitorTypeToDeviceID = " + nPivotPassiveM
onitorTypeToDeviceID;
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("_GetPassiveM
onitorTypeNameFromPivotForLog_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sMonName = "";
if(!oDb.IsEOF)
{
var nCLSID = oDb.GetFieldAsLong("nCLSID");
var sMonName = oDb.GetFieldAsString("sMonitorTypeName");
splayNameFromWebAlarmIDForLog_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sDisplayName = "";
if(!oDb.IsEOF)
{
sDisplayName = oDb.GetFieldAsString("sDisplayName");
}
return sDisplayName;
}
//
Gets the device display name from the ActiveDiscoveryResultDeviceDetail
function _GetDeviceDisplayNameFromActiveDiscoveryDeviceIDForLog(nActiveDiscovery
ResultDeviceDetailID)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SELECT sHostName "
+ "FROM ActiveDiscoveryResultDeviceDetail "
+ "WHERE nActiveDiscoveryResultDeviceDetailID = "
+ nActiveDiscoveryResultDeviceDetailID;
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("_GetDevDisNa
meFromActDiscDevIDForLog", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sDisplayName = "";
if(!oDb.IsEOF)
{
sDisplayName = oDb.GetFieldAsString("sHostName");
}
return sDisplayName;
}
//
Gets the monitor name from ActiveDiscoveryResultServiceDetails table
function _GetActiveMonitorTypeNameFromActiveDiscoveryServiceIDForLog(nActiveDisc
overyResultServiceDetailID)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SELECT sDescription "
+ "FROM ActiveDiscoveryResultServiceDetail "
+ "WHERE nActiveDiscoveryResultServiceDetailID = "
+ nActiveDiscoveryResultServiceDetailID;
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("_GetActMonTy
peNameFromActDiscServIDForLog_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sMonitorName = "";
if(!oDb.IsEOF)
{
sMonitorName = oDb.GetFieldAsString("sDescription");
}
return sMonitorName;
}
//
Gets the performance monitor name from the ActiveDiscoveryResultStatisti
calMonitorDetails table
function _GetStatisticalMonitorTypeNameFromActiveDiscoveryStatisticalMonitorIDFo
rLog(nActiveDiscoveryResultStatisticalMonitorDetailID)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SELECT sDescription "
+ "FROM ActiveDiscoveryResultStatisticalMonitorDetails "
+ "WHERE nActiveDiscoveryResultStatisticalMonitorDetailID = "
+ nActiveDiscoveryResultStatisticalMonitorDetailID;
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("_GetStatMonN
ameActDiscStatMonIDLog_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return false;
}
var sMonitorName = "";
if(!oDb.IsEOF)
{
sMonitorName = oDb.GetFieldAsString("sDescription");
}
return sMonitorName;
}
// Gets the passive monitor server name
function _GetPassiveMonitorServerNameForLog(sDescription)
{
var sName = "Could not determine class name.";
var oReg = Server.CreateObject("CoreAsp.RegistryManager");
oReg.Open(RK_PLUGINS_PASSIVEMONITORS, RK_HKLM);
var sError = oReg.GetLastError();
if(sError != "")
{
// not manditory so no need to fail
return sName
}
var oKeys = oReg.GetSubKeys().toArray();
for(ii = 0; ii < oKeys.length; ii++)
{
oReg.Open(sKey+"\\"+oKeys[ii], RK_HKLM);
if(oReg.GetValue("CLSID").toString() == sCLSID)
{
sName = oReg.GetValue("DisplayName").toString();
break;
}
}
return sName;
}
iption);
}
function LogModifiedDevicePolling(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogModifiedDevice
Polling_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption);
}
function LogDevicePassiveMonitorModification(nDeviceID, sPassiveMonitor, sModifi
cation,sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogDevicePassiveM
onitorProperties_Message", sModification, sPassiveMonitor,sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption);
}
function LogModifiedDeviceActiveMonitor(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogModifiedDevice
ActiveMonitor_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption);
}
function LogDeviceActiveMonitorModification(nDeviceID, sActiveMonitor, sModifica
tion,sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogDeviceActiveMo
nitorProperties_Message", sModification, sActiveMonitor,sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption);
}
function LogDevicePerformanceMonitorModification(nDeviceID, sPerformanceMonitor,
sModification,sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogDevicePerforma
nceMonitorProperties_Message", sModification, sPerformanceMonitor,sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption);
}
function LogModifiedDeviceNotes(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogModifiedDevice
Notes_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption)
}
function LogModifiedDeviceCustomLinks(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogModifiedDevice
CustomLinks_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption)
}
function LogModifiedDeviceAttributes(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogModifiedDevice
Attributes_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption)
}
function LogDeletedDevice(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogDeletedDevice_
Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
function LogAcknowledgeDevice(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogAcknowledgeDev
ice_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
function LogModifiedDeviceAction(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogModifiedDevice
Action_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICE_DETAILS), sDetails, sDescr
iption);
}
//--// BFC logging
//--function LogBFCDevicePerformanceMonitor(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogBFCDevicePerfo
rmanceMonitor_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCDeviceAttributes(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogBFCDeviceAttri
butes_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription)
}
enance_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCDeviceMaintenanceSchedule(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogBFCDeviceMaint
enanceSchedule_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCDevicePolling(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogBFCDevicePolli
ng_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCDeviceDeviceType(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogBFCDeviceDevic
eType_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription)
}
function LogBFCDeviceActiveMonitorProperties(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogBFCDeviceActiv
eMonitorProperties_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCDeviceDependencies(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogBFCDeviceDepen
dencies_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCDevicePassiveMonitorType(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogBFCDevicePassi
veMonitorProperties_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
function LogBFCPassiveMonitorProperties(nDeviceID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogBFCDevicePassi
veMonitorActions_Message", sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(BULK_FIELD_CHANGE), sDetails, sDe
scription);
}
//--// Group logging
//--function LogCreateGroup(nDeviceGroupID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = GetDeviceGroupDisplayNameForLog(nDeviceGroupID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogCreateGroup_Me
ssage", sDisplayName);
var sDetails = "nDeviceGroupID=" + nDeviceGroupID
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
function LogModifiedGroup(nDeviceGroupID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = GetDeviceGroupDisplayNameForLog(nDeviceGroupID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogModifiedGroup_
Message", sDisplayName);
var sDetails = "nDeviceGroupID=" + nDeviceGroupID
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
function LogDeletedGroup(nDeviceGroupID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = GetDeviceGroupDisplayNameForLog(nDeviceGroupID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogDeletedGroup_M
essage", sDisplayName);
var sDetails = "nDeviceGroupID=" + nDeviceGroupID
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
//
Log the group move
function LogMovedGroup( nDeviceGroupID, nDestinationGroupID)
{
var sGroupName
= GetDeviceGroupDisplayNameForLo
g(nDeviceGroupID);
var sDestinationGroupName
= GetDeviceGroupDisplayNameForLog(nDesti
nationGroupID);
var sDescription = oUserTranslateForAdmin.TranslateEx("LogMovedGroup_Mes
sage", sGroupName,sDestinationGroupName);
var sDetails = "nDeviceGroupID=" + nDeviceGroupID
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
//
Log the group copy
function LogCopyGroup( nDeviceGroupID, nDestinationGroupID)
{
var sGroupName
= GetDeviceGroupDisplayNameForLo
g(nDeviceGroupID);
var sDestinationGroupName
= GetDeviceGroupDisplayNameForLog(nDesti
nationGroupID);
var sDescription = oUserTranslateForAdmin.TranslateEx("LogCopyGroup_Mess
age", sGroupName,sDestinationGroupName);
var sDetails = "nDeviceGroupID=" + nDeviceGroupID
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
//--//
Active Discovery logging
//--function LogAddActiveDiscoveryDevice(nDeviceGroupID, nActiveDiscoveryResultDevic
eDetailID,sGroupDisplayName, sDeviceDisplayName)
{
if(sGroupDisplayName == null)
{
sGroupDisplayName = GetDeviceGroupDisplayNameForLog(nDeviceGroup
ID);
}
if(sDeviceDisplayName == null)
{
sDeviceDisplayName = _GetDeviceDisplayNameFromActiveDiscoveryDev
iceIDForLog(nActiveDiscoveryResultDeviceDetailID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogAddActiveDisco
veryDevice_Message", sDeviceDisplayName, sGroupDisplayName);
var sDetails = "nDeviceGroupID=" + nDeviceGroupID;
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
function LogAddActiveDiscoveryActiveMonitor(nDeviceID, nActiveDiscoveryResultSer
viceDetailID,sDisplayName, sMonitorName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
if(sMonitorName == null)
{
sMonitorName = _GetActiveMonitorTypeNameFromActiveDiscoveryServi
ceIDForLog(nActiveDiscoveryResultServiceDetailID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogAddActiveDisco
veryActiveMonitor_Message", sMonitorName, sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
function LogAddActiveDiscoveryPerformanceMonitor(nDeviceID, nActiveDiscoveryResu
ltStatisticalMonitorDetailID,sDisplayName, sMonitorName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameForLog(nDeviceID);
}
if(sMonitorName == null)
{
sMonitorName = _GetStatisticalMonitorTypeNameFromActiveDiscovery
StatisticalMonitorIDForLog(nActiveDiscoveryResultStatisticalMonitorDetailID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogAddActiveDisco
veryPerformanceMonitor_Message", sMonitorName,
sDisplayName);
var sDetails = "nDeviceID=" + nDeviceID;
_LogUserMessage(_GetTranslatedCategory(DEVICES), sDetails, sDescription)
;
}
//--// Action type logging
{
if (null == sActiveMonitorTypeName)
{
sActiveMonitorTypeName = _GetActiveMonitorTypeNameForLog(nActive
MonitorTypeID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogEditedActiveMo
nitorType_Message", sActiveMonitorTypeName);
var sDetails = "nActiveMonitorTypeID=" + nActiveMonitorTypeID;
_LogUserMessage(_GetTranslatedCategory(ACTIVE_MONITOR), sDetails, sDescr
iption);
}
//--// Passive Monitor library logging
//--function LogCreatedPassiveMonitorType(nPassiveMonitorTypeID, sPassiveMonitorType
Name)
{
if (null == sPassiveMonitorTypeName)
{
sPassiveMonitorTypeName = _GetPassiveMonitorTypeNameForLog(nPass
iveMonitorTypeID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogCreatedPassive
MonitorType_Message", sPassiveMonitorTypeName);
var sDetails = "nPassiveMonitorTypeID=" + nPassiveMonitorTypeID;
_LogUserMessage(_GetTranslatedCategory(PASSIVE_MONITOR), sDetails, sDesc
ription);
}
function LogDeletedPassiveMonitorType(nPassiveMonitorTypeID, sPassiveMonitorType
Name)
{
if (null == sPassiveMonitorTypeName)
{
sPassiveMonitorTypeName = _GetPassiveMonitorTypeNameForLog(nPass
iveMonitorTypeID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogDeletedPassive
MonitorType_Message", sPassiveMonitorTypeName);
var sDetails = "nPassiveMonitorTypeID=" + nPassiveMonitorTypeID;
_LogUserMessage(_GetTranslatedCategory(PASSIVE_MONITOR), sDetails, sDesc
ription);
}
function LogEditedPassiveMonitorType(nPassiveMonitorTypeID, sPassiveMonitorTypeN
ame)
{
if (null == sPassiveMonitorTypeName)
{
sPassiveMonitorTypeName = _GetPassiveMonitorTypeNameForLog(nPass
iveMonitorTypeID);
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogEditedPassiveM
onitorType_Message", sPassiveMonitorTypeName);
var sDetails = "nPassiveMonitorTypeID=" + nPassiveMonitorTypeID;
_LogUserMessage(_GetTranslatedCategory(PASSIVE_MONITOR), sDetails, sDesc
ription);
}
n);
}
//--// System logging
//--function LogEditedIPSecurity()
{
var sDescription = oUserTranslateForAdmin.TranslateEx("LogModifedIpSecur
ity_Message");
var sDetails = "nWebUserID=" + GetUserID();
_LogUserMessage(_GetTranslatedCategory(SYSTEM), sDetails, sDescription);
}
function LogEditedWEBServerSettings()
{
var sDescription = oUserTranslateForAdmin.TranslateEx("LogModifedWEBSett
ings_Message");
var sDetails = "nWebUserID=" + GetUserID();
_LogUserMessage(_GetTranslatedCategory(SYSTEM), sDetails, sDescription);
}
function LogModifiedLDAPCredentials()
{
var sDescription = oUserTranslateForAdmin.TranslateEx("LogModifiedLDAPCr
edentials_Message");
var sDetails = "";
_LogUserMessage(_GetTranslatedCategory(SYSTEM), sDetails, sDescription);
}
//--// Web alarm logging
//--function LogDismissedWebAlarmItem(nWebAlarmID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetDeviceDisplayNameFromWebAlarmIDForLog(nWebAla
rmID)
}
var sDescription = oUserTranslateForAdmin.TranslateEx("LogDismissedWebAl
armItem_Message", sDisplayName);
var sDetails = "";
_LogUserMessage(_GetTranslatedCategory(SYSTEM), sDetails, sDescription);
}
function LogDismissedAllWebAlarm()
{
var sDescription = oUserTranslateForAdmin.TranslateEx("LogDismissedAllWe
bAlarm_Message");
var sDetails = "";
_LogUserMessage(_GetTranslatedCategory(SYSTEM), sDetails, sDescription);
}
function LogDeletedRemoteServer(nRemoteServerID, sDisplayName)
{
if(sDisplayName == null)
{
sDisplayName = _GetRemoteServerDisplayNameForLog(nRemoteServerID
);
}
="General";
="Monitors / Actions";
="Devices";
="Reports";
="Alert Center";
="Netflow";
="Remote";
// these rights are shown in the web user dialog in the order that that are adde
d here
_AddUserRight(USERRIGHT_CHANGEYOURPASSWORD,
"Change
Your Password",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
_AddUserRight(USERRIGHT_MANAGEWORKSPACEVIEWS,
"Manage Workspac
e Views",
UR_CATEGORY_GENERAL,
FEATURE_
NONE);
_AddUserRight(USERRIGHT_CONFIGUREWORKSPACES,
"Configure Works
paces",
UR_CATEGORY_GENERAL,
FEATURE_
NONE);
_AddUserRight(USERRIGHT_MANAGEUSERS,
"Manage
Users",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
_AddUserRight(USERRIGHT_MANAGEIPSECURITY,
"Manage
IP Security",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGURELDAPCREDENTIALS,
"Configure LDAP
Credentials",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
_AddUserRight(USERRIGHT_MANAGEWEBSERVER,
Web Server",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGUREMIBS,
SNMP MIBs",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
_AddUserRight(USERRIGHT_TRANSLATION,
tions",
UR_CATEGORY_GENERAL,
FEATURE_NONE);
"Manage
"Manage
"Transla
_AddUserRight(USERRIGHT_CONFIGUREACTIVEMONITORS,
"Configure Activ
e Monitors",
UR_CATEGORY_MONITORS_ACTIONS, FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGUREPASSIVEMONITORS,
"Configure Passi
ve Monitors",
UR_CATEGORY_MONITORS_ACTIONS, FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGUREPERFORMANCEMONITORS, "Configure Performance M
onitors",
UR_CATEGORY_MONITORS_ACTIONS, FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGUREACTIONPOLICIES,
"Configure Actio
n Policies",
UR_CATEGORY_MONITORS_ACTIONS, FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGUREACTIONS,
"Configu
re Actions",
UR_CATEGORY_MONITORS_ACTIONS, FEATURE_
NONE);
_AddUserRight(USERRIGHT_MANAGERECURRINGACTIONS,
"Manage Recurrin
g Actions",
UR_CATEGORY_MONITORS_ACTIONS, FEATURE_NONE);
_AddUserRight(USERRIGHT_MANAGEGROUPS,
"Manage
Groups",
UR_CATEGORY_DEVICES,
FEATURE_NONE);
_AddUserRight(USERRIGHT_MANAGEDEVICES,
"Manage
Devices",
UR_CATEGORY_DEVICES,
FEATURE_NONE);
_AddUserRight(USERRIGHT_ACCESSACTIVEDISCOVERY,
"Access Active D
iscovery Results",
UR_CATEGORY_DEVICES,
FEATURE_NONE);
_AddUserRight(USERRIGHT_CONFIGURECREDENTIALS,
"Configure Crede
ntials",
UR_CATEGORY_DEVICES,
FEATURE_
NONE);
_AddUserRight(USERRIGHT_ACCESSGROUPANDDEVICEREPORTS,
"Access Group and Device
Reports",
UR_CATEGORY_REPORTS,
FEATURE_NONE);
_AddUserRight(USERRIGHT_ACCESSSYSTEMREPORTS,
"Access System R
eports",
UR_CATEGORY_REPORTS,
FEATURE_
NONE);
_AddUserRight(USERRIGHT_ACCESSSSGREPORTS,
"Access
SSG Reports",
UR_CATEGORY_REPORTS,
FEATURE_SSG);
_AddUserRight(USERRIGHT_ACCESSALERTCENTERREPORTS,
nter Reports",
UR_CATEGORY_ALERTCENTER,
NTER);
_AddUserRight(USERRIGHT_CONFIGUREALERTCENTER,
Center",
UR_CATEGORY_ALERTCENTER,
ALERT_CENTER);
"Access Alert Ce
FEATURE_ALERT_CE
_AddUserRight(USERRIGHT_ACCESSNETFLOWREPORTS,
Reports",
UR_CATEGORY_NETFLOW,
NETFLOW);
_AddUserRight(USERRIGHT_NETFLOWCONFIGURE,
re Netflow",
UR_CATEGORY_NETFLOW,
FEATURE_NETFLOW);
"Access Netflow
FEATURE_
_AddUserRight(USERRIGHT_ACCESSREMOTEREPORTS,
"Access Remote R
"Configure Alert
FEATURE_
"Configu
eports",
UR_CATEGORY_REMOTE,
FEATURE_DSTSERVER);
_AddUserRight(USERRIGHT_CONFIGUREREMOTESERVERS,
e Sites",
UR_CATEGORY_REMOTE,
FEATURE_DSTSERVER);
"Configure Remot
{
var oUserRightBits = new Array();
for(var i = 0; i < _oUserRights.length; i++)
{
oUserRightBits.push(_oUserRights[i].m_nUserRight);
}
return oUserRightBits;
}
// returns a sorted object array of user rights
function GetUserRights()
{
return _oUserRights;
}
//--// Returns a boolean - true if the user has nUserRight
//
false if not. The nUserRightsMask is optional in case
//
there is need to test a different user
//
(other than the currently logged in user)
//--function UserHasRight(nUserRight, nUserRightsMask)
{
// if nUserRightsMask is omitted then it uses the current users mask
if(nUserRightsMask == null)
{
nUserRightsMask = _GetUserRightsMask();
}
// if the user right name does not exist than the feature associated wit
h the user right
// is not enabled so return false
var sUserRightName = GetUserRightName(nUserRight);
if(sUserRightName == null)
{
return false;
}
// check for the hex in case the value comes from the db - this is
if(nUserRightsMask == USERRIGHT_ALL)
{
return true;
}
// nUserRightsMask could be null if the user is the console or a webarch
ive
if(nUserRightsMask == null)
{
return false;
}
else
{
return (nUserRightsMask & nUserRight) == nUserRight;
}
}
//--// Attempts to log the user in
//--function UserLogin(sUserName, sPassword)
{
_CheckProductLicense();
sPassword = sPassword || "";
var oUser = Server.CreateObject("CoreAsp.User");
var oResult = oUser.LoginUser(sUserName, sPassword);
if(oResult.Failed)
{
var sLoginError = oUserTranslate.TranslateEx("UserLoginError", o
Result.GetErrorMsg);
oAspForm.SetError(sLoginError);
return false;
}
Session("nWebUserID")
Session("sUserName")
Session("nUserRightsMask")
Session("nHomeDeviceGroupID")
=
=
=
=
oUser.m_nUserID;
sUserName;
oUser.m_nUserRightsMask;
_GetUsersHomeDeviceGroupID(oUser.m_nUser
ID);
Session("WebUserData") = null;
SetUserLanguageID(oUser.m_nLanguageID);
if(IsDashboardRequest()==false)
{
// don't log if if a dashboard request as it
// creates a new session every refresh
LogUserLoggedIn();
}
if(IsUserDemoUser())
{
if(!IsDemoServerEnabled())
{
var sLoginError = oUserTranslate.TranslateEx("DemoUserLo
ginError");
oAspForm.SetError(sLoginError);
UserLogout();
return false;
}
Session("bShowDemoUserMessage") = true;
}
return true;
}
//--// Logs the user out
//--function UserLogout()
{
// set all user session variables to null
if(IsDashboardRequest()==false)
{
// don't log if if a dashboard request as it
// creates a new session every refresh
LogUserLoggedOut();
}
Session("USER_GROUP_ACCESS_" + GetUserIDForGroupAccess()) = null;
Session("USER_DEVICE_ACCESS_" + GetUserIDForGroupAccess()) = null;
Session("sRedirectUrl") = null;
Session("nWebUserID") = null;
Session("sUserName") = null;
Session("nUserRightsMask") = null;
Session("nHomeDeviceGroupID") = null;
SetUserLanguageID(null);
Session("UsersRootDeviceGroupID") = null;
Session("WebUserData") = null;
Session("bShowDemoUserMessage") = null;
}
// tests to see if the request came from the dashboard
function IsDashboardRequest()
{
var bIsDashboardRequest = parseInt(oAspForm.GetValueAsString("bIsDashboa
rdRequest"));
if(bIsDashboardRequest==1)
{
return true;
}
return false;
}
// May want to add logic for determining the users home
function UserGetHomeUrl()
{
return "/NmConsole/Workspace/HomeWorkspace/HomeWorkspace.asp";
}
//--// Get the current user id. If null then the user is not logged in.
//--function GetUserID()
{
// if a web archive or the console then return the admin userid
if(IsUserAWebArchive())
{
Session("nWebUserID") = ADMIN_USERID;
return ADMIN_USERID;
}
else if(Session("nWebUserID") == null)
{
return null;
}
else
{
return parseInt(Session("nWebUserID"));
}
}
//--// Get the current users name. If null then the user is not logged in.
//--function GetUserName()
{
// if a web archive or the console then return the admin user name
if(IsUserAWebArchive())
{
return ADMIN_USERNAME;
}
else
{
return Session("sUserName");
}
}
//--// Get the users language id. If null return english.
//--function GetUserLanguageID()
{
if(Session("nUserLanguageID") == null)
{
return LANGUAGEID_ENGLISH;
}
else
{
return Session("nUserLanguageID");
}
}
//--// Get the admuin users language id. If null return english.
//--function GetAdminUserLanguageID()
{
if(Session("ADMIN_nLanguageID") != null)
{
return Session("ADMIN_nLanguageID");
}
var oDb = GetDb();
var sSql = "SELECT nLanguageID FROM WebUser WHERE nWebUserID = " + ADMIN
_USERID;
var oResult = oDb.ExecSql(sSql);
if (oResult.Failed)
{
var sTranlsationError = oUserTranslate.TranslateEx("GetAdminUser
LanguageID_Error", oResult.GetErrorMsg);
oAspForm.SetError(sTranlsationError);
return LANGUAGEID_ENGLISH;
}
var nLanguageID = LANGUAGEID_ENGLISH;
if(!oDb.IsEOF)
{
nLanguageID = oDb.GetFieldAsLong("nLanguageID");
}
Session("ADMIN_nLanguageID") = nLanguageID;
return nLanguageID;
}
// transform the ipswitch web server session ID to
// match the IIS session ID
function GetUserSessionIDAsNumber()
{
if( IsWebServerIpswitch() )
{
var sID = String(Session.SessionID);
var oRegEx = new RegExp("(\\D+)", "g");
sID = sID.replace(oRegEx, "");
if( sID.length > 9 )
{
case WBU_DEVICESTAB_REFRESHINTERVAL:
return REFRESH_DEFAULT;
case WUD_WEBALARMS_REFRESHINTERVAL:
return REFRESH_DEFAULT;
case WUD_SHOWBUBBLE_ONWORKSPACEREPORTS:
return SHOWBUBBLE_DEFAULT;
case WUD_SHOWBUBBLE_ONFULLREPORTS:
return SHOWBUBBLE_DEFAULT;
case WUD_DYNAMICSSGLEGENDS:
return "false";
case WUD_SHOWNETFLOW_TOOLTIPS:
return SHOWTOOLTIPS_DEFAULT;
}
return sValue
}
function SetWebUserData(nWebUserID, sName, sValue)
{
var oDb = GetDb();
var sSql = ""
+ "SET NOCOUNT ON "
+ "UPDATE WebUserData SET "
+ " sValue = " + oDb.QuoteString(sValue) + " "
+ "WHERE nWebUserID = " + nWebUserID
+ "
AND sName = " + oDb.QuoteString(sName) + " "
+ "SELECT @@ROWCOUNT AS nRowsAffected";
var oResult = oDb.ExecSql(sSql);
if(oResult.Failed || oDb.IsEOF)
{
oAspForm.SetError(oResult.GetErrorMsg);
return false;
}
// determine if the update effected any rows
var nUpdatedRows = oDb.GetFieldAsLong("nRowsAffected");
if(0 != nUpdatedRows)
{
// update worked
Session("WebUserData") = null;
return true;
}
// update did not effect any rows so do an insert
var sSql = ""
+ "INSERT INTO WebUserData "
+ "(nWebUserID, sName, sValue) "
+ "VALUES "
+ "(" + nWebUserID + ","
+ oDb.QuoteString(sName) + ","
+ oDb.QuoteString(sValue) + ")";
var oResult = oDb.ExecSql(sSql);
if(oResult.Failed)
{
oAspForm.SetError(oResult.GetErrorMsg);
return false;
}
Session("WebUserData") = null;
return true;
}
function IsUserDemoUser()
{
var bIsDemoUser = GetWebUserData(WUD_ISDEMOUSER);
if(bIsDemoUser == "1")
{
return true;
}
else
{
return false;
}
}
function DemoUserIsRestricted(sAdditionalMessage)
{
if(IsUserDemoUser())
{
if(sAdditionalMessage == null)
{
sAdditionalMessage = "";
}
else
{
sAdditionalMessage = "\n\n" + sAdditionalMessage;
}
var sError = oUserTranslate.TranslateEx("DemoUserRestricted", sA
dditionalMessage);
oAspForm.SetError(sError);
return true;
}
return false;
}
//--// User Group / Device Access
//--var DEVICE_READ = 4;
var DEVICE_WRITE = 3;
var GROUP_READ = 2;
var GROUP_WRITE = 1;
// Determines if the user has specified access rights to the specified group
function UserHasGroupAccess(nDeviceGroupID, nAccessType)
{
// if just trying to read the default all devices group then
// allow this since userrights will take care of the rest
if(nAccessType==GROUP_READ && nDeviceGroupID==GROUPID_ALLDEVICES)
{
return true;
}
// User also needs manage groups rights for group write right
if(nAccessType == GROUP_WRITE && false == UserHasRight(USERRIGHT_MANAGEG
ROUPS))
{
return false;
}
// if the current user is the admin always return true
if(GetUserIDForGroupAccess() == ADMIN_USERID)
{
return true;
}
var oRights = _GetUserGroupRights(nDeviceGroupID)
if(oRights[nAccessType] > 0)
{
return true;
}
else
{
return false;
}
}
// Determines if the user has specified access rights to the specified device
function UserHasDeviceAccess(nDeviceID, nAccessType)
{
// User also needs manage devices rights for device write right
if(nAccessType == DEVICE_WRITE && false == UserHasRight(USERRIGHT_MANAGE
DEVICES))
{
return false;
}
// if the current user is the admin always return true
if(GetUserIDForGroupAccess() == ADMIN_USERID)
{
return true;
}
var oRights = _GetUserDeviceRights(nDeviceID)
if(oRights[nAccessType] > 0)
{
return true;
}
else
{
return false;
}
}
// Checks if the access rights are enabled
// and returns the user id to use for access rights
function GetUserIDForGroupAccess()
{
if(GetUserID() == ADMIN_USERID)
{
return ADMIN_USERID;
}
else if(_IsUserGroupAccessEnabled())
{
return GetUserID();
}
else
{
return ADMIN_USERID;
}
}
function IsUserGroupAccessEnabled()
{
return _IsUserGroupAccessEnabled()
}
var g_oTranslateForAdmin = null;
function GetTranslationObjectForAdminUser()
{
if(g_oTranslateForAdmin != null)
{
return g_oTranslateForAdmin;
}
g_oTranslateForAdmin = Server.CreateObject("CoreAsp" + ".Translate");
g_oTranslateForAdmin.Initialize("User.inc", GetAdminUserLanguageID());
return g_oTranslateForAdmin;
}
// gets the sValue from the GlobalSettings db table associated with sName
// if there is an error or IsEOF then the function will return null
function GetGlobalSetting(sName)
{
var oDb = GetCacheDb();
var sSql = "SELECT sValue FROM GlobalSettings WHERE sName = " + oDb.Quot
eString(sName);
var oResult = oDb.ExecSQL(sSql);
if(oResult.Failed==true)
{
oAspForm.SetError(oResult.GetErrorMsg);
return null;
}
if(oDb.IsEOF==true)
{
return null;
}
return oDb.GetFieldAsString("sValue");
}
// inserts or updates a row in the GlobalSettings db table
function SetGlobalSetting(sName, sValue)
{
var oDb = GetCacheDb();
var sSql = ""
+ "SET NOCOUNT ON "
+ "UPDATE GlobalSettings SET "
+ " sValue = " + oDb.QuoteString(sValue) + " "
+ "WHERE sName = " + oDb.QuoteString(sName)
+ "SELECT @@ROWCOUNT AS nRowsAffected";
var oResult = oDb.ExecSql(sSql);
if(oResult.Failed || oDb.IsEOF)
{
oAspForm.SetError(oResult.GetErrorMsg);
return false;
}
// determine if the update effected any rows
var nUpdatedRows = oDb.GetFieldAsLong("nRowsAffected");
if(0 != nUpdatedRows)
{
// update worked
return true;
}
// update did not effect any rows so do an insert
var sSql = ""
+ "INSERT INTO GlobalSettings "
+ "(sName, sValue) "
+ "VALUES "
+ "(" + oDb.QuoteString(sName) + ","
+ oDb.QuoteString(sValue) + ")";
var oResult = oDb.ExecSql(sSql);
if(oResult.Failed)
{
oAspForm.SetError(oResult.GetErrorMsg);
return false;
}
return true;
}
// make the users configure rights available to the client for
// building the dynamic configure menu
_WriteConfigureMenuAccessRights();
// function to test if the user has turned off a certain bubble type
function IsBubbleTypeTurnedOn(nBubbleType)
{
switch(nBubbleType)
{
case BUBBLETYPE_WORKSPACEREPORT:
if(GetWebUserData(WUD_SHOWBUBBLE_ONWORKSPACEREPORTS) ==
"false")
{
return false;
break;
}
else
{
return true;
break;
}
case BUBBLETYPE_FULLREPORT:
if(GetWebUserData(WUD_SHOWBUBBLE_ONFULLREPORTS) == "fals
e")
{
return false;
break;
}
}
return true;
}
function IsTooltipEnabled()
{
if(GetWebUserData(WUD_SHOWNETFLOW_TOOLTIPS) == "false")
{
return false;
}
return true;
}
Response.WriteHtml("\n");
Response.Clear();
var oRequest = InitializeRequest();
var oResponse = InitializeResponse();
// if user does not have manage device right then return false
if(!UserHasRight(USERRIGHT_MANAGEDEVICES))
{
oResponse.m_bHasWebAlarms = false;
SendResult(oResponse);
}
// get the list of webalarms
var sPivotDeviceToGroupTable = GetUniqueTempTableName();
var sSql = "EXEC LoadDeviceGroup -1, " + GetUserIDForGroupAccess() + ", '" + sPi
votDeviceToGroupTable + "' " +
"SELECT WebAlarmLog.nWebAlarmLogID, " +
"
WebAlarmLog.sSoundFilename, " +
"
WebAlarmLog.sMessage, " +
"
WebAlarmLog.dDateTime, " +
"
Device.nDeviceID, " +
"
Device.sDisplayName, " +
"
NetworkInterface.sNetworkName, " +
"
NetworkInterface.sNetworkAddress, " +
"
MonitorState.sStateName, " +
"
ActiveMonitorType.sMonitorTypeName AS sActiveMon
itorTypeName, " +
"
PivotActiveMonitorTypeToDevice.sArgument, " +
"
PivotActiveMonitorTypeToDevice.sComment, " +
"
Device.nBestStateID, " +
"
Device.nWorstStateID " +
"FROM WebAlarmLog " +
"INNER JOIN Device ON Device.nDeviceID = WebAlarmLog.nDe
viceID " +
"INNER JOIN NetworkInterface ON NetworkInterface.nNetwor
kInterfaceID = " +
"
Device.nDefaultNetworkInterfaceID " +
"LEFT OUTER JOIN MonitorState ON MonitorState.nMonitorSt
ateID = " +
"
WebAlarmLog.nMonitorStateID " +
"LEFT OUTER JOIN PivotActiveMonitorTypeToDevice ON " +
"
PivotActiveMonitorTypeToDevice.nPivotActiveMonit
orTypeToDeviceID = " +
"
WebAlarmLog.nPivotActiveMonitorTypeToDeviceID "
+
"LEFT OUTER JOIN ActiveMonitorType ON PivotActiveMonitor
TypeToDevice.nActiveMonitorTypeID = " +
"
ActiveMonitorType.nActiveMonitorTypeID " +
"INNER JOIN " + sPivotDeviceToGroupTable +
"
P ON P.nDeviceID=Device.nDeviceID " +
"WHERE Device.bRemoved = 0
" +
"ORDER by dDateTime DESC";