Example #1
0
        private bool DlpPolicyMatches(TransportRule rule)
        {
            if (!base.Fields.IsModified("DlpPolicy"))
            {
                return(true);
            }
            Guid immutableId;

            if (!Guid.TryParse(this.DlpPolicy, out immutableId))
            {
                ADComplianceProgram adcomplianceProgram = DlpUtils.GetInstalledTenantDlpPolicies(base.DataSession, this.DlpPolicy).FirstOrDefault <ADComplianceProgram>();
                if (adcomplianceProgram == null)
                {
                    return(false);
                }
                immutableId = adcomplianceProgram.ImmutableId;
            }
            Guid guid;

            if (rule.TryGetDlpPolicyId(out guid))
            {
                return(guid.Equals(immutableId));
            }
            return(string.IsNullOrEmpty(this.DlpPolicy));
        }
 private void GetDlpPolicies(string target, List <MailFilterListReport> values)
 {
     if (Schema.Utilities.HasDlpRole(this))
     {
         foreach (ADComplianceProgram adcomplianceProgram in DlpUtils.GetInstalledTenantDlpPolicies(base.ConfigSession))
         {
             values.Add(new MailFilterListReport
             {
                 Organization    = base.Organization.ToString(),
                 SelectionTarget = target,
                 Display         = adcomplianceProgram.Name,
                 Value           = adcomplianceProgram.Name
             });
         }
     }
 }
        internal void ValidateDlpPolicy(PropertyInfo property, object task, IConfigDataProvider configSession)
        {
            IList <string> list;

            if (!DatacenterRegistry.IsForefrontForOffice() && this.TryGetValues <string>(property, task, out list) && list.Count > 0)
            {
                if (configSession == null)
                {
                    throw new NullReferenceException("ValidateDlpPolicy requires an IConfigDataProvider");
                }
                HashSet <string> installedDlp = new HashSet <string>(from dlp in DlpUtils.GetInstalledTenantDlpPolicies(configSession)
                                                                     select dlp.Name.ToLower());
                if (!list.All((string dlp) => installedDlp.Contains(dlp.ToLower())))
                {
                    this.ThrowError(property);
                }
            }
        }