예제 #1
0
        public override bool?TryIsInRole(ExchangeRunspaceConfiguration rbacConfiguration)
        {
            SmtpAddress smtpAddress = new SmtpAddress(HttpContextExtensions.CurrentUserLiveID());

            if (smtpAddress.IsValidAddress)
            {
                DomainCacheValue domainCacheValue = DomainCache.Singleton.Get(new SmtpDomainWithSubdomains(smtpAddress.Domain), RbacPrincipal.Current.RbacConfiguration.ExecutingUserOrganizationId);
                return(new bool?(domainCacheValue != null && this.predicate(domainCacheValue)));
            }
            return(new bool?(false));
        }
예제 #2
0
 public Account(Mailbox mailbox) : base(mailbox)
 {
     if (base.IsRoom)
     {
         this.UserNameLabel = OwaOptionStrings.RoomEmailAddressLabel;
         base.EmailAddress  = base.PrimaryEmailAddress;
     }
     else
     {
         SmtpAddress windowsLiveID = mailbox.WindowsLiveID;
         if (SmtpAddress.Empty != windowsLiveID)
         {
             base.EmailAddress = windowsLiveID.ToString();
             this.UserName     = windowsLiveID.Local;
             this.Domain       = windowsLiveID.Domain;
             DomainCacheValue domainCacheValue = DomainCache.Singleton.Get(new SmtpDomainWithSubdomains(this.Domain), mailbox.OrganizationId);
             this.UserNameLabel = ((domainCacheValue != null && domainCacheValue.LiveIdInstanceType == LiveIdInstanceType.Business) ? OwaOptionStrings.UserNameMOSIDLabel : OwaOptionStrings.UserNameWLIDLabel);
         }
         else
         {
             this.UserNameLabel = OwaOptionStrings.UserLogonNameLabel;
             string userPrincipalName = mailbox.UserPrincipalName;
             base.EmailAddress = userPrincipalName;
             int num = userPrincipalName.IndexOf('@');
             if (num > 0)
             {
                 this.UserName = userPrincipalName.Substring(0, num);
                 this.Domain   = userPrincipalName.Substring(num + 1);
             }
             else
             {
                 this.UserName = null;
                 this.Domain   = null;
             }
         }
     }
     this.UserPhotoUrl = string.Format(CultureInfo.InvariantCulture, "~/Download.aspx?Identity={0}&handlerClass=UserPhotoDownloadHandler&preview=false", new object[]
     {
         base.PrimaryEmailAddress
     });
     this.userPhotoPreviewUrl = string.Format(CultureInfo.InvariantCulture, "~/Download.aspx?Identity={0}&handlerClass=UserPhotoDownloadHandler&preview=true", new object[]
     {
         base.PrimaryEmailAddress
     });
 }
예제 #3
0
        public static bool IsFederatedUser(this RbacPrincipal rbacPrincipal)
        {
            bool result = false;
            ExchangeRunspaceConfiguration rbacConfiguration = rbacPrincipal.RbacConfiguration;
            SmtpAddress executingUserPrimarySmtpAddress     = rbacConfiguration.ExecutingUserPrimarySmtpAddress;

            if (!executingUserPrimarySmtpAddress.IsValidAddress)
            {
                string executingUserPrincipalName = rbacConfiguration.ExecutingUserPrincipalName;
                if (!string.IsNullOrEmpty(executingUserPrincipalName) && SmtpAddress.IsValidSmtpAddress(executingUserPrincipalName))
                {
                    executingUserPrimarySmtpAddress = new SmtpAddress(executingUserPrincipalName);
                }
            }
            if (executingUserPrimarySmtpAddress.IsValidAddress)
            {
                SmtpDomainWithSubdomains smtpDomainWithSubdomains = new SmtpDomainWithSubdomains(executingUserPrimarySmtpAddress.Domain);
                DomainCacheValue         domainCacheValue         = DomainCache.Singleton.Get(smtpDomainWithSubdomains, rbacConfiguration.OrganizationId);
                result = (domainCacheValue != null && domainCacheValue.AuthenticationType != null && domainCacheValue.AuthenticationType.Value == AuthenticationType.Federated);
            }
            return(result);
        }