// Token: 0x06000B6F RID: 2927 RVA: 0x0002EB20 File Offset: 0x0002CD20 internal void SubmitRenewQuery(ICollection <ExtensionData> extensions, TokenRenewQueryContext queryContext) { if (extensions == null) { throw new ArgumentNullException("extensions"); } if (extensions.Count == 0) { throw new ArgumentException("extensions must contain one or more extensions"); } List <TokenRenewRequestAsset> list = new List <TokenRenewRequestAsset>(extensions.Count); foreach (ExtensionData extensionData in extensions) { list.Add(new TokenRenewRequestAsset { MarketplaceContentMarket = extensionData.MarketplaceContentMarket, ExtensionID = extensionData.ExtensionId, MarketplaceAssetID = extensionData.MarketplaceAssetID, Scope = extensionData.Scope.Value, Etoken = extensionData.Etoken }); } if (list.Count == 0) { TokenRenewSubmitter.Tracer.TraceDebug(0L, "ExtensionsCache.SubmitRenewQuery: TokenRenewRequestAssets count is 0. Token renew query will not be started."); return; } queryContext.TokenRenewRequestAssets = list; queryContext.DeploymentId = ExtensionDataHelper.GetDeploymentId(queryContext.Domain); this.QueueQueryItem(queryContext); }
// Token: 0x06000A7A RID: 2682 RVA: 0x00028ED0 File Offset: 0x000270D0 internal static SafeXmlDocument GetManifest(SafeXmlDocument xmlDoc) { if (ExtensionDataHelper.xmlSchemaSet.Count == 0) { ExtensionDataHelper.xmlSchemaSet = new XmlSchemaSet(); foreach (string text in SchemaConstants.SchemaNamespaceUriToFile.Keys) { string schemaUri = Path.Combine(ExchangeSetupContext.InstallPath, "bin", SchemaConstants.SchemaNamespaceUriToFile[text]); ExtensionDataHelper.xmlSchemaSet.Add(text, schemaUri); } } xmlDoc.Schemas = ExtensionDataHelper.xmlSchemaSet; xmlDoc.Validate(new ValidationEventHandler(ExtensionDataHelper.InvalidManifestEventHandler)); string uri; string text2; if (!ExtensionDataHelper.TryGetOfficeAppSchemaInfo(xmlDoc, "http://schemas.microsoft.com/office/appforoffice/", out uri, out text2)) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonManifestSchemaUnknown)); } XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(xmlDoc.NameTable); xmlNamespaceManager.AddNamespace("owe", uri); SafeXmlDocument safeXmlDocument = null; string xpath = "//owe:OfficeApp"; XmlNode xmlNode = xmlDoc.SelectSingleNode(xpath, xmlNamespaceManager); if (xmlNode != null) { safeXmlDocument = new SafeXmlDocument(); safeXmlDocument.PreserveWhitespace = true; safeXmlDocument.LoadXml(xmlNode.OuterXml); } return(safeXmlDocument); }
// Token: 0x06000A74 RID: 2676 RVA: 0x00028DA0 File Offset: 0x00026FA0 internal static bool VerifyDeploymentId(string deploymentId, string domain) { if (!string.IsNullOrWhiteSpace(deploymentId)) { try { ADSessionSettings adsessionSettings = ExtensionDataHelper.CreateRootOrgOrSingleTenantFromAcceptedDomainAutoDetect(domain); if (adsessionSettings != null) { IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, adsessionSettings, 142, "VerifyDeploymentId", "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\extension\\ExtensionDataHelper.cs"); AcceptedDomain acceptedDomainByDomainName = tenantOrTopologyConfigurationSession.GetAcceptedDomainByDomainName(deploymentId); if (acceptedDomainByDomainName != null) { return(true); } } } catch (ADTransientException ex) { ExtensionDataHelper.Tracer.TraceError <string>(0L, "Failed to get accepted domain by deployment id. Exception: {0}", ex.Message); } return(false); } return(false); }
public string GetAndValidateExtensionId() { string tagStringValue = ExtensionData.GetTagStringValue(this.xmlDoc, this.GetOweXpath("Id"), this.namespaceManager); string text = ExtensionDataHelper.FormatExtensionId(tagStringValue); Guid guid; if (!GuidHelper.TryParseGuid(text, out guid)) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonInvalidID)); } return(text); }
// Token: 0x06000B42 RID: 2882 RVA: 0x0002D750 File Offset: 0x0002B950 public KilledExtensionEntry(string extensionId, string assetId) { if (string.IsNullOrWhiteSpace(extensionId)) { throw new ArgumentException("The extension id is missing."); } if (string.IsNullOrWhiteSpace(assetId)) { throw new ArgumentException("The asset id is missing."); } this.ExtensionId = ExtensionDataHelper.FormatExtensionId(extensionId); this.AssetId = assetId; }
public static bool ReadKillBitXmlContent(XmlReader reader, out int refreshRate) { refreshRate = -1; if (reader.ReadToFollowing("o:assets") && reader.MoveToAttribute("o:rr") && int.TryParse(reader.Value, out refreshRate)) { refreshRate = ((refreshRate > 6) ? refreshRate : 6); if (reader.ReadToFollowing("o:asset")) { KillBitList.Singleton.Clear(); do { string attribute = reader.GetAttribute("o:assetid"); string attribute2 = reader.GetAttribute("o:pid"); if (string.IsNullOrWhiteSpace(attribute2)) { KillBitHelper.Tracer.TraceError(0L, "The extension id is missing in the killbit entry."); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_AppIdMissingInKillbitEntry, null, new object[] { "ProcessKillBit" }); } else if (string.IsNullOrWhiteSpace(attribute)) { KillBitHelper.Tracer.TraceError(0L, "The asset id is missing in the killbit entry."); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_AssetIdMissingInKillbitEntry, null, new object[] { "ProcessKillBit" }); } else { KilledExtensionEntry entry = new KilledExtensionEntry(ExtensionDataHelper.FormatExtensionId(attribute2), attribute); KillBitList.Singleton.Add(entry); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_EntryAddedToKillbitList, attribute2, new object[] { "ProcessKillBit", attribute2, attribute }); } }while (reader.ReadToNextSibling("o:asset")); } return(true); } KillBitHelper.Tracer.TraceError(0L, "Cannot find KillBit asset tag or refresh rate in the file, will download killbit list again after one hour."); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_KillbitAssetTagRefreshRateNotFound, null, new object[] { "ProcessKillBit" }); return(false); }
private static void ValidateItemHasKnownEntityRule(XmlNode xmlNode, RequestedCapabilities requestedCapabilities, ref HashSet <string> entitiesRegExNames, ref int regexCount) { if (requestedCapabilities == RequestedCapabilities.Restricted) { XmlAttribute attribute = xmlNode.Attributes["EntityType"]; string item; if (!ExtensionDataHelper.TryGetAttributeValue(attribute, out item) || !SchemaParser.AllowedEntityTypesInRestricted.Contains(item)) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonOnlySelectedEntitiesInRestricted)); } } XmlAttribute attribute2 = xmlNode.Attributes["RegExFilter"]; XmlAttribute attribute3 = xmlNode.Attributes["FilterName"]; string text; bool flag = ExtensionDataHelper.TryGetAttributeValue(attribute3, out text); string regexPattern; bool flag2 = ExtensionDataHelper.TryGetAttributeValue(attribute2, out regexPattern); if (flag != flag2) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonRegExNameAndValueRequiredInEntitiesRules)); } if (!flag) { XmlAttribute attribute4 = xmlNode.Attributes["IgnoreCase"]; string text2; if (ExtensionDataHelper.TryGetAttributeValue(attribute4, out text2)) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonIgnoreCaseWithoutRegExInEntitiesRules)); } return; } else { regexCount++; if (entitiesRegExNames == null) { entitiesRegExNames = new HashSet <string>(); } else if (regexCount > 5) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonTooManyRegexRule(5))); } if (!entitiesRegExNames.Add(text)) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonMultipleRulesWithSameFilterName(text))); } SchemaParser.ValidateRegEx(text, regexPattern, "ItemHasKnownEntity", "RegExFilter"); return; } }
// Token: 0x06000B2A RID: 2858 RVA: 0x0002D1E8 File Offset: 0x0002B3E8 public bool IsExtensionKilled(string extensionId) { lock (this.lockObject) { foreach (KilledExtensionEntry killedExtensionEntry in this.list) { if (string.Equals(killedExtensionEntry.ExtensionId, ExtensionDataHelper.FormatExtensionId(extensionId), StringComparison.OrdinalIgnoreCase)) { return(true); } } } return(false); }
protected override XmlNode GetFormSettingsParentNode(FormSettings.FormSettingsType formSettingsType) { string b = SchemaParser1_1.FormSettingsTypeToXmlTypeName[formSettingsType]; foreach (XmlNode xmlNode in this.GetFormNodesInFormSettings()) { XmlAttribute attribute = xmlNode.Attributes["type", "http://www.w3.org/2001/XMLSchema-instance"]; string a; if (ExtensionDataHelper.TryGetNameSpaceStrippedAttributeValue(attribute, out a) && string.Equals(a, b)) { return(xmlNode); } } return(null); }
// Token: 0x06000B28 RID: 2856 RVA: 0x0002D0C0 File Offset: 0x0002B2C0 public void Remove(string extensionId) { lock (this.lockObject) { List <KilledExtensionEntry> list = new List <KilledExtensionEntry>(); foreach (KilledExtensionEntry killedExtensionEntry in this.list) { if (string.Equals(killedExtensionEntry.ExtensionId, ExtensionDataHelper.FormatExtensionId(extensionId), StringComparison.OrdinalIgnoreCase)) { list.Add(killedExtensionEntry); } } foreach (KilledExtensionEntry item in list) { this.list.Remove(item); } } }
// Token: 0x06000A76 RID: 2678 RVA: 0x00028E3C File Offset: 0x0002703C internal static bool TryGetNameSpaceStrippedAttributeValue(XmlAttribute attribute, out string value) { if (!ExtensionDataHelper.TryGetAttributeValue(attribute, out value)) { return(false); } int num = value.LastIndexOf(':'); if (-1 != num) { num++; value = value.Substring(num, value.Length - num); if (string.IsNullOrEmpty(value)) { return(false); } } return(true); }
private static void ValidateRegEx(string regexName, string regexPattern, string ruleName, string attributeName) { try { ExtensionDataHelper.ValidateRegex(regexPattern); } catch (Exception ex) { SchemaParser.Tracer.TraceError(0L, "Failed to validate {0} rule's {1} of name '{2}' and value '{3}' with exception: '{4}'", new object[] { ruleName, attributeName, regexName, regexPattern, ex }); throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonInvalidRegEx(ruleName, attributeName)), ex); } }
// Token: 0x06000B7E RID: 2942 RVA: 0x0002EF1C File Offset: 0x0002D11C private string ParseExtensionID(XElement element, XName extensionIDKey, BaseAsyncCommand.LogResponseParseFailureEventCallback logParseFailureCallback) { string text = null; string text2 = (string)element.Attribute(extensionIDKey); if (!string.IsNullOrWhiteSpace(text2)) { text = ExtensionDataHelper.FormatExtensionId(text2); Guid guid; if (!GuidHelper.TryParseGuid(text, out guid)) { text = null; } } if (text == null) { AppStateResponseAsset.Tracer.TraceError <XElement>(0L, "AppStateResponseAsset.ParseExtensionID: Extension id is invalid: {0}", element); logParseFailureCallback(ApplicationLogicEventLogConstants.Tuple_AppStateResponseInvalidExtensionID, this.MarketplaceAssetID, element); } return(text); }
// Token: 0x06000A73 RID: 2675 RVA: 0x00028CB4 File Offset: 0x00026EB4 public static string GetDeploymentId(string domain) { string text = string.Empty; try { ADSessionSettings adsessionSettings = ExtensionDataHelper.CreateRootOrgOrSingleTenantFromAcceptedDomainAutoDetect(domain); if (adsessionSettings != null) { IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, adsessionSettings, 80, "GetDeploymentId", "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\extension\\ExtensionDataHelper.cs"); AcceptedDomain defaultAcceptedDomain = tenantOrTopologyConfigurationSession.GetDefaultAcceptedDomain(); if (defaultAcceptedDomain != null && defaultAcceptedDomain.DomainName != null && defaultAcceptedDomain.DomainName.Domain != null) { text = defaultAcceptedDomain.DomainName.Domain; } else { ExtensionDataHelper.Tracer.TraceError(0L, "Failed to get a valid default accepted domain for deployment id."); } } } catch (ADTransientException ex) { ExtensionDataHelper.Tracer.TraceError <string>(0L, "Failed to get default accepted domain for deployment id. Exception: {0}", ex.Message); } if (string.IsNullOrWhiteSpace(text)) { ExtensionDataHelper.Tracer.TraceInformation <string>(0, 0L, "Can not get default authorative accepted domain, fall back to primary smtp domain: {0}.", domain); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_FailedToGetDeploymentId, null, new object[] { "ProcessEntitlementToken", domain }); text = domain; } return(text); }
// Token: 0x06000A7C RID: 2684 RVA: 0x0002904C File Offset: 0x0002724C internal static SchemaParser GetSchemaParser(SafeXmlDocument xmlDoc, ExtensionInstallScope scope) { string text; string schemaVersion; if (!ExtensionDataHelper.TryGetOfficeAppSchemaInfo(xmlDoc, "http://schemas.microsoft.com/office/appforoffice/", out text, out schemaVersion)) { throw new OwaExtensionOperationException(Strings.ErrorReasonManifestSchemaUnknown); } string a; if ((a = text) != null) { if (a == "http://schemas.microsoft.com/office/appforoffice/1.0") { return(new SchemaParser1_0(xmlDoc, scope)); } if (a == "http://schemas.microsoft.com/office/appforoffice/1.1") { return(new SchemaParser1_1(xmlDoc, scope)); } } throw new OwaExtensionOperationException(Strings.ErrorReasonManifestVersionNotSupported(schemaVersion, ExchangeSetupContext.InstalledVersion)); }
private static Dictionary <string, ExtensionData> ReadDefaultExtensionData(IExchangePrincipal exchangePrincipal) { Dictionary <string, ExtensionData> dictionary = new Dictionary <string, ExtensionData>(); string text = ExchangeSetupContext.InstallPath + "ClientAccess\\owa\\" + string.Format("\\prem\\{0}\\ext\\def\\", DefaultExtensionTable.GetInstalledOwaVersion()); string[] array = null; try { if (!Directory.Exists(text)) { DefaultExtensionTable.Tracer.TraceError <string>(0L, "Default extension path {0} does not exist", text); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_DefaultExtensionPathNotExist, null, new object[] { DefaultExtensionTable.scenario }); return(dictionary); } array = Directory.GetDirectories(text); } catch (Exception ex) { DefaultExtensionTable.Tracer.TraceError <Exception>(0L, "Failed to access default extension folder. ", ex); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_DefaultExtensionFolderAccessFailed, ex.GetType().ToString(), new object[] { DefaultExtensionTable.scenario, ExtensionDiagnostics.GetLoggedExceptionString(ex) }); return(dictionary); } foreach (string text2 in array) { try { string path = text2 + "\\" + "manifest.xml"; if (File.Exists(path)) { using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read)) { ExtensionData extensionData = ExtensionData.ParseOsfManifest(fileStream, null, null, ExtensionType.Default, ExtensionInstallScope.Default, true, DisableReasonType.NotDisabled, string.Empty, null); extensionData.ProvidedTo = ClientExtensionProvidedTo.Everyone; extensionData.IsMandatory = false; extensionData.IsEnabledByDefault = true; extensionData.InstalledByVersion = ExchangeSetupContext.InstalledVersion; if (exchangePrincipal != null) { Exception arg = null; if (!DefaultExtensionTable.TryUpdateDefaultExtensionPath(exchangePrincipal, "SourceLocation", extensionData, out arg)) { DefaultExtensionTable.Tracer.TraceError <Exception>(0L, "Skip one default extension because entry point path cannot be updated: {0}", arg); goto IL_22D; } if (!DefaultExtensionTable.TryUpdateDefaultExtensionPath(exchangePrincipal, "IconUrl", extensionData, out arg)) { DefaultExtensionTable.Tracer.TraceError <Exception>(0L, "Skip one default extension because icon path cannot be updated: {0}", arg); goto IL_22D; } if (!DefaultExtensionTable.TryUpdateDefaultExtensionPath(exchangePrincipal, "HighResolutionIconUrl", extensionData, out arg)) { DefaultExtensionTable.Tracer.TraceError <Exception>(0L, "Skip one default extension because hi-res icon path cannot be updated: {0}", arg); goto IL_22D; } } dictionary[ExtensionDataHelper.FormatExtensionId(extensionData.ExtensionId)] = extensionData; } } } catch (Exception ex2) { DefaultExtensionTable.Tracer.TraceError <Exception>(0L, "Skip one default extension because of error. {0}", ex2); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_DefaultExtensionRetrievalFailed, text2, new object[] { DefaultExtensionTable.scenario, text2, ExtensionDiagnostics.GetLoggedExceptionString(ex2) }); } IL_22D :; } return(dictionary); }
internal void SubmitUpdateQuery(ICollection <ExtensionData> extensions, UpdateQueryContext queryContext) { if (extensions == null) { throw new ArgumentNullException("extensions"); } if (extensions.Count == 0) { throw new ArgumentException("extensions must contain one or more extensions"); } if (this.SkipSubmitUpdateQueryForTest) { this.SubmitCount = 0; } Dictionary <string, UpdateRequestAsset> dictionary = new Dictionary <string, UpdateRequestAsset>(extensions.Count); foreach (ExtensionData extensionData in extensions) { if (extensionData.Version == null) { ExtensionsCache.Tracer.TraceDebug <string>(0L, "ExtensionsCache.SubmitUpdateQuery: Extension {0} not added to query list because version is invalid", extensionData.MarketplaceAssetID); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_InvalidVersionSubmitUpdateQuery, extensionData.MarketplaceAssetID, new object[] { "ProcessUpdates", ExtensionDiagnostics.GetLoggedMailboxIdentifier(queryContext.ExchangePrincipal), extensionData.MarketplaceAssetID }); } else { if (extensionData.Scope == null) { throw new ArgumentNullException("extensionData.Scope"); } if (extensionData.RequestedCapabilities == null) { throw new ArgumentNullException("extensionData.RequestedCapabilities"); } ExtensionsCacheEntry extensionsCacheEntry = null; if (this.extensionsDictionary.TryGetValue(extensionData.MarketplaceAssetID, out extensionsCacheEntry) && !InstalledExtensionTable.IsUpdateCheckTimeExpired(extensionsCacheEntry.LastUpdateCheckTime) && extensionsCacheEntry.Version == extensionData.Version) { ExtensionsCache.Tracer.TraceDebug <string>(0L, "ExtensionsCache.SubmitUpdateQuery: Extension {0} not added to query list because version matches recent cache entry", extensionData.MarketplaceAssetID); } else { UpdateRequestAsset updateRequestAsset = null; if (dictionary.TryGetValue(extensionData.MarketplaceAssetID, out updateRequestAsset)) { ExtensionsCache.Tracer.TraceDebug <string, string, string>(0L, "ExtensionsCache.SubmitUpdateQuery: Extension {0} not added to query list because asset with same MarketplaceAssetID is already in list. ExtensionIds with same asset id: {1} {2}", extensionData.MarketplaceAssetID, extensionData.ExtensionId, updateRequestAsset.ExtensionID); } else { dictionary.Add(extensionData.MarketplaceAssetID, new UpdateRequestAsset { MarketplaceContentMarket = extensionData.MarketplaceContentMarket, ExtensionID = extensionData.ExtensionId, MarketplaceAssetID = extensionData.MarketplaceAssetID, RequestedCapabilities = extensionData.RequestedCapabilities.Value, Version = extensionData.Version, DisableReason = extensionData.DisableReason, Enabled = extensionData.Enabled, Scope = extensionData.Scope.Value, Etoken = extensionData.Etoken }); } } } } if (dictionary.Count == 0) { ExtensionsCache.Tracer.TraceDebug(0L, "ExtensionsCache.SubmitUpdateQuery: UpdateRequestAssets count is 0. Updates query will not be started."); return; } queryContext.UpdateRequestAssets = dictionary; queryContext.DeploymentId = ExtensionDataHelper.GetDeploymentId(queryContext.Domain); this.QueueQueryItem(queryContext); }
private static bool ParseBoolFromXmlAttribute(XmlAttribute attribute) { return(attribute != null && ExtensionDataHelper.ConvertXmlStringToBoolean(attribute.Value)); }
public static string GetFaiName(string extensionId, string version) { return("ClientExtension" + '.' + ExtensionDataHelper.FormatExtensionId(extensionId).Replace("-", string.Empty)); }
public void ValidateRules() { RequestedCapabilities requestedCapabilities = this.GetRequestedCapabilities(); using (XmlNodeList xmlNodeList = this.xmlDoc.SelectNodes(this.GetOweXpath("Rule"), this.namespaceManager)) { int num = 0; int num2 = 0; HashSet <string> hashSet = null; HashSet <string> hashSet2 = null; int num3 = 0; foreach (object obj in xmlNodeList) { XmlNode xmlNode = (XmlNode)obj; XmlAttribute attribute = xmlNode.Attributes["type", "http://www.w3.org/2001/XMLSchema-instance"]; string a; if (ExtensionDataHelper.TryGetNameSpaceStrippedAttributeValue(attribute, out a)) { if (string.Equals(a, "RuleCollection", StringComparison.Ordinal)) { num2++; } else { num++; } if (num > 15 || num2 > 15) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonTooManyRule(15))); } if (string.Equals(a, "ItemIs", StringComparison.Ordinal)) { SchemaParser.ValidateItemIsRule(xmlNode); } else if (string.Equals(a, "ItemHasKnownEntity", StringComparison.Ordinal)) { SchemaParser.ValidateItemHasKnownEntityRule(xmlNode, requestedCapabilities, ref hashSet2, ref num3); } else if (string.Equals(a, "ItemHasRegularExpressionMatch", StringComparison.Ordinal)) { num3++; if (hashSet == null) { hashSet = new HashSet <string>(); } string attributeStringValue = ExtensionData.GetAttributeStringValue(xmlNode, "RegExName"); if (!hashSet.Add(attributeStringValue)) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonMultipleRulesWithSameRegExName(attributeStringValue))); } if (requestedCapabilities == RequestedCapabilities.Restricted) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonNoRegexRuleInRestricted)); } if (num3 > 5) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonTooManyRegexRule(5))); } SchemaParser.ValidateRegEx(attributeStringValue, ExtensionData.GetAttributeStringValue(xmlNode, "RegExValue"), "ItemHasRegularExpressionMatch", "RegExValue"); } } } } }
private bool TryCreateActivationRuleInternal(XmlNode node, out ActivationRule activationRule) { activationRule = null; if (node == null || node.Attributes == null) { return(false); } XmlAttribute xmlAttribute = node.Attributes["type", "http://www.w3.org/2001/XMLSchema-instance"]; string a; if (!ExtensionDataHelper.TryGetNameSpaceStrippedAttributeValue(xmlAttribute, out a)) { return(false); } if (!string.Equals(a, "ItemIs", StringComparison.Ordinal)) { if (string.Equals(a, "ItemHasKnownEntity", StringComparison.Ordinal)) { KnownEntityType entityType; if (EnumValidator.TryParse <KnownEntityType>(node.Attributes["EntityType"].Value, EnumParseOptions.Default, out entityType)) { XmlAttribute xmlAttribute2 = node.Attributes["FilterName"]; XmlAttribute xmlAttribute3 = node.Attributes["RegExFilter"]; bool ignoreCase = SchemaParser.ParseBoolFromXmlAttribute(node.Attributes["IgnoreCase"]); activationRule = new ItemHasKnownEntityRule(entityType, (xmlAttribute2 != null) ? xmlAttribute2.Value : null, (xmlAttribute3 != null) ? xmlAttribute3.Value : null, ignoreCase); return(true); } } else if (string.Equals(a, "ItemHasRegularExpressionMatch", StringComparison.Ordinal)) { RegExPropertyName propertyName; if (EnumValidator.TryParse <RegExPropertyName>(node.Attributes["PropertyName"].Value, EnumParseOptions.Default, out propertyName)) { bool ignoreCase2 = SchemaParser.ParseBoolFromXmlAttribute(node.Attributes["IgnoreCase"]); activationRule = new ItemHasRegularExpressionMatchRule(node.Attributes["RegExName"].Value, node.Attributes["RegExValue"].Value, propertyName, ignoreCase2); return(true); } } else { if (string.Equals(a, "ItemHasAttachment", StringComparison.Ordinal)) { activationRule = new ItemHasAttachmentRule(); return(true); } if (node.ChildNodes != null && 0 < node.ChildNodes.Count && string.Equals(a, "RuleCollection", StringComparison.Ordinal)) { ActivationRule[] array = new ActivationRule[node.ChildNodes.Count]; int num = 0; foreach (object obj in node.ChildNodes) { XmlNode xmlNode = (XmlNode)obj; ActivationRule activationRule2; if (this.IsExpectedOweNamespace(xmlNode.NamespaceURI) && string.Equals(xmlNode.LocalName, "Rule", StringComparison.Ordinal) && this.TryCreateActivationRuleInternal(xmlNode, out activationRule2)) { array[num++] = activationRule2; } } xmlAttribute = node.Attributes["Mode"]; activationRule = new CollectionRule((xmlAttribute == null) ? "Or" : xmlAttribute.Value, array); return(true); } } return(false); } ItemIsRuleItemType itemType; if (EnumValidator.TryParse <ItemIsRuleItemType>(node.Attributes["ItemType"].Value, EnumParseOptions.Default, out itemType)) { XmlAttribute xmlAttribute4 = node.Attributes["FormType"]; ItemIsRuleFormType formType; if (xmlAttribute4 == null || !EnumValidator.TryParse <ItemIsRuleFormType>(xmlAttribute4.Value, EnumParseOptions.Default, out formType)) { formType = ItemIsRuleFormType.Read; } bool includeSubClasses = SchemaParser.ParseBoolFromXmlAttribute(node.Attributes["IncludeSubClasses"]); XmlAttribute xmlAttribute5 = node.Attributes["ItemClass"]; activationRule = new ItemIsRule(itemType, (xmlAttribute5 != null) ? xmlAttribute5.Value : null, includeSubClasses, formType); return(true); } return(false); }
// Token: 0x06000B51 RID: 2897 RVA: 0x0002DA14 File Offset: 0x0002BC14 internal static Dictionary <string, ExtensionData> GetOrgExtensions(StringList requestedExtensionIds, string domain, bool shouldReturnEnabledOnly, bool isUserScope, string userId, StringList userEnabledExtensionIds, StringList userDisabledExtensionIds, out OrgExtensionTable.RequestData requestData, bool isDebug, out string orgMasterTableRawXml, bool retrieveOnly1_0 = false) { Dictionary <string, ExtensionData> dictionary = new Dictionary <string, ExtensionData>(StringComparer.OrdinalIgnoreCase); Collection <ClientExtension> clientExtensions = null; string orgRawXml = null; OrgExtensionTable.RequestData requestDataSave = new OrgExtensionTable.RequestData(); requestData = requestDataSave; OrgExtensionTable.ExecuteWebServicesAction(delegate { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); ExchangeService exchangeService = OrgExtensionTable.CreateExchangeServiceDelegate(domain, requestDataSave); if (exchangeService == null) { return; } if (OrgExtensionTable.GetClientExtensionTimeoutIsAllowed()) { exchangeService.Timeout = 30000; } requestDataSave.CreateExchangeServiceTime = stopwatch.ElapsedMilliseconds; GetClientExtensionResponse clientExtension2 = exchangeService.GetClientExtension(requestedExtensionIds, shouldReturnEnabledOnly, isUserScope, userId, userEnabledExtensionIds, userDisabledExtensionIds, isDebug); stopwatch.Stop(); requestDataSave.GetClientExtensionTime = stopwatch.ElapsedMilliseconds - requestDataSave.CreateExchangeServiceTime; requestDataSave.ExchangeServiceUri = exchangeService.Url; string text; if (exchangeService.HttpResponseHeaders.TryGetValue("request-id", out text)) { requestDataSave.EwsRequestId = text.Replace("-", string.Empty); } else { requestDataSave.EwsRequestId = "NotFound"; } clientExtensions = clientExtension2.ClientExtensions; if (isDebug && !string.IsNullOrWhiteSpace(clientExtension2.RawMasterTableXml)) { try { byte[] bytes = Convert.FromBase64String(clientExtension2.RawMasterTableXml); orgRawXml = Encoding.UTF8.GetString(bytes); } catch (FormatException innerException) { throw new OwaExtensionOperationException(innerException); } catch (ArgumentException innerException2) { throw new OwaExtensionOperationException(innerException2); } } }); if (clientExtensions != null) { foreach (ClientExtension clientExtension in clientExtensions) { try { ExtensionData extensionData = ExtensionData.CreateFromClientExtension(clientExtension); if (!retrieveOnly1_0 || !(extensionData.SchemaVersion != SchemaConstants.SchemaVersion1_0)) { ExtensionData extensionData2; if (!dictionary.TryGetValue(extensionData.ExtensionId, out extensionData2) || !(extensionData.SchemaVersion < extensionData2.SchemaVersion)) { dictionary[ExtensionDataHelper.FormatExtensionId(extensionData.ExtensionId)] = extensionData; } } } catch (OwaExtensionOperationException ex) { OrgExtensionTable.Tracer.TraceError <OwaExtensionOperationException>(0L, "skipping an org extension because it cannot be parsed. Exception: {0}", ex); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_OrgExtensionParsingFailed, null, new object[] { "ProcessOrgExtensions", ExtensionDiagnostics.GetLoggedExceptionString(ex) }); } } } orgMasterTableRawXml = orgRawXml; return(dictionary); }
private static void ValidateItemIsRule(XmlNode xmlNode) { XmlAttribute xmlAttribute = xmlNode.Attributes["ItemClass"]; if (xmlAttribute != null) { string value = xmlAttribute.Value; if (ObjectClass.IsSmime(value) || ObjectClass.IsRightsManagedContentClass(value)) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonItemTypeInvalid)); } XmlAttribute xmlAttribute2 = xmlNode.Attributes["IncludeSubClasses"]; if (string.Equals(value, "IPM", StringComparison.OrdinalIgnoreCase) && xmlAttribute2 != null && ExtensionDataHelper.ConvertXmlStringToBoolean(xmlAttribute2.Value)) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonItemTypeAllTypes)); } } XmlAttribute xmlAttribute3 = xmlNode.Attributes["FormType"]; ItemIsRuleFormType itemIsRuleFormType; if (xmlAttribute3 != null && EnumValidator.TryParse <ItemIsRuleFormType>(xmlAttribute3.Value, EnumParseOptions.Default, out itemIsRuleFormType) && (itemIsRuleFormType == ItemIsRuleFormType.Edit || itemIsRuleFormType == ItemIsRuleFormType.ReadOrEdit)) { XmlAttribute xmlAttribute4 = xmlNode.Attributes["IncludeSubClasses"]; if (xmlAttribute != null || xmlAttribute4 != null) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonItemIsRuleAttributesNotValidForEdit)); } } }