private RmsTemplateIdentity ResolveTemplate(ADObject dataObject)
        {
            string name = (this.ApplyRightsProtectionTemplate != null) ? this.ApplyRightsProtectionTemplate.ToString() : string.Empty;

            if (TaskHelper.ShouldUnderscopeDataSessionToOrganization((IDirectorySession)base.DataSession, dataObject))
            {
                base.UnderscopeDataSession(dataObject.OrganizationId);
            }
            RmsTemplateDataProvider session = new RmsTemplateDataProvider((IConfigurationSession)base.DataSession, RmsTemplateType.Distributed, true);
            RmsTemplatePresentation rmsTemplatePresentation = (RmsTemplatePresentation)base.GetDataObject <RmsTemplatePresentation>(this.ApplyRightsProtectionTemplate, session, null, new LocalizedString?(Strings.OutlookProtectionRuleRmsTemplateNotFound(name)), new LocalizedString?(Strings.OutlookProtectionRuleRmsTemplateNotUnique(name)));

            return((RmsTemplateIdentity)rmsTemplatePresentation.Identity);
        }
예제 #2
0
        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);
                }
            }
        }