Exemplo n.º 1
0
 public bool UserMatchesAnyoneIdentity(string userAddress)
 {
     if (string.IsNullOrEmpty(userAddress))
     {
         throw new ArgumentNullException("userAddress");
     }
     return(DirectoryServiceProvider.IsUserMemberOfTenant(DirectoryServiceProvider.RmsIdentityAddressToSmtpAddress(userAddress), this.clientContext.OrgId));
 }
Exemplo n.º 2
0
        public bool EvaluateIdentity(string userAddress, string[] targetAddresses, out string matchedAddress)
        {
            if (string.IsNullOrEmpty(userAddress))
            {
                throw new ArgumentNullException("userAddress");
            }
            if (targetAddresses == null)
            {
                throw new ArgumentNullException("targetAddresses");
            }
            matchedAddress = null;
            string recipientAddress = DirectoryServiceProvider.RmsIdentityAddressToSmtpAddress(userAddress);

            try
            {
                foreach (string text in targetAddresses)
                {
                    if (!string.IsNullOrEmpty(text))
                    {
                        string groupAddress = DirectoryServiceProvider.RmsIdentityAddressToSmtpAddress(text);
                        if (ServerManager.IsMemberOf(this.clientContext, recipientAddress, groupAddress))
                        {
                            matchedAddress = text;
                            return(true);
                        }
                    }
                }
            }
            catch (TransientException ex)
            {
                throw new DirectoryServiceProviderException(false, "Failed to look up " + userAddress, ex);
            }
            catch (ADOperationException ex2)
            {
                throw new DirectoryServiceProviderException(false, "Failed to look up " + userAddress, ex2);
            }
            return(false);
        }