本文整理汇总了C#中dataAccess.addSecurityLog方法的典型用法代码示例。如果您正苦于以下问题:C# dataAccess.addSecurityLog方法的具体用法?C# dataAccess.addSecurityLog怎么用?C# dataAccess.addSecurityLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dataAccess
的用法示例。
在下文中一共展示了dataAccess.addSecurityLog方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: wmUpdateTaskParam
public string wmUpdateTaskParam(string sType, string sID, string sParamID,
string sName, string sDesc,
string sRequired, string sPrompt, string sEncrypt, string sPresentAs, string sValues)
{
dataAccess dc = new dataAccess();
acUI.acUI ui = new acUI.acUI();
FunctionTemplates.HTMLTemplates ft = new FunctionTemplates.HTMLTemplates();
if (!ui.IsGUID(sID))
throw new Exception("Invalid or missing ID.");
string sErr = "";
string sSQL = "";
//we encoded this in javascript before the ajax call.
//the safest way to unencode it is to use the same javascript lib.
//(sometimes the javascript and .net libs don't translate exactly, google it.)
sDesc = ui.unpackJSON(sDesc).Trim();
//normalize and clean the values
sRequired = (dc.IsTrue(sRequired) ? "true" : "false");
sPrompt = (dc.IsTrue(sPrompt) ? "true" : "false");
sEncrypt = (dc.IsTrue(sEncrypt) ? "true" : "false");
sName = sName.Trim().Replace("'", "''");
string sTable = "";
string sXML = "";
string sParameterXPath = "//parameter[@id = \"" + sParamID + "\"]"; //using this to keep the code below cleaner.
if (sType == "ecosystem")
sTable = "ecosystem";
else if (sType == "task")
sTable = "task";
bool bParamAdd = false;
//bool bParamUpdate = false;
//if sParamID is empty, we are adding
if (string.IsNullOrEmpty(sParamID))
{
sParamID = "p_" + ui.NewGUID();
sParameterXPath = "//parameter[@id = \"" + sParamID + "\"]"; //reset this if we had to get a new id
//does the task already have parameters?
sSQL = "select parameter_xml from " + sTable + " where " + sType + "_id = '" + sID + "'";
if (!dc.sqlGetSingleString(ref sXML, sSQL, ref sErr))
throw new Exception(sErr);
string sAddXML = "<parameter id=\"" + sParamID + "\" required=\"" + sRequired + "\" prompt=\"" + sPrompt + "\" encrypt=\"" + sEncrypt + "\">" +
"<name>" + sName + "</name>" +
"<desc>" + sDesc + "</desc>" +
"</parameter>";
if (string.IsNullOrEmpty(sXML))
{
//XML doesn't exist at all, add it to the record
sAddXML = "<parameters>" + sAddXML + "</parameters>";
sSQL = "update " + sTable + " set " +
" parameter_xml = '" + sAddXML + "'" +
" where " + sType + "_id = '" + sID + "'";
if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
throw new Exception(sErr);
bParamAdd = true;
}
else
{
//XML exists, add the node to it
ft.AddNodeToXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", "//parameters", sAddXML);
bParamAdd = true;
}
}
else
{
//update the node values
ft.SetNodeValueinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath + "/name", sName);
ft.SetNodeValueinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath + "/desc", sDesc);
//and the attributes
ft.SetNodeAttributeinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath, "required", sRequired);
ft.SetNodeAttributeinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath, "prompt", sPrompt);
ft.SetNodeAttributeinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath, "encrypt", sEncrypt);
bParamAdd = false;
}
// not clean at all handling both tasks and ecosystems in the same method, but whatever.
if (bParamAdd)
{
if (sType == "task") { ui.WriteObjectAddLog(Globals.acObjectTypes.Task, sID, "Parameter", "Added Parameter:" + sName ); };
if (sType == "ecosystem") { ui.WriteObjectAddLog(Globals.acObjectTypes.Ecosystem, sID, "Parameter", "Added Parameter:" + sName); };
}
else
{
// would be a lot of trouble to add the from to, why is it needed you have each value in the log, just scroll back
// so just add a changed message to the log
if (sType == "task") { dc.addSecurityLog(ui.GetSessionUserID(), Globals.SecurityLogTypes.Object, Globals.SecurityLogActions.ObjectModify, Globals.acObjectTypes.Task, sID, "Parameter Changed:[" + sName + "]", ref sErr); };
if (sType == "ecosystem") { dc.addSecurityLog(ui.GetSessionUserID(), Globals.SecurityLogTypes.Object, Globals.SecurityLogActions.ObjectModify, Globals.acObjectTypes.Ecosystem, sID, "Parameter Changed:[" + sName + "]", ref sErr); };
//.........这里部分代码省略.........
示例2: wmSetSystemCondition
public string wmSetSystemCondition(string sSetToStatus)
{
acUI.acUI ui = new acUI.acUI();
if (!ui.UserIsInRole("Administrator"))
{
return "Only an Administrator can perform this action.";
}
else
{
if (sSetToStatus == "")
{
return "Unable to set System condition - 'up' or 'down' status argument is required.";
}
dataAccess dc = new dataAccess();
string sErr = null;
if (sSetToStatus == "down")
{
wmKickAllUsers();
wmSetAllPollers("off");
wmSetScheduler("off");
//kill all running tasks
if (!dc.sqlExecuteUpdate("update task_instance set task_status = 'Aborting' where task_status = 'Processing'", ref sErr))
{ throw new Exception(sErr); }
//lock out users
if (!dc.sqlExecuteUpdate("update login_security_settings set allow_login = 0", ref sErr))
{ throw new Exception(sErr); }
}
else
{
wmSetAllPollers("on");
wmSetScheduler("on");
//allow login
if (!dc.sqlExecuteUpdate("update login_security_settings set allow_login = 1", ref sErr))
{ throw new Exception(sErr); }
}
// add security log
dc.addSecurityLog(ui.GetSessionUserID(), SecurityLogTypes.Security, SecurityLogActions.ConfigChange, acObjectTypes.None, "", "System Condition set to [" + sSetToStatus + "]", ref sErr);
// no errors to here, so return an empty string
return "";
}
}
示例3: wmLogout
public bool wmLogout()
{
dataAccess dc = new dataAccess();
acUI.acUI ui = new acUI.acUI();
try
{
string sUserID = ui.GetSessionUserID();
string sUserName = ui.GetSessionUsername();
string sErr = "";
dc.addSecurityLog(sUserID, Globals.SecurityLogTypes.Security, Globals.SecurityLogActions.UserLogout, Globals.acObjectTypes.None, sUserName, "Manual Log Out", ref sErr);
System.Web.Security.FormsAuthentication.SignOut();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return true;
}
示例4: wmSetScheduler
public string wmSetScheduler(string sSetToStatus)
{
acUI.acUI ui = new acUI.acUI();
if (!ui.UserIsInRole("Administrator"))
{
return "Only an Administrator can perform this action.";
}
else
{
if (sSetToStatus == "")
{
return "Unable to set Scheduler - 'on' or 'off' status argument is required.";
}
dataAccess dc = new dataAccess();
string sErr = null;
/*
Simply flips the switch on all pollers and logservers to either on or off based on the argument.
*/
string sStatus = (dc.IsTrue(sSetToStatus) ? "on" : "off");
try
{
if (!dc.sqlExecuteUpdate("update scheduler_settings set mode_off_on = '" + sStatus + "'", ref sErr)) { throw new Exception(sErr); }
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
// add security log
dc.addSecurityLog(ui.GetSessionUserID(), SecurityLogTypes.Security, SecurityLogActions.ConfigChange, acObjectTypes.None, "", "Scheduler set to [" + sStatus + "]", ref sErr);
// no errors to here, so return an empty string
return "";
}
}
示例5: wmKickAllUsers
public string wmKickAllUsers()
{
acUI.acUI ui = new acUI.acUI();
if (!ui.UserIsInRole("Administrator"))
{
return "Only an Administrator can perform this action.";
}
else
{
dataAccess dc = new dataAccess();
string sErr = null;
/*
Gives all users a one minute warning, then kicks them.
*/
try
{
if (!dc.sqlExecuteUpdate("update user_session set kick=1 where user_id in " +
" (select user_id from users where user_role <> 'Administrator')"
, ref sErr)) { throw new Exception(sErr); }
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
// add security log
dc.addSecurityLog(ui.GetSessionUserID(), SecurityLogTypes.Security, SecurityLogActions.ConfigChange, acObjectTypes.None, "", "All Users were just kicked by [" + ui.GetSessionUsername() + "]", ref sErr);
// no errors to here, so return an empty string
return "";
}
}