Example #1
0
 public bool PolicyGroupMapExists(string policyName, string groupName, CertPolicyUse policyUse, bool incoming, bool outgoing)
 {
     using (ConfigDatabase db = this.Store.CreateReadContext())
     {
         return(db.CertPolicyGroupMaps.Exists(policyName, groupName, policyUse, incoming, outgoing));
     }
 }
Example #2
0
 internal void PushAddPolicyToGroup(string policyName, string groupName, CertPolicyUse policyUse, bool incoming, bool outgoing, bool checkForDupes)
 {
     try
     {
         if (!checkForDupes || !Client.Contains(policyName, groupName, policyUse, incoming, outgoing))
         {
             Client.AddPolicyToGroup(policyName, groupName, policyUse, incoming, outgoing);
             WriteLine("Added {0} to {1}", policyName, groupName);
             WriteLine("With the following usage >");
             WriteLine(" \t policyUse: {0}", policyUse.ToString());
             WriteLine(" \t forIncoming: {0}", incoming);
             WriteLine(" \t forOutgoing: {0}", outgoing);
         }
         else
         {
             WriteLine("Policy to group association already exists");
         }
     }
     catch (FaultException <ConfigStoreFault> ex)
     {
         if (ex.Detail.Error == ConfigStoreError.UniqueConstraint)
         {
             WriteLine("Policy to group association already exists");
         }
         else
         {
             throw;
         }
     }
 }
Example #3
0
 public CertPolicyGroupMap(CertPolicyUse use, bool forIncoming, bool forOutgoing) : this()
 {
     m_new       = true;
     Use         = use;
     ForIncoming = forIncoming;
     ForOutgoing = forOutgoing;
 }
Example #4
0
 public CertPolicyGroupMap(CertPolicyUse use, bool forIncoming, bool forOutgoing): this()
 {
     m_new = true;
     Use = use;
     ForIncoming = forIncoming;
     ForOutgoing = forOutgoing;
 }
Example #5
0
 public void AddPolicyUse(string policyName, string groupName, CertPolicyUse policyUse, bool incoming, bool outgoing)
 {
     using (ConfigDatabase db = this.Store.CreateContext(DataLoadOptions))
     {
         this.AddPolicyUse(db, policyName, groupName, policyUse, incoming, outgoing);
         db.SubmitChanges();
     }
 }
Example #6
0
 public bool PolicyToGroupExists(string policyName, string groupName, CertPolicyUse policyUse, bool incoming, bool outgoing)
 {
     try
     {
         return(Store.CertPolicyGroups.PolicyGroupMapExists(policyName, groupName, policyUse, incoming, outgoing));
     }
     catch (Exception ex)
     {
         throw CreateFault("PolicyToGroupExists", ex);
     }
 }
Example #7
0
 public CertPolicy[] GetOutgoingPoliciesByOwner(string owner, CertPolicyUse use)
 {
     try
     {
         return(Store.CertPolicies.GetOutgoingByOwner(owner, use));
     }
     catch (Exception ex)
     {
         throw CreateFault("GetOutgoingPoliciesByOwner", ex);
     }
 }
Example #8
0
        public CertPolicy[] GetOutgoingByOwner(string owner, CertPolicyUse use)
        {
            if (string.IsNullOrEmpty(owner))
            {
                throw new ConfigStoreException(ConfigStoreError.InvalidOwnerName);
            }

            using (ConfigDatabase db = this.Store.CreateReadContext())
            {
                var cpgs = db.CertPolicies.GetOutgoing(owner, use);
                return(cpgs.ToArray());
            }
        }
Example #9
0
 public void AddPolicyToGroup(string policyName, string groupName, CertPolicyUse policyUse, bool incoming, bool outgoing)
 {
     try
     {
         CertPolicy certPolicy = Store.CertPolicies.Get(policyName);
         if (certPolicy == null)
         {
             throw new ConfigStoreException(ConfigStoreError.InvalidCertPolicyName);
         }
         Store.CertPolicyGroups.AddPolicyUse(policyName, groupName, policyUse, incoming, outgoing);
     }
     catch (FaultException faultEx)
     {
         throw faultEx;
     }
     catch (Exception ex)
     {
         throw CreateFault("AddPolicyToGroup", ex);
     }
 }
Example #10
0
 public CertPolicy[] GetOutgoingPoliciesByOwner(string owner, CertPolicyUse use)
 {
     try
     {
         return Store.CertPolicies.GetOutgoingByOwner(owner, use);
     }
     catch (Exception ex)
     {
         throw CreateFault("GetOutgoingPoliciesByOwner", ex);
     }
 }
 public static bool Exists(this Table <CertPolicyGroupMap> table, string policyName, string groupName, CertPolicyUse policyUse, bool incoming,
                           bool outgoing)
 {
     return(map(table.GetDB(), policyName, groupName, policyUse, incoming, outgoing).Any());
 }
Example #12
0
 internal CertPolicyIndex(ClientSettings clientSettings, bool incoming, CertPolicyUse use)
 {
     m_clientSettings = clientSettings;
     m_incoming = incoming;
     m_use = use;
 }
Example #13
0
 public void AddPolicyToGroup(string policyName, string groupName, CertPolicyUse policyUse, bool incoming, bool outgoing)
 {
     try
     {
         CertPolicy certPolicy = Store.CertPolicies.Get(policyName);
         if (certPolicy == null)
         {
             throw new ConfigStoreException(ConfigStoreError.InvalidCertPolicyName);
         }
         Store.CertPolicyGroups.AddPolicyUse(policyName, groupName, policyUse, incoming, outgoing);
     }
     catch (FaultException faultEx)
     {
         throw faultEx;
     }
     catch (Exception ex)
     {
         throw CreateFault("AddPolicyToGroup", ex);
     }
 }
Example #14
0
 public bool PolicyToGroupExists(string policyName, string groupName, CertPolicyUse policyUse, bool incoming, bool outgoing)
 {
     try
     {
         return Store.CertPolicyGroups.PolicyGroupMapExists(policyName, groupName, policyUse, incoming, outgoing);
     }
     catch (Exception ex)
     {
         throw CreateFault("PolicyToGroupExists", ex);
     }
 }
Example #15
0
        protected void AddPolicyUse(ConfigDatabase db, string policyName, string groupName, CertPolicyUse policyUse, bool incoming, bool outgoing)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }
            if (String.IsNullOrEmpty(policyName))
            {
                throw new ConfigStoreException(ConfigStoreError.InvalidCertPolicyName);
            }
            if (String.IsNullOrEmpty(groupName))
            {
                throw new ConfigStoreException(ConfigStoreError.InvalidCertPolicyGroupName);
            }
            CertPolicyGroup group  = db.CertPolicyGroups.Get(groupName);
            CertPolicy      policy = db.CertPolicyGroups.GetPolicy(policyName);

            group.CertPolicies.Add(policy);
            CertPolicyGroupMap map = group.CertPolicyGroupMaps.First(m => m.IsNew);

            map.Use         = policyUse;
            map.ForIncoming = incoming;
            map.ForOutgoing = outgoing;
        }
Example #16
0
        public static IEnumerable <CertPolicy> GetOutgoing(this Table <CertPolicy> table, string owner, CertPolicyUse use)
        {
            var q =
                from c in table.GetDB().CertPolicies
                join groupMap in table.GetDB().CertPolicyGroupMaps
                on c equals groupMap.CertPolicy
                join g in table.GetDB().CertPolicyGroups
                on groupMap.CertPolicyGroup equals g
                join domainMap in table.GetDB().CertPolicyGroupDomainMaps
                on g equals domainMap.CertPolicyGroup
                where domainMap.Owner == @owner &&
                groupMap.ForOutgoing &&
                groupMap.Use == use
                select c;

            return(q);
        }
Example #17
0
 public static bool Contains(this CertPolicyStoreClient client, string policyName, string groupName, CertPolicyUse policyUse, bool incoming, bool outgoing)
 {
     return client.PolicyToGroupExists(policyName, groupName, policyUse, incoming, outgoing);
 }
Example #18
0
 internal CertPolicyIndex(ClientSettings clientSettings, bool incoming, CertPolicyUse use)
 {
     m_clientSettings = clientSettings;
     m_incoming       = incoming;
     m_use            = use;
 }
 public static bool Exists(this Table<CertPolicyGroupMap> table, string policyName, string groupName, CertPolicyUse policyUse, bool incoming,
     bool outgoing)
 {
     return map(table.GetDB(), policyName, groupName, policyUse, incoming, outgoing).Any();
 }
Example #20
0
 public static IEnumerable<CertPolicy> GetOutgoing(this Table<CertPolicy> table, string owner, CertPolicyUse use)
 {
     var q =
         from c in table.GetDB().CertPolicies
         join groupMap in table.GetDB().CertPolicyGroupMaps
             on c equals groupMap.CertPolicy
         join g in table.GetDB().CertPolicyGroups
             on groupMap.CertPolicyGroup equals g
         join domainMap in table.GetDB().CertPolicyGroupDomainMaps
             on g equals domainMap.CertPolicyGroup
         where domainMap.Owner == @owner
               && groupMap.ForOutgoing
               && groupMap.Use == use
         select c;
     return q;
 }
Example #21
0
 public static bool Contains(this CertPolicyStoreClient client, string policyName, string groupName, CertPolicyUse policyUse, bool incoming, bool outgoing)
 {
     return(client.PolicyToGroupExists(policyName, groupName, policyUse, incoming, outgoing));
 }