예제 #1
0
        protected static bool TryGetDelegateRuleTypeFromSession(MailboxSession session, out DelegateRuleType?ruleType)
        {
            bool result = false;

            ruleType = null;
            if (session != null && session.Capabilities.CanHaveDelegateUsers)
            {
                try
                {
                    DelegateUserCollection delegateUserCollection = new DelegateUserCollection(session);
                    if (delegateUserCollection.Count > 0)
                    {
                        ruleType = new DelegateRuleType?(delegateUserCollection.DelegateRuleType);
                    }
                    result = true;
                }
                catch (DelegateUserNoFreeBusyFolderException)
                {
                    ExTraceGlobals.MeetingMessageTracer.Information((long)session.GetHashCode(), "Storage.MeetingMessage.TryGetDelegateType: NoFreeBusyData Folder, failing to get delegate rule type.");
                }
                catch (ObjectNotFoundException)
                {
                    ExTraceGlobals.MeetingMessageTracer.Information((long)session.GetHashCode(), "Storage.MeetingMessage.TryGetDelegateType: No delegates found, failing to get delegate rule type.");
                }
            }
            return(result);
        }
        // Token: 0x06000778 RID: 1912 RVA: 0x000348C8 File Offset: 0x00032AC8
        private void HandleDelegateRuleMessage(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item)
        {
            if (mapiEvent.ItemEntryId == null)
            {
                return;
            }
            if (mapiEvent.EventMask == MapiEventTypeFlags.ObjectDeleted)
            {
                DelegateRulesManagementLogger.LogEntry(itemStore, string.Format("Client Type: {0} \nEvent: {1} \nMapiEvent ItemEntryID : {2}\n", mapiEvent.ClientType, mapiEvent.EventMask, mapiEvent.ItemEntryIdString));
                return;
            }
            Rule delegateRule = this.GetDelegateRule(mapiEvent, itemStore);

            if (mapiEvent.EventMask != MapiEventTypeFlags.ObjectDeleted && delegateRule != null)
            {
                try
                {
                    DelegateUserCollection delegateUserCollection = new DelegateUserCollection(itemStore);
                    DelegateRulesManagementLogger.LogEntry(itemStore, string.Format("Client Type: {0} \nEvent: {1} \nTotal Inbox Rules count: {2} \nDelegate RuleName: Delegate Rule {3}, Delegate RuleProvider: {4} \nDelegates added for {5}: {6} \nDelegate can see Private Items: {7} \nDelegate RuleType for {8}: {9} \nMapiEvent ItemEntryID : {10}\n", new object[]
                    {
                        mapiEvent.ClientType,
                        mapiEvent.EventMask,
                        itemStore.AllInboxRules.Count,
                        delegateRule.ID,
                        delegateRule.Provider,
                        itemStore.DisplayName,
                        string.Join(",", delegateUserCollection.DelegateRestoreInfo.Names),
                        string.Join <int>(",", delegateUserCollection.DelegateRestoreInfo.Flags),
                        itemStore.DisplayName,
                        delegateUserCollection.DelegateRuleType,
                        mapiEvent.ItemEntryIdString
                    }));
                }
                catch (DelegateUserNoFreeBusyFolderException)
                {
                    CalendarAssistant.GeneralTracer.TraceDebug((long)this.GetHashCode(), "{0}: FreeBusy folder does not exist. Skipping Delegate Rules Logging.", new object[]
                    {
                        TraceContext.Get()
                    });
                    CalendarAssistantLog.LogEntry(itemStore, "Could not get FreeBusy folder id", new object[0]);
                }
            }
        }
예제 #3
0
        private static MeetingInquiryAction GetReviveAction(CalendarVersionStoreGateway cvsGateway, MailboxSession session, CalendarItemBase deletedVersion)
        {
            MeetingInquiryAction result;

            if (deletedVersion == null)
            {
                result = MeetingInquiryAction.DeletedVersionNotFound;
            }
            else
            {
                bool flag = false;
                try
                {
                    if (session.Capabilities.CanHaveDelegateUsers)
                    {
                        DelegateUserCollection delegateUserCollection = new DelegateUserCollection(session);
                        flag = (delegateUserCollection.Count > 0);
                    }
                }
                catch (DelegateUserNoFreeBusyFolderException)
                {
                    ExTraceGlobals.MeetingMessageTracer.Information((long)session.GetHashCode(), "Storage.MeetingInquiryMessage.GetReviveAction: NoFreeBusyData Folder, failing to get delegate rule type.");
                }
                catch (ObjectNotFoundException)
                {
                    ExTraceGlobals.MeetingMessageTracer.Information((long)session.GetHashCode(), "Storage.MeetingInquiryMessage.GetReviveAction: No delegates found, failing to get delegate rule type.");
                }
                if (!flag)
                {
                    result = (MeetingInquiryMessage.PairWithCancellation(cvsGateway, deletedVersion, session) ? MeetingInquiryAction.PairedCancellationFound : MeetingInquiryAction.ReviveMeeting);
                }
                else
                {
                    ExTraceGlobals.MeetingMessageTracer.TraceDebug <string, GlobalObjectId>((long)session.GetHashCode(), "Storage.MeetingInquiryMessage::GetReviveAction. Mailbox {0} has delegates so we can't get the cancellation from version store. Skipping GOID {1}", session.DisplayName, deletedVersion.GlobalObjectId);
                    result = MeetingInquiryAction.HasDelegates;
                }
            }
            return(result);
        }
        public bool TryGetProvider(SmtpAddress recipientAddress, ADRecipient adRecipient, IFrontEndLocator frontEndLocator, out SharingProvider provider, out DetailLevelEnumType detailLevel)
        {
            provider    = null;
            detailLevel = DetailLevelEnumType.AvailabilityOnly;
            bool result;

            try
            {
                if (this.mailboxOwner.GetConfiguration().DataStorage.XOWAConsumerSharing.Enabled)
                {
                    provider    = SharingProvider.SharingProviderConsumer;
                    detailLevel = DetailLevelEnumType.Editor;
                    result      = true;
                }
                else
                {
                    if (adRecipient != null)
                    {
                        if (adRecipient.IsValidSecurityPrincipal)
                        {
                            provider    = SharingProvider.SharingProviderInternal;
                            detailLevel = DetailLevelEnumType.Editor;
                            return(true);
                        }
                        if (DelegateUserCollection.IsCrossPremiseDelegateEnabled(this.mailboxOwner) && (adRecipient.RecipientType == RecipientType.User || adRecipient.RecipientType == RecipientType.UserMailbox || adRecipient.RecipientType == RecipientType.MailUser))
                        {
                            provider    = SharingProvider.SharingProviderInternal;
                            detailLevel = DetailLevelEnumType.Editor;
                            return(true);
                        }
                        if (adRecipient.RecipientType != RecipientType.User && adRecipient.RecipientType != RecipientType.UserMailbox && adRecipient.RecipientType != RecipientType.MailUser && adRecipient.RecipientType != RecipientType.Contact && adRecipient.RecipientType != RecipientType.MailContact)
                        {
                            return(false);
                        }
                    }
                    SharingPolicyDomain effectiveCalendarSharingPolicy = this.GetEffectiveCalendarSharingPolicy(recipientAddress.Domain, frontEndLocator);
                    this.TraceDebug("Policy found:{0}", new object[]
                    {
                        (effectiveCalendarSharingPolicy == null) ? "none" : effectiveCalendarSharingPolicy.Domain
                    });
                    int maxAllowed;
                    if (effectiveCalendarSharingPolicy != null && (maxAllowed = PolicyAllowedDetailLevel.GetMaxAllowed(effectiveCalendarSharingPolicy.Actions)) > 0)
                    {
                        detailLevel = (DetailLevelEnumType)maxAllowed;
                        if (effectiveCalendarSharingPolicy.Domain == "Anonymous")
                        {
                            provider = SharingProvider.SharingProviderPublishReach;
                        }
                        else
                        {
                            provider = SharingProvider.SharingProviderExternal;
                        }
                    }
                    result = (provider != null);
                }
            }
            finally
            {
                this.TraceDebug("MailboxOwner:{0},Recipient:{1},RecipientType:{2},Handler={2},DetailLevel={3}", new object[]
                {
                    this.mailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(),
                    recipientAddress,
                    (adRecipient == null) ? "none" : adRecipient.RecipientType.ToString(),
                    (provider == null) ? "none" : provider.Name,
                    detailLevel
                });
            }
            return(result);
        }
예제 #5
0
        internal static PermissionTable Load(Func <PermissionTable, PermissionSet> permissionSetFactory, CoreFolder coreFolder)
        {
            PermissionTable permissionTable = new PermissionTable(permissionSetFactory);

            permissionTable.LoadFrom(coreFolder);
            object obj = coreFolder.Session.Mailbox.TryGetProperty(MailboxSchema.MailboxType);

            if (obj is int && StoreSession.IsPublicFolderMailbox((int)obj))
            {
                permissionTable.isPublicFolder = true;
            }
            PermissionTable.isCrossPremiseDelegateAllowedForMailboxOwner = (coreFolder.Session.MailboxOwner != null && DelegateUserCollection.IsCrossPremiseDelegateEnabled(coreFolder.Session.MailboxOwner));
            return(permissionTable);
        }