Exemplo n.º 1
0
        public string[] GetNonMembers(string usertocheck, string[] groupstocheck) 
        {
            if (usertocheck == null || groupstocheck == null)
            {
                string msg = ResourceManager.GetString("LDAP_INVALIDADDR",
                    "Workshare.DirectorySearcher.Exceptions", typeof(DirectoryAnalyzerImpl).Assembly);
				Logger.LogInfo(msg);
                throw (new ArgumentNullException(msg));
            }

            string[] addrs = new string[0];

            if (IsLdapAvailable)
            {
                IAddress ldapAddress = GetAddressInformation(usertocheck);
                IAddressCollection policyAddresses = new AddressCollection(m_engine);
                policyAddresses.Add(ldapAddress);
                IAddressCollection groupAddresses = GetAddressCollectionInformation(groupstocheck);
                policyAddresses.ContainMembersOf(groupAddresses);
                addrs =  policyAddresses.GetAddresses(false);
            }
            return addrs;
        }
Exemplo n.º 2
0
        public IAddressCollection GetAddressCollectionInformation(string[] emails)
        {
            AddressCollection ac = new AddressCollection(m_engine);
            ac.AddRange(emails);
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("Found ({0}) addresses for emails string array", ac.Count);
			Logger.LogInfo(sb.ToString());
            return (IAddressCollection)ac;
        }
Exemplo n.º 3
0
 public bool IsMemberOfGroup(string address, string[] group)
 {
     IAddress ldapAddress = GetAddressInformation(address);
     IAddressCollection policyAddresses = new AddressCollection(m_engine);
     policyAddresses.Add(ldapAddress);
     IAddressCollection groupAddresses = GetAddressCollectionInformation(group);
     bool isMemberOf = false;
     try
     {
         if (IsLdapAvailable)
             isMemberOf = IsMemberOf(policyAddresses, groupAddresses);
     }
     catch (LdapException)
     {
         // ignore for now
         isMemberOf = false;
     }
     return isMemberOf;
 }
Exemplo n.º 4
0
        public IAddressCollection GetAddressCollectionInformation(string value, FieldType field)
        {
            AddressCollection ac = new AddressCollection(m_engine);

            if (IsLdapAvailable)
            {
                ac.AddRange(m_engine.RetrieveMembersByField(field, value, ""));
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("Found ({0}) addresses for field names", ac.Count);
				Logger.LogInfo(sb.ToString());
            }
            return (IAddressCollection)ac;
        }