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; }
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; }