Esempio n. 1
0
 protected sealed override IConfigDataProvider CreateSession()
 {
     this.targetUser = this.PrepareMailboxUser();
     base.InnerMailboxFolderDataProvider = new MailboxFolderDataProvider(base.OrgWideSessionSettings, this.targetUser, "SetMailboxFolderPermissionBase");
     this.MailboxFolderUserId            = this.User.ResolveMailboxFolderUserId(base.InnerMailboxFolderDataProvider.MailboxSession);
     return(base.InnerMailboxFolderDataProvider);
 }
Esempio n. 2
0
        internal static MailboxFolderUserId TryCreateFromSmtpAddress(string smtpAddress, MailboxSession mailboxSession)
        {
            if (mailboxSession == null)
            {
                throw new ArgumentNullException("mailboxSession");
            }
            if (string.IsNullOrEmpty(smtpAddress))
            {
                throw new ArgumentNullException("smtpAddress");
            }
            if (!SmtpAddress.IsValidSmtpAddress(smtpAddress))
            {
                throw new ArgumentException("smtpAddress");
            }
            MailboxFolderUserId mailboxFolderUserId = new MailboxFolderUserId(new SmtpAddress(smtpAddress));

            try
            {
                mailboxFolderUserId.EnsureExternalUser(mailboxSession);
            }
            catch (InvalidExternalUserIdException)
            {
                return(null);
            }
            return(mailboxFolderUserId);
        }
Esempio n. 3
0
 public MailboxFolderUserIdParameter(MailboxFolderUserId mailboxFolderUserId)
 {
     if (mailboxFolderUserId == null)
     {
         throw new ArgumentNullException("mailboxFolderUserId");
     }
     this.mailboxFolderUserId = mailboxFolderUserId;
 }
 protected override void ValidateMailboxFolderUserId(MailboxFolderUserId mailboxFolderUserId)
 {
     base.ValidateMailboxFolderUserId(mailboxFolderUserId);
     if ((mailboxFolderUserId.UserType == MailboxFolderUserId.MailboxFolderUserType.Default || mailboxFolderUserId.UserType == MailboxFolderUserId.MailboxFolderUserType.Anonymous) && base.UserRecipientTypeDetails != RecipientTypeDetails.PublicFolderMailbox)
     {
         throw new CannotRemoveSpecialUserException();
     }
 }
 protected override void ValidateMailboxFolderUserId(MailboxFolderUserId mailboxFolderUserId)
 {
     base.ValidateMailboxFolderUserId(mailboxFolderUserId);
     if (mailboxFolderUserId.UserType == MailboxFolderUserId.MailboxFolderUserType.Internal && !ADRecipient.IsValidRecipient(mailboxFolderUserId.ADRecipient, !this.IsPublicFolderIdentity))
     {
         throw new InvalidInternalUserIdException(base.User.ToString());
     }
     if (mailboxFolderUserId.UserType == MailboxFolderUserId.MailboxFolderUserType.Unknown)
     {
         throw new InvalidExternalUserIdException(base.User.ToString());
     }
 }
Esempio n. 6
0
        internal static MailboxFolderPermission FromXsoPermission(string folderName, Permission permission, ObjectId mailboxFolderId)
        {
            Collection <MailboxFolderAccessRight> accessRights = MailboxFolderAccessRight.CreateMailboxFolderAccessRightCollection((int)permission.MemberRights);

            return(new MailboxFolderPermission
            {
                FolderName = folderName,
                Identity = mailboxFolderId,
                User = MailboxFolderUserId.CreateFromSecurityPrincipal(permission.Principal),
                AccessRights = accessRights
            });
        }
Esempio n. 7
0
        void IIdentityParameter.Initialize(ObjectId objectId)
        {
            if (objectId == null)
            {
                throw new ArgumentNullException("objectId");
            }
            MailboxFolderUserId mailboxFolderUserId = objectId as MailboxFolderUserId;

            if (mailboxFolderUserId == null)
            {
                ADObjectId adObjectId = objectId as ADObjectId;
                this.recipientIdParameter = new RecipientIdParameter(adObjectId);
                return;
            }
            this.mailboxFolderUserId = mailboxFolderUserId;
        }
Esempio n. 8
0
        private MailboxFolderUserId CreateMailboxFolderUserId(MailboxSession mailboxSession)
        {
            bool flag = !string.IsNullOrEmpty(this.rawIdentity) && SmtpAddress.IsValidSmtpAddress(this.rawIdentity);

            if (flag)
            {
                MailboxFolderUserId mailboxFolderUserId = MailboxFolderUserId.TryCreateFromSmtpAddress(this.rawIdentity, mailboxSession);
                if (mailboxFolderUserId != null)
                {
                    return(mailboxFolderUserId);
                }
            }
            IRecipientSession         adrecipientSession = mailboxSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid);
            IEnumerable <ADRecipient> objects            = this.RecipientIdParameter.GetObjects <ADRecipient>(null, adrecipientSession);

            using (IEnumerator <ADRecipient> enumerator = objects.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    ADRecipient recipient = enumerator.Current;
                    if (enumerator.MoveNext())
                    {
                        throw new ManagementObjectAmbiguousException(Strings.ErrorManagementObjectAmbiguous(this.RecipientIdParameter.ToString()));
                    }
                    bool allowInvalidSecurityPrincipal      = !flag;
                    MailboxFolderUserId mailboxFolderUserId = MailboxFolderUserId.TryCreateFromADRecipient(recipient, allowInvalidSecurityPrincipal);
                    if (mailboxFolderUserId != null)
                    {
                        return(mailboxFolderUserId);
                    }
                    if (!flag)
                    {
                        throw new InvalidInternalUserIdException(this.RecipientIdParameter.ToString());
                    }
                }
            }
            if (flag)
            {
                throw new InvalidExternalUserIdException(this.rawIdentity);
            }
            return(MailboxFolderUserId.CreateFromUnknownUser(this.rawIdentity));
        }
Esempio n. 9
0
 protected virtual void ValidateMailboxFolderUserId(MailboxFolderUserId mailboxFolderUserId)
 {
 }