예제 #1
0
        private void LoadPublishedCalendarOptionsForReachUser()
        {
            this.publishedOptions = new MailboxCalendarFolder();
            PermissionSecurityPrincipal targetPrincipal = null;

            using (ExternalUserCollection externalUsers = base.MailboxSession.GetExternalUsers())
            {
                ExternalUser externalUser = externalUsers.FindExternalUser(this.reachUserSid);
                if (externalUser == null || !externalUser.IsReachUser)
                {
                    ExTraceGlobals.SharingTracer.TraceDebug <SecurityIdentifier, bool, bool>((long)this.GetHashCode(), "ReachAccessSid={0}, Found ExternalUser:{1}, IsReachUser:{2}", this.reachUserSid, externalUser != null, externalUser != null && externalUser.IsReachUser);
                    throw new PublishedFolderAccessDeniedException();
                }
                targetPrincipal = new PermissionSecurityPrincipal(externalUser);
            }
            DetailLevelEnumType?freeBusyAccessLevel = this.GetFreeBusyAccessLevel(targetPrincipal);

            if (freeBusyAccessLevel == null)
            {
                throw new PublishedFolderAccessDeniedException();
            }
            this.publishedOptions.DetailLevel          = freeBusyAccessLevel.Value;
            this.publishedOptions.PublishEnabled       = true;
            this.publishedOptions.PublishDateRangeFrom = DateRangeEnumType.OneMonth;
            this.publishedOptions.PublishDateRangeTo   = DateRangeEnumType.SixMonths;
        }
예제 #2
0
        internal static ExternalUser TryGetExternalUser(SecurityIdentifier sid, ExternalUserCollection externalUsers)
        {
            ExternalUser result = null;

            if (ExternalUser.IsExternalUserSid(sid) && externalUsers != null)
            {
                result = externalUsers.FindExternalUser(sid);
            }
            return(result);
        }
예제 #3
0
        private PermissionSecurityPrincipal CreatePermissionSecurityPrincipal(string recipient, ExternalUserCollection externalUserCollection)
        {
            ExternalUser externalUser = externalUserCollection.FindExternalUser(new SmtpAddress(recipient));

            if (externalUser == null)
            {
                return(null);
            }
            return(new PermissionSecurityPrincipal(externalUser));
        }
예제 #4
0
 internal ExternalUser TryGetExternalUser(byte[] memberEntryId, ref ExternalUserCollection externalUsers)
 {
     if (memberEntryId != null)
     {
         MailboxSession mailboxSession = this.Session as MailboxSession;
         if (externalUsers == null && mailboxSession != null)
         {
             externalUsers = mailboxSession.GetExternalUsers();
         }
         if (externalUsers != null)
         {
             try
             {
                 byte[]       binaryForm = null;
                 StoreSession session    = this.Session;
                 bool         flag       = false;
                 try
                 {
                     if (session != null)
                     {
                         session.BeginMapiCall();
                         session.BeginServerHealthCall();
                         flag = true;
                     }
                     if (StorageGlobals.MapiTestHookBeforeCall != null)
                     {
                         StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                     }
                     binaryForm = MapiStore.GetLocalDirectorySIDFromAddressBookEntryId(memberEntryId);
                 }
                 catch (MapiPermanentException ex)
                 {
                     throw StorageGlobals.TranslateMapiException(ServerStrings.InvalidPermissionsEntry, ex, session, this, "{0}. MapiException = {1}.", new object[]
                     {
                         string.Format("ACL table has invalid entry id.", new object[0]),
                         ex
                     });
                 }
                 catch (MapiRetryableException ex2)
                 {
                     throw StorageGlobals.TranslateMapiException(ServerStrings.InvalidPermissionsEntry, ex2, session, this, "{0}. MapiException = {1}.", new object[]
                     {
                         string.Format("ACL table has invalid entry id.", new object[0]),
                         ex2
                     });
                 }
                 finally
                 {
                     try
                     {
                         if (session != null)
                         {
                             session.EndMapiCall();
                             if (flag)
                             {
                                 session.EndServerHealthCall();
                             }
                         }
                     }
                     finally
                     {
                         if (StorageGlobals.MapiTestHookAfterCall != null)
                         {
                             StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                         }
                     }
                 }
                 SecurityIdentifier sid = new SecurityIdentifier(binaryForm, 0);
                 return(externalUsers.FindExternalUser(sid));
             }
             catch (ObjectNotFoundException)
             {
             }
         }
     }
     return(null);
 }