656 lines
28 KiB
C#
656 lines
28 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Security;
|
|
using System.Text;
|
|
using System.Xml;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using C4IT.Configuration;
|
|
using C4IT.FASD.Base;
|
|
using C4IT.Logging;
|
|
using C4IT.XML;
|
|
|
|
using static C4IT.Logging.cLogManager;
|
|
using static C4IT.Configuration.cConfigRegistryHelper;
|
|
|
|
namespace C4IT.DataHistoryProvider
|
|
{
|
|
public class cDataHistoryConfigGolabalParameters : cFasdBaseConfig
|
|
{
|
|
public const string constFileNameF4sdConfig = "F4SD-Global-Configuration.xml";
|
|
private const string constFileNameF4sdSchema = "F4SD-Global-Configuration.xsd";
|
|
private const string constConfigRootElement = "F4SD-Global-Configuration";
|
|
|
|
public cConfigHelperParameterList Parameters { get; private set; } = null;
|
|
public cActivityFilterPolicy ActivityFilters { get; private set; } = new cActivityFilterPolicy();
|
|
|
|
private cDataHistoryConfigInfrastructure InfrastructureConfig = null;
|
|
|
|
internal cDataHistoryConfigGolabalParameters(cDataHistoryConfigInfrastructure configInfrastructure) :
|
|
base(constFileNameF4sdConfig, constFileNameF4sdSchema, constConfigRootElement, true)
|
|
{
|
|
InfrastructureConfig = configInfrastructure;
|
|
}
|
|
|
|
public override bool InstantiateProperties(XmlElement RootElement, cXmlParser Parser)
|
|
{
|
|
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
|
|
|
try
|
|
{
|
|
Parameters = LoadParameters(RootElement, Parser );
|
|
|
|
var _s = JsonConvert.SerializeObject(Parameters, Newtonsoft.Json.Formatting.Indented);
|
|
|
|
this.IsValid = true;
|
|
|
|
return true;
|
|
}
|
|
catch (Exception E)
|
|
{
|
|
LogException(E);
|
|
}
|
|
finally
|
|
{
|
|
if (CM != null) LogMethodEnd(CM);
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
private cConfigHelperParameterList LoadParameters (XmlElement XRoot, cXmlParser Parser)
|
|
{
|
|
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
|
|
|
var _result = new cConfigHelperParameterList();
|
|
|
|
try
|
|
{
|
|
var Items = XRoot.ChildNodes;
|
|
foreach (var _node in Items)
|
|
{
|
|
if (!(_node is XmlElement _item)) continue;
|
|
|
|
Parser.EnterElement(_item.Name);
|
|
|
|
try
|
|
{
|
|
var _attPolicy = _item.GetAttribute("Policy");
|
|
var _attValue = _item.GetAttribute("Value");
|
|
|
|
var _ElementCount = 0;
|
|
foreach (XmlNode _subNode in _item.ChildNodes)
|
|
{
|
|
if (_subNode is XmlElement)
|
|
_ElementCount++;
|
|
}
|
|
|
|
// check for special parameters
|
|
switch (_item.Name)
|
|
{
|
|
case "InformationClassSearchPriority":
|
|
var _val = getInformationClassSearchPriority(_item, Parser);
|
|
if (_val != null)
|
|
_result.Items[_val.Name] = _val;
|
|
continue;
|
|
case "OpenActivitiesExternally":
|
|
var _openActivitiesEntry = getOpenActivitiesExternallyEntry(_item);
|
|
if (_openActivitiesEntry != null)
|
|
_result.Items[_openActivitiesEntry.Name] = _openActivitiesEntry;
|
|
|
|
var _overrideValues = getOpenActivitiesExternallyOverrides(_item, Parser);
|
|
if (_overrideValues != null && _overrideValues.ValueList != null && _overrideValues.ValueList.Count > 0)
|
|
_result.Items[_overrideValues.Name] = _overrideValues;
|
|
continue;
|
|
case "TicketProcessing":
|
|
var _ticketProcessingEntry = getTicketProcessingEntry(_item, Parser);
|
|
if (_ticketProcessingEntry != null)
|
|
_result.Items[_ticketProcessingEntry.Name] = _ticketProcessingEntry;
|
|
continue;
|
|
case "ActivityFilters":
|
|
ActivityFilters = getActivityFilters(_item, Parser);
|
|
continue;
|
|
}
|
|
|
|
if (_attPolicy != null && _attValue != null && _ElementCount == 0)
|
|
{
|
|
// we have a simple parameter
|
|
var _policy = cXmlParser.GetEnumFromAttribute<enumConfigPolicy>(_item, "Policy", enumConfigPolicy.Default);
|
|
var _value = cXmlParser.GetStringFromXmlAttribute(_item, "Value", String.Empty);
|
|
|
|
_result.Items[_item.Name] = new cConfigHelperParameterEntry()
|
|
{
|
|
Name = _item.Name,
|
|
Value = _value,
|
|
Policy = _policy.ToString(),
|
|
};
|
|
}
|
|
else if (string.IsNullOrEmpty(_attPolicy) && string.IsNullOrEmpty(_attValue) && _ElementCount > 0)
|
|
{
|
|
// we have a sublist
|
|
if (_result.SubItems == null)
|
|
_result.SubItems = new Dictionary<string, cConfigHelperParameterList>();
|
|
_result.SubItems[_item.Name] = LoadParameters(_item, Parser);
|
|
}
|
|
else
|
|
{
|
|
// we have an invalid entry
|
|
var _msg = $"Invalid entry in F4SD-Global-Configuration.xml: {_item.Name}";
|
|
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
|
LogEntry(_msg, LogLevels.Warning);
|
|
}
|
|
}
|
|
catch (Exception E)
|
|
{
|
|
LogException(E);
|
|
}
|
|
finally
|
|
{
|
|
Parser.LeaveElement(_item.Name);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception E)
|
|
{
|
|
LogException(E);
|
|
}
|
|
finally
|
|
{
|
|
if (CM != null) LogMethodEnd(CM);
|
|
}
|
|
|
|
return _result;
|
|
}
|
|
|
|
private static cActivityFilterPolicy getActivityFilters(XmlElement node, cXmlParser parser)
|
|
{
|
|
var result = new cActivityFilterPolicy();
|
|
foreach (XmlElement filterNode in node.SelectNodes("Filter").OfType<XmlElement>())
|
|
{
|
|
parser.EnterElement(filterNode.Name);
|
|
try
|
|
{
|
|
if (!Enum.TryParse(filterNode.GetAttribute("Match"), true, out enumActivityFilterMatch match))
|
|
match = enumActivityFilterMatch.exclude;
|
|
if (!Enum.TryParse(filterNode.GetAttribute("EmptyHandling"), true, out enumActivityFilterEmptyHandling emptyHandling))
|
|
emptyHandling = enumActivityFilterEmptyHandling.include;
|
|
|
|
var filter = new cActivityFilter
|
|
{
|
|
Provider = filterNode.GetAttribute("Provider"),
|
|
Field = filterNode.GetAttribute("Field"),
|
|
Enabled = bool.TryParse(filterNode.GetAttribute("Enabled"), out var enabled) && enabled,
|
|
Match = match,
|
|
EmptyHandling = emptyHandling
|
|
};
|
|
|
|
foreach (XmlElement valueNode in filterNode.SelectNodes("Value").OfType<XmlElement>())
|
|
{
|
|
filter.Values.Add(new cActivityFilterValue
|
|
{
|
|
ID = valueNode.GetAttribute("ID"),
|
|
Name = valueNode.GetAttribute("Name")
|
|
});
|
|
}
|
|
|
|
result.Filters.Add(filter);
|
|
}
|
|
finally
|
|
{
|
|
parser.LeaveElement(filterNode.Name);
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
private string getDefaultActivityFiltersXml()
|
|
{
|
|
var queueOption = InfrastructureConfig?.M42Wpm?.ActivityQueueFilterOption
|
|
?? enumActivityQueueFilterOptions.showAll;
|
|
var queues = InfrastructureConfig?.M42Wpm?.ActivityQueues
|
|
?? new List<cApiM42TicketQueueInfo>();
|
|
var enableQueueFilter = queueOption != enumActivityQueueFilterOptions.showAll && queues.Count > 0;
|
|
var emptyHandling = queueOption == enumActivityQueueFilterOptions.onlyListedQueues
|
|
? enumActivityFilterEmptyHandling.exclude
|
|
: enumActivityFilterEmptyHandling.include;
|
|
|
|
var xml = new StringBuilder();
|
|
xml.Append("<ActivityFilters>");
|
|
xml.AppendFormat(
|
|
"<Filter Provider=\"Matrix42\" Field=\"Queue\" Enabled=\"{0}\" Match=\"include\" EmptyHandling=\"{1}\">",
|
|
enableQueueFilter.ToString().ToLowerInvariant(),
|
|
emptyHandling);
|
|
foreach (var queue in queues.Where(queue => queue != null))
|
|
{
|
|
xml.AppendFormat(
|
|
"<Value ID=\"{0}\" Name=\"{1}\" />",
|
|
queue.QueueID == Guid.Empty ? string.Empty : queue.QueueID.ToString("D"),
|
|
SecurityElement.Escape(queue.QueueName ?? string.Empty));
|
|
}
|
|
xml.Append("</Filter>");
|
|
xml.Append("<Filter Field=\"AssignmentGroup\" Enabled=\"false\" Match=\"include\" EmptyHandling=\"exclude\">");
|
|
xml.Append("<Value ID=\"0a76de08-136c-764a-b410-5610e8076712\" Name=\"HR Service Desk Agent\" />");
|
|
xml.Append("<Value ID=\"0b76de08-8668-a026-b410-5610e8076f95\" Name=\"HR-Manager\" />");
|
|
xml.Append("<Value ID=\"0a76de08-d589-4c94-b410-5610e8076919\" Name=\"HR-Spezialist\" />");
|
|
xml.Append("<Value ID=\"e87dde08-235c-04e5-b410-562b64035575\" Name=\"Facility-Koordinator\" />");
|
|
xml.Append("</Filter>");
|
|
xml.Append("<Filter Provider=\"Matrix42\" Field=\"Workspace\" Enabled=\"false\" Match=\"include\" EmptyHandling=\"exclude\">");
|
|
xml.Append("<Value ID=\"1676de08-27f3-550c-b410-5610e807aa02\" Name=\"HR Service Management\" />");
|
|
xml.Append("<Value ID=\"ed7dde08-199e-c27b-b410-562b64037aa1\" Name=\"Gebäudemanagement\" />");
|
|
xml.Append("</Filter>");
|
|
xml.Append("</ActivityFilters>");
|
|
return xml.ToString();
|
|
}
|
|
|
|
private cConfigHelperParameterEntry getInformationClassSearchPriority(XmlElement XNode, cXmlParser Parser)
|
|
{
|
|
|
|
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
|
|
|
try
|
|
{
|
|
var _xNodes = XNode.ChildNodes;
|
|
|
|
var _policy = cXmlParser.GetEnumFromAttribute<enumConfigPolicy>(XNode, "Policy", enumConfigPolicy.Default);
|
|
|
|
var _result = new List<string>();
|
|
|
|
foreach (var _xNode in _xNodes)
|
|
{
|
|
if (!(_xNode is XmlElement _item))
|
|
continue;
|
|
|
|
Parser.EnterElement(_item.Name);
|
|
|
|
try
|
|
{
|
|
if (_item.Name != "InformationClass")
|
|
{
|
|
// we have an invalid entry
|
|
var _msg = $"Invalid entry in F4SD-Global-Configuration.xml: {_item.Name}, should be <InformationClass/>";
|
|
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
|
LogEntry(_msg, LogLevels.Warning);
|
|
continue;
|
|
}
|
|
|
|
var _InfoClass = cXmlParser.GetEnumFromAttribute<enumFasdInformationClass>(_item, "Type", enumFasdInformationClass.Unknown);
|
|
if (_InfoClass == enumFasdInformationClass.Unknown)
|
|
{
|
|
// we have an invalid type attribute
|
|
var _strType = cXmlParser.GetStringFromXmlAttribute(_item, "Type", String.Empty);
|
|
var _msg = $"Invalid type attribute value ({_strType}) in entry {_item.Name}";
|
|
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
|
LogEntry(_msg, LogLevels.Warning);
|
|
continue;
|
|
}
|
|
|
|
var _strInfoClass = _InfoClass.ToString();
|
|
if (!_result.Contains(_strInfoClass))
|
|
_result.Add(_strInfoClass);
|
|
}
|
|
catch (Exception E)
|
|
{
|
|
LogException(E);
|
|
}
|
|
finally
|
|
{
|
|
Parser.LeaveElement(_item.Name);
|
|
}
|
|
}
|
|
|
|
return new cConfigHelperParameterEntry()
|
|
{
|
|
Name = XNode.Name,
|
|
ValueList = _result,
|
|
Policy = _policy.ToString()
|
|
};
|
|
}
|
|
catch (Exception E)
|
|
{
|
|
LogException(E);
|
|
}
|
|
finally
|
|
{
|
|
if (CM != null) LogMethodEnd(CM);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
private static cConfigHelperParameterEntry getTicketProcessingEntry(XmlElement XNode, cXmlParser Parser)
|
|
{
|
|
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
|
|
|
try
|
|
{
|
|
var _xNodes = XNode.SelectNodes("TicketTypeProcessing");
|
|
|
|
var _policy = cXmlParser.GetEnumFromAttribute<enumConfigPolicy>(XNode, "Policy", enumConfigPolicy.Default);
|
|
var _value = cXmlParser.GetEnumFromAttribute<enumTicketProcessing>(XNode, "Value", enumTicketProcessing.Both);
|
|
|
|
var _result = new List<string>();
|
|
|
|
foreach (var _xNode in _xNodes)
|
|
{
|
|
if (!(_xNode is XmlElement _item))
|
|
continue;
|
|
|
|
Parser.EnterElement(_item.Name);
|
|
|
|
try
|
|
{
|
|
var _ticketType = cXmlParser.GetEnumFromAttribute<enumTicketType>(_item, "Type", enumTicketType.Ticket);
|
|
var _processingValue = cXmlParser.GetEnumFromAttribute<enumTicketProcessing>(_item, "Value", enumTicketProcessing.Both);
|
|
_result.Add(_ticketType.ToString() + "=" + _processingValue.ToString());
|
|
}
|
|
catch (Exception E)
|
|
{
|
|
LogException(E);
|
|
}
|
|
finally
|
|
{
|
|
Parser.LeaveElement(_item.Name);
|
|
}
|
|
}
|
|
|
|
var _retVal = new cConfigHelperParameterEntry()
|
|
{
|
|
Name = XNode.Name,
|
|
ValueList = _result,
|
|
Policy = _policy.ToString()
|
|
};
|
|
|
|
return _retVal;
|
|
}
|
|
catch (Exception E)
|
|
{
|
|
LogException(E);
|
|
}
|
|
finally
|
|
{
|
|
if (CM != null) LogMethodEnd(CM);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
|
|
private static cConfigHelperParameterEntry getOpenActivitiesExternallyEntry(XmlElement XNode)
|
|
{
|
|
var _policy = cXmlParser.GetEnumFromAttribute<enumConfigPolicy>(XNode, "Policy", enumConfigPolicy.Default);
|
|
var _value = cXmlParser.GetStringFromXmlAttribute(XNode, "Value", String.Empty);
|
|
|
|
if (string.IsNullOrWhiteSpace(_value))
|
|
return null;
|
|
|
|
return new cConfigHelperParameterEntry()
|
|
{
|
|
Name = "OpenActivitiesExternally",
|
|
Value = _value,
|
|
Policy = _policy.ToString(),
|
|
};
|
|
}
|
|
|
|
private cConfigHelperParameterEntry getOpenActivitiesExternallyOverrides(XmlElement XNode, cXmlParser Parser)
|
|
{
|
|
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
|
|
|
try
|
|
{
|
|
var _xNodes = XNode.ChildNodes;
|
|
var _policy = cXmlParser.GetEnumFromAttribute<enumConfigPolicy>(XNode, "Policy", enumConfigPolicy.Default);
|
|
var _result = new List<string>();
|
|
|
|
foreach (var _xNode in _xNodes)
|
|
{
|
|
if (!(_xNode is XmlElement _item))
|
|
continue;
|
|
|
|
Parser.EnterElement(_item.Name);
|
|
|
|
try
|
|
{
|
|
if (_item.Name != "OpenActivityOverride")
|
|
{
|
|
var _msg = $"Invalid entry in F4SD-Global-Configuration.xml: {_item.Name}, should be <OpenActivityOverride/>";
|
|
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
|
LogEntry(_msg, LogLevels.Warning);
|
|
continue;
|
|
}
|
|
|
|
var activityType = cXmlParser.GetStringFromXmlAttribute(_item, "ActivityType", String.Empty)?.Trim();
|
|
if (string.IsNullOrWhiteSpace(activityType))
|
|
{
|
|
var _msg = $"Missing ActivityType attribute value in entry {_item.Name}";
|
|
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
|
LogEntry(_msg, LogLevels.Warning);
|
|
continue;
|
|
}
|
|
|
|
var valueText = cXmlParser.GetStringFromXmlAttribute(_item, "Value", String.Empty)?.Trim();
|
|
if (string.IsNullOrWhiteSpace(valueText))
|
|
{
|
|
var _msg = $"Missing Value attribute value in entry {_item.Name} ({activityType})";
|
|
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
|
LogEntry(_msg, LogLevels.Warning);
|
|
continue;
|
|
}
|
|
|
|
var normalizedValue = valueText.ToLowerInvariant();
|
|
bool? parsedValue = null;
|
|
switch (normalizedValue)
|
|
{
|
|
case "true":
|
|
case "1":
|
|
case "yes":
|
|
parsedValue = true;
|
|
break;
|
|
case "false":
|
|
case "0":
|
|
case "no":
|
|
parsedValue = false;
|
|
break;
|
|
}
|
|
|
|
if (!parsedValue.HasValue)
|
|
{
|
|
var _msg = $"Invalid Value attribute value ({valueText}) in entry {_item.Name} ({activityType})";
|
|
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
|
LogEntry(_msg, LogLevels.Warning);
|
|
continue;
|
|
}
|
|
|
|
_result.Add($"{activityType}={(parsedValue.Value ? "true" : "false")}");
|
|
}
|
|
catch (Exception E)
|
|
{
|
|
LogException(E);
|
|
}
|
|
finally
|
|
{
|
|
Parser.LeaveElement(_item.Name);
|
|
}
|
|
}
|
|
|
|
return new cConfigHelperParameterEntry()
|
|
{
|
|
Name = "OpenActivitiesExternallyOverrides",
|
|
ValueList = _result,
|
|
Policy = _policy.ToString()
|
|
};
|
|
}
|
|
catch (Exception E)
|
|
{
|
|
LogException(E);
|
|
}
|
|
finally
|
|
{
|
|
if (CM != null) LogMethodEnd(CM);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public override bool DoXmlUpdates(XmlElement XmlRoot, bool withM42Config = false, bool withIntuneConfig = false, bool withMobileDeviceConfig = false, bool withCitrixConfig = false)
|
|
{
|
|
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
|
|
|
var RetVal = false;
|
|
try
|
|
{
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, ""
|
|
, "ShouldSkipSlimView"
|
|
, "<ShouldSkipSlimView Policy=\"Default\" Value=\"false\" />"
|
|
);
|
|
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, ""
|
|
, "SmallViewAlignment"
|
|
, "<SmallViewAlignment Policy=\"Default\" Value=\"Right\" />"
|
|
);
|
|
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, ""
|
|
, "FavouriteBarAlignment"
|
|
, "<FavouriteBarAlignment Policy=\"Default\" Value=\"Right\" />"
|
|
);
|
|
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, ""
|
|
, "InformationClassSearchPriority"
|
|
, "<InformationClassSearchPriority Policy=\"Default\" />"
|
|
);
|
|
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "InformationClassSearchPriority"
|
|
, "InformationClass[@Type='User']"
|
|
, "<InformationClass Type=\"User\" />"
|
|
);
|
|
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "InformationClassSearchPriority"
|
|
, "InformationClass[@Type='Computer']"
|
|
, "<InformationClass Type=\"Computer\" />"
|
|
);
|
|
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "InformationClassSearchPriority"
|
|
, "InformationClass[@Type='VirtualSession']"
|
|
, "<InformationClass Type=\"VirtualSession\" />"
|
|
);
|
|
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "InformationClassSearchPriority"
|
|
, "InformationClass[@Type='Ticket']"
|
|
, "<InformationClass Type=\"Ticket\" />"
|
|
);
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, ""
|
|
, "TicketConfiguration"
|
|
, "<TicketConfiguration />"
|
|
);
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "TicketConfiguration"
|
|
, "NotesMandatory"
|
|
, "<NotesMandatory Policy=\"Hidden\" Value=\"false\" />"
|
|
);
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "TicketConfiguration"
|
|
, "UseSimplifiedCaseCompletionDialog"
|
|
, "<UseSimplifiedCaseCompletionDialog Policy=\"Mandatory\" Value=\"false\" />"
|
|
);
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "TicketConfiguration"
|
|
, "SimplifiedCaseCompletionTicketOpenMode"
|
|
, $"<SimplifiedCaseCompletionTicketOpenMode Policy=\"Default\" Value=\"{enumTicketExternalOpenMode.Preview}\" />"
|
|
);
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "TicketConfiguration"
|
|
, "ShowOverview"
|
|
, "<ShowOverview Policy=\"Hidden\" Value=\"true\" />"
|
|
);
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "TicketConfiguration"
|
|
, "TicketProcessing"
|
|
, "<TicketProcessing Policy=\"Mandatory\" Value=\"both\"><TicketTypeProcessing Type=\"Ticket\" Value=\"intern\" /><TicketTypeProcessing Type=\"UnclassifiedTicket\" Value=\"intern\" /><TicketTypeProcessing Type=\"Incident\" Value=\"intern\" /></TicketProcessing>"
|
|
);
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "TicketConfiguration"
|
|
, "ActivityFilters"
|
|
, getDefaultActivityFiltersXml()
|
|
);
|
|
RetVal |= DoXmlRemoveElement(XmlRoot
|
|
, "TicketConfiguration"
|
|
, "OpenActivitiesExternally"
|
|
);
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "TicketConfiguration"
|
|
, "OverviewPollingPersonal"
|
|
, $"<OverviewPollingPersonal Policy=\"Hidden\" Value=\"{cF4sdTicketConfig.DefaultOverviewPollingPersonal}\" />"
|
|
);
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "TicketConfiguration"
|
|
, "OverviewPollingRole"
|
|
, $"<OverviewPollingRole Policy=\"Hidden\" Value=\"{cF4sdTicketConfig.DefaultOverviewPollingRole}\" />"
|
|
);
|
|
#pragma warning disable CS0618 // Type or member is obsolete
|
|
var oldShowDocumentCaseDialog = InfrastructureConfig?.M42Wpm?.ShowDocumentCaseDialog ?? enumShowDocumentCaseDialog.ifRequired;
|
|
var oldDisableAutomaticTimeTracking = InfrastructureConfig?.M42Wpm?.DisableAutomaticTimeTracking ?? false;
|
|
#pragma warning restore CS0618 // Type or member is obsolete
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "TicketConfiguration"
|
|
, "CompletitionPolicy"
|
|
, $"<CompletitionPolicy Policy=\"Hidden\" Value=\"{oldShowDocumentCaseDialog.ToString()}\" />"
|
|
);
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "TicketConfiguration"
|
|
, "DisableAutomaticTimeTracking"
|
|
, $"<DisableAutomaticTimeTracking Policy=\"Mandatory\" Value=\"{oldDisableAutomaticTimeTracking.ToString().ToLowerInvariant()}\" />"
|
|
);
|
|
|
|
if(withIntuneConfig)
|
|
{
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, ""
|
|
, "IntuneConfiguration"
|
|
, "<IntuneConfiguration />"
|
|
);
|
|
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "IntuneConfiguration"
|
|
, "TAPLifeTimeInMinutes"
|
|
, $"<TAPLifeTimeInMinutes Policy=\"Default\" Value=\"{cF4sdIntuneConfig.DefaultTAPLifeTimeInMinutes}\" />"
|
|
);
|
|
|
|
RetVal |= DoXmlInsertElement(XmlRoot
|
|
, "IntuneConfiguration"
|
|
, "TAPIsUsableOnce"
|
|
, $"<TAPIsUsableOnce Policy=\"Default\" Value=\"{cF4sdIntuneConfig.DefaultTAPIsUsableOnce}\" />"
|
|
);
|
|
|
|
}
|
|
}
|
|
|
|
catch (Exception E)
|
|
{
|
|
LogException(E);
|
|
}
|
|
finally
|
|
{
|
|
if (CM != null) LogMethodEnd(CM);
|
|
}
|
|
|
|
return RetVal;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|