private IEnumerable <RmsTemplate> AcquireRmsTemplates()
        {
            if (this.orgId == OrganizationId.ForestWideOrgId)
            {
                return(RmsClientManager.AcquireRmsTemplates(this.orgId, true));
            }
            if (this.irmConfiguration == null || (!this.irmConfiguration.InternalLicensingEnabled && !this.displayTemplatesIfInternalLicensingDisabled))
            {
                return(DrmEmailConstants.EmptyTemplateArray);
            }
            RMSTrustedPublishingDomain rmstrustedPublishingDomain = this.FindTPD();

            if (rmstrustedPublishingDomain == null)
            {
                return(DrmEmailConstants.EmptyTemplateArray);
            }
            List <RmsTemplate> list = null;

            if (!MultiValuedPropertyBase.IsNullOrEmpty(rmstrustedPublishingDomain.RMSTemplates))
            {
                list = new List <RmsTemplate>(rmstrustedPublishingDomain.RMSTemplates.Count + 2);
                using (MultiValuedProperty <string> .Enumerator enumerator = rmstrustedPublishingDomain.RMSTemplates.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string          encodedTemplate = enumerator.Current;
                        RmsTemplateType type            = RmsTemplateType.Archived;
                        string          templateXrml    = RMUtil.DecompressTemplate(encodedTemplate, out type);
                        if (this.ShouldFetch(type))
                        {
                            list.Add(RmsTemplate.CreateServerTemplateFromTemplateDefinition(templateXrml, type));
                        }
                    }
                    goto IL_CE;
                }
            }
            list = new List <RmsTemplate>(2);
IL_CE:
            if (this.typeToFetch != RmsTemplateType.Archived && rmstrustedPublishingDomain.Default)
            {
                list.Add(RmsTemplate.DoNotForward);
                if (this.irmConfiguration.InternetConfidentialEnabled)
                {
                    list.Add(RmsTemplate.InternetConfidential);
                }
            }
            return(list);
        }
 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;
 }
示例#3
0
        protected override IConfigDataProvider CreateSession()
        {
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, base.SessionSettings, 98, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\rms\\GetRMSTemplate.cs");
            RmsTemplateType       typeToFetch = (this.TrustedPublishingDomain != null) ? RmsTemplateType.All : RmsTemplateType.Distributed;
            bool flag = false;

            if (base.Fields.IsModified("Type"))
            {
                typeToFetch = this.Type;
                flag        = true;
            }
            RMSTrustedPublishingDomain rmstrustedPublishingDomain = null;

            if (this.TrustedPublishingDomain != null)
            {
                rmstrustedPublishingDomain = (RMSTrustedPublishingDomain)base.GetDataObject <RMSTrustedPublishingDomain>(this.TrustedPublishingDomain, tenantOrTopologyConfigurationSession, null, new LocalizedString?(Strings.ErrorTrustedPublishingDomainNotFound(this.TrustedPublishingDomain.ToString())), new LocalizedString?(Strings.ErrorTrustedPublishingDomainNotUnique(this.TrustedPublishingDomain.ToString())));
            }
            return(new RmsTemplateDataProvider(tenantOrTopologyConfigurationSession, typeToFetch, flag || rmstrustedPublishingDomain != null, rmstrustedPublishingDomain));
        }
 public RmsTemplateIdentity(Guid templateId, string templateName, RmsTemplateType templateType)
 {
     this.templateId   = templateId;
     this.templateName = templateName;
     this.templateType = templateType;
 }
 private bool ShouldFetch(RmsTemplateType type)
 {
     return(this.typeToFetch == RmsTemplateType.All || this.typeToFetch == type);
 }
 public RmsTemplateDataProvider(IConfigurationSession adSession, RmsTemplateType typeToFetch, bool displayTemplatesIfInternalLicensingDisabled) : this(adSession, typeToFetch, displayTemplatesIfInternalLicensingDisabled, null)
 {
 }