private bool ValidateLoadTenantsIRMConfiguration(out IRMConfiguration irmConfiguration) { irmConfiguration = null; this.result.SetTask(Strings.InfoLoadIRMConfig); irmConfiguration = IRMConfiguration.Read(this.dataSession); return(this.result.SetSuccessResult(Strings.InfoIRMConfigLoaded)); }
protected override void InternalValidate() { base.InternalValidate(); TransportRule dataObject = this.DataObject; if (dataObject == null) { ExAssert.RetailAssert(false, "EnableTransportRule.InternalValidate data object is invalid"); } TransportRule rule = (TransportRule)TransportRuleParser.Instance.GetRule(dataObject.Xml); Rule rule2 = Rule.CreateFromInternalRule(TransportRulePredicate.GetAvailablePredicateMappings(), TransportRuleAction.GetAvailableActionMappings(), rule, dataObject.Priority, dataObject); IEnumerable <RightsProtectMessageAction> source = (from action in rule2.Actions where action is RightsProtectMessageAction select action as RightsProtectMessageAction).ToList <RightsProtectMessageAction>(); if (source.Any <RightsProtectMessageAction>()) { if (!RmsClientManager.IRMConfig.IsInternalLicensingEnabledForTenant(base.CurrentOrganizationId)) { base.WriteError(new IrmLicensingIsDisabledException(), ErrorCategory.InvalidArgument, null); } RmsTemplateIdentity template = source.First <RightsProtectMessageAction>().Template; RmsTemplateDataProvider session = new RmsTemplateDataProvider((IConfigurationSession)base.DataSession); base.GetDataObject <RmsTemplatePresentation>(new RmsTemplateIdParameter(template), session, null, new LocalizedString?(Strings.OutlookProtectionRuleRmsTemplateNotFound(template.TemplateName)), new LocalizedString?(Strings.OutlookProtectionRuleRmsTemplateNotUnique(template.TemplateName))); } bool flag; if (!rule2.Actions.Any((TransportRuleAction action) => action is ApplyOMEAction)) { flag = rule2.Actions.Any((TransportRuleAction action) => action is RemoveOMEAction); } else { flag = true; } bool flag2 = flag; if (flag2) { IRMConfiguration irmconfiguration = IRMConfiguration.Read((IConfigurationSession)base.DataSession); if (irmconfiguration == null || !irmconfiguration.InternalLicensingEnabled) { base.WriteError(new E4eLicensingIsDisabledExceptionEnableRule(), ErrorCategory.InvalidArgument, null); } if (RmsClientManager.IRMConfig.GetRmsTemplate(base.CurrentOrganizationId, RmsTemplate.InternetConfidential.Id) == null) { base.WriteError(new E4eRuleRmsTemplateNotFoundException(RmsTemplate.InternetConfidential.Name), ErrorCategory.InvalidArgument, null); } } }
public RmsTemplateDataProvider(IConfigurationSession adSession, RmsTemplateType typeToFetch, bool displayTemplatesIfInternalLicensingDisabled, RMSTrustedPublishingDomain trustedPublishingDomain) { if (adSession == null) { throw new ArgumentNullException("adSession"); } if (adSession.SessionSettings == null) { throw new ArgumentNullException("adSession.SessionSettings"); } this.adSession = adSession; this.orgId = adSession.SessionSettings.CurrentOrganizationId; this.typeToFetch = typeToFetch; this.displayTemplatesIfInternalLicensingDisabled = displayTemplatesIfInternalLicensingDisabled; this.irmConfiguration = IRMConfiguration.Read(this.adSession); this.trustedPublishingDomain = trustedPublishingDomain; }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); bool flag = false; IRMConfiguration irmconfiguration = IRMConfiguration.Read((IConfigurationSession)base.DataSession, out flag); if (irmconfiguration == null) { base.WriteError(new FailedToAccessIrmConfigurationException(), (ErrorCategory)1002, this.Identity); } if (base.DataObject.Default) { if (!this.Force && !base.ShouldContinue(Strings.RemoveDefaultTPD(this.Identity.ToString()))) { TaskLogger.LogExit(); return; } irmconfiguration.InternalLicensingEnabled = false; irmconfiguration.SharedServerBoxRacIdentity = null; irmconfiguration.PublishingLocation = null; irmconfiguration.ServiceLocation = null; irmconfiguration.LicensingLocation = null; } else { if (irmconfiguration.LicensingLocation.Contains(base.DataObject.IntranetLicensingUrl)) { irmconfiguration.LicensingLocation.Remove(base.DataObject.IntranetLicensingUrl); } if (irmconfiguration.LicensingLocation.Contains(base.DataObject.ExtranetLicensingUrl)) { irmconfiguration.LicensingLocation.Remove(base.DataObject.ExtranetLicensingUrl); } } base.DataSession.Save(irmconfiguration); base.InternalProcessRecord(); TaskLogger.LogExit(); }
private static string ReadOrganizationRacKeysFromIRMConfig(OrganizationId orgId) { ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(orgId); IRMConfiguration irmConfiguration = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, sessionSettings, 1005, "ReadOrganizationRacKeysFromIRMConfig", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\OfflineRms\\ServerManager.cs"); irmConfiguration = IRMConfiguration.Read(tenantOrTopologyConfigurationSession); }, 3); if (!adoperationResult.Succeeded) { throw new RightsManagementServerException(ServerStrings.FailedToReadIRMConfig(orgId.ToString()), adoperationResult.Exception, true); } if (irmConfiguration == null) { throw new RightsManagementServerException(ServerStrings.FailedToReadIRMConfig(orgId.ToString()), adoperationResult.Exception, true); } if (string.IsNullOrEmpty(irmConfiguration.SharedServerBoxRacIdentity)) { throw new RightsManagementServerException(ServerStrings.FailedToReadSharedServerBoxRacIdentityFromIRMConfig(orgId.ToString()), adoperationResult.Exception, true); } return(irmConfiguration.SharedServerBoxRacIdentity); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); ((IConfigurationSession)base.DataSession).SessionSettings.IsSharedConfigChecked = true; bool flag = false; IRMConfiguration irmconfiguration = IRMConfiguration.Read((IConfigurationSession)base.DataSession, out flag); RMSTrustedPublishingDomain rmstrustedPublishingDomain = null; if (irmconfiguration == null) { base.WriteError(new FailedToAccessIrmConfigurationException(), (ErrorCategory)1002, this.Identity); } if (this.IntranetCertificationUrl != null) { this.DataObject.IntranetCertificationUrl = RMUtil.ConvertUriToCertificateLocationDistributionPoint(this.IntranetCertificationUrl); } if (this.ExtranetCertificationUrl != null) { this.DataObject.ExtranetCertificationUrl = RMUtil.ConvertUriToCertificateLocationDistributionPoint(this.ExtranetCertificationUrl); } if (this.IntranetLicensingUrl != null) { if (irmconfiguration.LicensingLocation.Contains(this.DataObject.IntranetLicensingUrl)) { irmconfiguration.LicensingLocation.Remove(this.DataObject.IntranetLicensingUrl); } Uri uri = RMUtil.ConvertUriToLicenseLocationDistributionPoint(this.IntranetLicensingUrl); if (!irmconfiguration.LicensingLocation.Contains(uri)) { irmconfiguration.LicensingLocation.Add(uri); } this.DataObject.IntranetLicensingUrl = uri; } if (this.ExtranetLicensingUrl != null) { if (irmconfiguration.LicensingLocation.Contains(this.DataObject.ExtranetLicensingUrl)) { irmconfiguration.LicensingLocation.Remove(this.DataObject.ExtranetLicensingUrl); } Uri uri2 = RMUtil.ConvertUriToLicenseLocationDistributionPoint(this.ExtranetLicensingUrl); if (!irmconfiguration.LicensingLocation.Contains(uri2)) { irmconfiguration.LicensingLocation.Add(uri2); } this.DataObject.ExtranetLicensingUrl = uri2; } if (this.Default && !this.DataObject.Default) { this.DataObject.Default = true; try { ImportRmsTrustedPublishingDomain.ChangeDefaultTPDAndUpdateIrmConfigData((IConfigurationSession)base.DataSession, irmconfiguration, this.DataObject, out rmstrustedPublishingDomain); irmconfiguration.ServerCertificatesVersion++; } catch (RightsManagementServerException ex) { base.WriteError(new FailedToGenerateSharedKeyException(ex), (ErrorCategory)1000, this.Identity); } } if (rmstrustedPublishingDomain != null) { this.WriteWarning(Strings.WarningChangeDefaultTPD(rmstrustedPublishingDomain.Name, this.DataObject.Name)); base.DataSession.Save(rmstrustedPublishingDomain); } base.DataSession.Save(irmconfiguration); base.InternalProcessRecord(); TaskLogger.LogExit(); }