// Token: 0x06000E5B RID: 3675 RVA: 0x00056660 File Offset: 0x00054860
 private SharingPolicyCache(SharingPolicy policy, bool isDehydrated)
 {
     ArgumentValidator.ThrowIfNull("policy", policy);
     this.policy = policy;
     this.BelongsToDehydratedContainer = isDehydrated;
     this.PopulatePolicyHash();
 }
Esempio n. 2
0
 internal InMemoryPlan(QueueMetrics queueMetrics, SharingPolicy policy, ReservationAgent
                       agent, Org.Apache.Hadoop.Yarn.Api.Records.Resource totalCapacity, long step, ResourceCalculator
                       resCalc, Org.Apache.Hadoop.Yarn.Api.Records.Resource minAlloc, Org.Apache.Hadoop.Yarn.Api.Records.Resource
                       maxAlloc, string queueName, Planner replanner, bool getMoveOnExpiry)
     : this(queueMetrics, policy, agent, totalCapacity, step, resCalc, minAlloc, maxAlloc
            , queueName, replanner, getMoveOnExpiry, new UTCClock())
 {
 }
Esempio n. 3
0
        /// <summary>
        ///     Factory for <see cref="EvaluationContext" />
        /// </summary>
        public static EvaluationContext Create(SharingPolicy policy)
        {
            var context = new EvaluationContext(policy);

            TestOnlyHookOnCreate?.Invoke(context);

            return(context);
        }
 // Token: 0x06000E4C RID: 3660 RVA: 0x00055DB0 File Offset: 0x00053FB0
 private bool ApplyPolicy(MailboxSession mailboxSession, SharingPolicy policy)
 {
     using (MailboxData mailboxData = new MailboxData(mailboxSession, policy))
     {
         if (mailboxData.MaxAnonymousDetailLevel == 0)
         {
             SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "Anonymous access is disabled. Clearing AD SharingAnonymousIdentities entries for user:{0}", mailboxData.MailboxSession.MailboxOwner);
             ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
             {
                 ADUser aduser = mailboxData.RecipientSession.Read(mailboxData.MailboxSession.MailboxOwner.ObjectId) as ADUser;
                 aduser.SharingAnonymousIdentities.Clear();
                 mailboxData.RecipientSession.Save(aduser);
             }, 3);
             if (!adoperationResult.Succeeded)
             {
                 SharingPolicyAssistant.Tracer.TraceError <IExchangePrincipal, Exception>((long)this.GetHashCode(), "Failed to clear AD SharingAnonymousIdentities entries for user:{0},  Error: {1}", mailboxData.MailboxSession.MailboxOwner, adoperationResult.Exception);
                 return(false);
             }
         }
         using (Folder folder = Folder.Bind(mailboxSession, DefaultFolderType.Configuration))
         {
             using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.DeepTraversal, null, null, SharingPolicyAssistant.FolderQueryProperties))
             {
                 for (;;)
                 {
                     object[][] rows = queryResult.GetRows(64);
                     if (rows == null || rows.Length == 0)
                     {
                         break;
                     }
                     foreach (object[] array2 in rows)
                     {
                         string  arg     = array2[1] as string;
                         StoreId storeId = array2[0] as StoreId;
                         if (storeId == null)
                         {
                             SharingPolicyAssistant.Tracer.TraceError <IExchangePrincipal, object, string>((long)this.GetHashCode(), "{0}: cannot process folder row due unknown id: {1} - {2}", mailboxSession.MailboxOwner, array2[0], arg);
                         }
                         else
                         {
                             using (FolderData folderData = new FolderData(mailboxSession, storeId))
                             {
                                 this.ApplyPolicyForExternalSharing(array2, mailboxData, folderData);
                                 this.ApplyPolicyForAnonymousSharing(array2, mailboxData, folderData);
                                 if (folderData.IsChanged)
                                 {
                                     folderData.Folder.Save();
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return(true);
 }
Esempio n. 5
0
        public static void GetObjectPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            SharingPolicy sharingPolicy = store.GetDataObject("SharingPolicy") as SharingPolicy;

            if (dataTable.Rows.Count == 1 && sharingPolicy != null)
            {
                SharingPolicyAssistor.UpdateFormattedNameAndDomains(dataTable.Rows[0]);
            }
        }
Esempio n. 6
0
 // Token: 0x06000E2E RID: 3630 RVA: 0x000556F4 File Offset: 0x000538F4
 internal MailboxData(MailboxSession mailboxSession, SharingPolicy sharingPolicy)
 {
     if (mailboxSession == null)
     {
         throw new ArgumentNullException("mailboxSession");
     }
     this.mailboxSession = mailboxSession;
     this.sharingPolicy  = sharingPolicy;
 }
Esempio n. 7
0
        internal EvaluationContext(SharingPolicy policy)
        {
            Policy = policy;

            SdkResolverService      = new CachingSdkResolverService();
            FileEntryExpansionCache = new ConcurrentDictionary <string, ImmutableArray <string> >();
            FileSystem          = new CachingFileSystemWrapper(FileSystems.Default);
            EngineFileUtilities = new EngineFileUtilities(new FileMatcher(FileSystem, FileEntryExpansionCache));
        }
        // Token: 0x06000E60 RID: 3680 RVA: 0x00056750 File Offset: 0x00054950
        private static SharingPolicyCache GetHydratedPolicyFromCacheOrAD(OrganizationId orgId, ADObjectId policyId)
        {
            SharingPolicyCache sharingPolicyCache;

            lock (SharingPolicyCache.cacheSyncLock)
            {
                if (policyId == SharingPolicyCache.DynamicDefaultPolicy)
                {
                    if (SharingPolicyCache.hydratedDefaultCache.TryGetValue(orgId, out sharingPolicyCache))
                    {
                        SharingPolicyCache.Tracer.TraceDebug <ADObjectId, OrganizationId>(0L, "Found Default Sharing Policy {0} in hydratedDefaultCache for Org {1}.", policyId, orgId);
                        return(sharingPolicyCache);
                    }
                }
                else if (SharingPolicyCache.hydratedCache.TryGetValue(policyId.ObjectGuid, out sharingPolicyCache))
                {
                    SharingPolicyCache.Tracer.TraceDebug <ADObjectId, OrganizationId>(0L, "Found Sharing Policy {0} in hydratedCache for Org {1}.", policyId, orgId);
                    return(sharingPolicyCache);
                }
            }
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(orgId), 211, "GetHydratedPolicyFromCacheOrAD", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\SharingPolicy\\SharingPolicyCache.cs");

            tenantOrTopologyConfigurationSession.SessionSettings.IsSharedConfigChecked = true;
            bool flag2 = policyId == SharingPolicyCache.DynamicDefaultPolicy;

            if (flag2)
            {
                policyId = SharingPolicyCache.GetDefaultSharingPolicyId(tenantOrTopologyConfigurationSession);
                if (policyId == null)
                {
                    return(null);
                }
            }
            SharingPolicy sharingPolicy = tenantOrTopologyConfigurationSession.Read <SharingPolicy>(policyId);

            if (sharingPolicy == null)
            {
                SharingPolicyCache.Tracer.TraceWarning <ADObjectId, bool>(0L, "Unable to find SharingPolicy {0} in the AD. PolicyId is default:{1}", policyId, flag2);
                sharingPolicyCache = null;
            }
            else
            {
                sharingPolicyCache = new SharingPolicyCache(sharingPolicy, false);
            }
            lock (SharingPolicyCache.cacheSyncLock)
            {
                SharingPolicyCache.Tracer.TraceDebug <ADObjectId>(0L, "Add the Sharing Policy {0} to cache.", policyId);
                SharingPolicyCache.hydratedCache[policyId.ObjectGuid] = sharingPolicyCache;
                if (sharingPolicyCache != null && flag2)
                {
                    SharingPolicyCache.Tracer.TraceDebug <ADObjectId, OrganizationId>(0L, "Add Default Sharing Policy {0} of Org {1} to hydrated cache ", policyId, orgId);
                    SharingPolicyCache.hydratedDefaultCache[orgId] = sharingPolicyCache;
                }
            }
            return(sharingPolicyCache);
        }
Esempio n. 9
0
        /// <summary>
        ///     Factory for <see cref="EvaluationContext" />
        /// </summary>
        /// <param name="policy"> The <see cref="SharingPolicy"/> to use.</param>
        /// <param name="fileSystem">The <see cref="IFileSystem"/> to use.
        ///     This parameter is compatible only with <see cref="SharingPolicy.Shared"/>.
        ///     The method throws if a file system is used with <see cref="SharingPolicy.Isolated"/>.
        ///     The reasoning is that <see cref="SharingPolicy.Isolated"/> means not reusing any caches between evaluations,
        ///     and the passed in <paramref name="fileSystem"/> might cache state.
        /// </param>
        public static EvaluationContext Create(SharingPolicy policy, MSBuildFileSystemBase fileSystem)
        {
            var context = new EvaluationContext(
                policy,
                fileSystem);

            TestOnlyHookOnCreate?.Invoke(context);

            return(context);
        }
Esempio n. 10
0
        private EvaluationContext(SharingPolicy policy, IFileSystem fileSystem, ISdkResolverService sdkResolverService = null,
                                  ConcurrentDictionary <string, IReadOnlyList <string> > fileEntryExpansionCache       = null)
        {
            Policy = policy;

            SdkResolverService      = sdkResolverService ?? new CachingSdkResolverService();
            FileEntryExpansionCache = fileEntryExpansionCache ?? new ConcurrentDictionary <string, IReadOnlyList <string> >();
            FileSystem  = fileSystem ?? new CachingFileSystemWrapper(FileSystems.Default);
            FileMatcher = new FileMatcher(FileSystem, FileEntryExpansionCache);
        }
        // Token: 0x06000E4F RID: 3663 RVA: 0x00056108 File Offset: 0x00054308
        private void ApplyPolicyToFolder(SharingPolicy policy, FolderData folderData)
        {
            StoreObjectType objectType = ObjectClass.GetObjectType(folderData.Folder.ClassName);
            List <PermissionSecurityPrincipal> list = new List <PermissionSecurityPrincipal>();
            PermissionSet permissionSet             = folderData.Folder.GetPermissionSet();

            foreach (Permission permission in permissionSet)
            {
                if (permission.Principal.Type == PermissionSecurityPrincipal.SecurityPrincipalType.ExternalUserPrincipal)
                {
                    SharingPolicyAction sharingPolicyAction = (SharingPolicyAction)0;
                    if (policy != null)
                    {
                        sharingPolicyAction = (permission.Principal.ExternalUser.IsReachUser ? policy.GetAllowedForAnonymousCalendarSharing() : policy.GetAllowed(permission.Principal.ExternalUser.SmtpAddress.Domain));
                    }
                    MemberRights memberRights = MemberRights.None;
                    if (sharingPolicyAction != (SharingPolicyAction)0)
                    {
                        memberRights = PolicyAllowedMemberRights.GetAllowed(sharingPolicyAction, objectType);
                    }
                    if (memberRights == MemberRights.None)
                    {
                        list.Add(permission.Principal);
                    }
                    else
                    {
                        MemberRights memberRights2 = ~memberRights & permission.MemberRights;
                        if (memberRights2 != MemberRights.None)
                        {
                            if (objectType == StoreObjectType.CalendarFolder)
                            {
                                if ((permission.MemberRights & MemberRights.ReadAny) != MemberRights.None)
                                {
                                    permission.MemberRights |= MemberRights.FreeBusyDetailed;
                                }
                                if ((permission.MemberRights & MemberRights.FreeBusyDetailed) != MemberRights.None)
                                {
                                    permission.MemberRights |= MemberRights.FreeBusySimple;
                                }
                            }
                            permission.MemberRights = (memberRights & permission.MemberRights);
                            folderData.IsChanged    = true;
                        }
                    }
                }
            }
            if (list.Count > 0)
            {
                foreach (PermissionSecurityPrincipal securityPrincipal in list)
                {
                    permissionSet.RemoveEntry(securityPrincipal);
                }
                folderData.IsChanged = true;
            }
        }
Esempio n. 12
0
 public virtual void TearDown()
 {
     resCalc       = null;
     minAlloc      = null;
     maxAlloc      = null;
     totalCapacity = null;
     clock         = null;
     queueMetrics  = null;
     policy        = null;
     replanner     = null;
 }
        protected override void InternalSave(ConfigurableObject instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            MailboxCalendarFolder mailboxCalendarFolder = instance as MailboxCalendarFolder;

            if (mailboxCalendarFolder == null)
            {
                throw new NotSupportedException("Save: " + instance.GetType().FullName);
            }
            if (mailboxCalendarFolder.PublishEnabled)
            {
                SharingPolicy sharingPolicy = DirectoryHelper.ReadSharingPolicy(base.MailboxSession.MailboxOwner.MailboxInfo.MailboxGuid, base.MailboxSession.MailboxOwner.MailboxInfo.IsArchive, base.MailboxSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid));
                if (sharingPolicy == null || !sharingPolicy.Enabled || !sharingPolicy.IsAllowedForAnonymousCalendarSharing())
                {
                    throw new NotAllowedPublishingByPolicyException();
                }
                SharingPolicyAction allowedForAnonymousCalendarSharing = sharingPolicy.GetAllowedForAnonymousCalendarSharing();
                int maxAllowed = PolicyAllowedDetailLevel.GetMaxAllowed(allowedForAnonymousCalendarSharing);
                if (mailboxCalendarFolder.DetailLevel > (DetailLevelEnumType)maxAllowed)
                {
                    throw new NotAllowedPublishingByPolicyException(mailboxCalendarFolder.DetailLevel, (DetailLevelEnumType)maxAllowed);
                }
            }
            MailboxFolderId mailboxFolderId = mailboxCalendarFolder.MailboxFolderId;
            StoreObjectId   folderId        = mailboxFolderId.StoreObjectIdValue ?? base.ResolveStoreObjectIdFromFolderPath(mailboxFolderId.MailboxFolderPath);

            if (folderId == null || folderId.ObjectType != StoreObjectType.CalendarFolder)
            {
                throw new CantFindCalendarFolderException(mailboxFolderId);
            }
            using (CalendarFolder calendarFolder = CalendarFolder.Bind(base.MailboxSession, folderId))
            {
                ExtendedFolderFlags?valueAsNullable = calendarFolder.GetValueAsNullable <ExtendedFolderFlags>(FolderSchema.ExtendedFolderFlags);
                if (valueAsNullable != null && (valueAsNullable.Value & ExtendedFolderFlags.PersonalShare) != (ExtendedFolderFlags)0)
                {
                    throw new CannotShareFolderException(ServerStrings.CannotShareOtherPersonalFolder);
                }
                this.SaveSharingAnonymous(mailboxCalendarFolder, folderId);
                if (!mailboxCalendarFolder.PublishEnabled)
                {
                    mailboxCalendarFolder.PublishedCalendarUrl = null;
                    mailboxCalendarFolder.PublishedICalUrl     = null;
                }
                UserConfigurationDictionaryHelper.Save(mailboxCalendarFolder, MailboxCalendarFolder.CalendarFolderConfigurationProperties, (bool createIfNonexisting) => UserConfigurationHelper.GetPublishingConfiguration(this.MailboxSession, folderId, createIfNonexisting));
                if (MailboxCalendarFolderDataProvider.UpdateExtendedFolderFlags(mailboxCalendarFolder, calendarFolder))
                {
                    calendarFolder.Save();
                }
            }
        }
        private void EnforceSharingPolicy(MailboxSession mailboxSession, ICollection <MapiAclTableRestriction.ExternalUserPermission> externalUserPermissions)
        {
            Util.ThrowOnNullArgument(mailboxSession, "mailboxSession");
            if (externalUserPermissions == null || externalUserPermissions.Count == 0)
            {
                return;
            }
            List <RightsNotAllowedRecipient> list = new List <RightsNotAllowedRecipient>(externalUserPermissions.Count);
            SharingPolicy sharingPolicy           = null;

            foreach (MapiAclTableRestriction.ExternalUserPermission externalUserPermission in externalUserPermissions)
            {
                if (sharingPolicy == null)
                {
                    IMailboxInfo mailboxInfo = mailboxSession.MailboxOwner.MailboxInfo;
                    sharingPolicy = DirectoryHelper.ReadSharingPolicy(mailboxInfo.MailboxGuid, mailboxInfo.IsArchive, mailboxSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid));
                    if (sharingPolicy == null)
                    {
                        ExTraceGlobals.StorageTracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: No policy assigned means no external sharing is allowed for this user.", mailboxSession.MailboxOwner);
                        throw new NotAllowedExternalSharingByPolicyException();
                    }
                }
                if (!sharingPolicy.Enabled)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: A disabled policy means no external sharing is allowed for this user.", mailboxSession.MailboxOwner);
                    throw new NotAllowedExternalSharingByPolicyException();
                }
                SharingPolicyAction sharingPolicyAction = externalUserPermission.Principal.ExternalUser.IsReachUser ? sharingPolicy.GetAllowedForAnonymousCalendarSharing() : sharingPolicy.GetAllowed(externalUserPermission.Principal.ExternalUser.SmtpAddress.Domain);
                if (sharingPolicyAction == (SharingPolicyAction)0)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug <IExchangePrincipal, PermissionSecurityPrincipal>((long)this.GetHashCode(), "{0}: Policy does not allow granting permissions to {1}.", mailboxSession.MailboxOwner, externalUserPermission.Principal);
                    throw new PrincipalNotAllowedByPolicyException(externalUserPermission.Principal);
                }
                MemberRights allowed      = PolicyAllowedMemberRights.GetAllowed(sharingPolicyAction, this.FolderInfo.StoreObjectType);
                MemberRights memberRights = ~allowed & externalUserPermission.MemberRights;
                if (memberRights != MemberRights.None)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug((long)this.GetHashCode(), "{0}: Policy does not allow granting permission {1} to {2} on {3} folder '{4}'.", new object[]
                    {
                        mailboxSession.MailboxOwner,
                        memberRights,
                        externalUserPermission.Principal,
                        this.FolderInfo.StoreObjectType,
                        this.FolderInfo.DisplayName
                    });
                    list.Add(new RightsNotAllowedRecipient(externalUserPermission.Principal, memberRights));
                }
            }
            if (list.Count > 0)
            {
                throw new RightsNotAllowedByPolicyException(list.ToArray(), this.FolderInfo.StoreObjectType, this.FolderInfo.DisplayName);
            }
        }
        // Token: 0x06000E61 RID: 3681 RVA: 0x000568D8 File Offset: 0x00054AD8
        private static SharingPolicyCache GetDehydratedPolicyFromCacheOrAD(OrganizationId orgId, ADObjectId policyId)
        {
            SharingPolicyCache sharingPolicyCache;

            if (policyId != SharingPolicyCache.DynamicDefaultPolicy)
            {
                lock (SharingPolicyCache.cacheSyncLock)
                {
                    if (SharingPolicyCache.dehydratedDefaultCache.TryGetValue(policyId.ObjectGuid, out sharingPolicyCache))
                    {
                        SharingPolicyCache.Tracer.TraceDebug <ADObjectId>(0L, "Found Sharing Policy {0} in dehydrated cache.", policyId);
                        return(sharingPolicyCache);
                    }
                }
            }
            SharedConfiguration   sharedConfiguration = SharedConfiguration.GetSharedConfiguration(orgId);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, sharedConfiguration.GetSharedConfigurationSessionSettings(), 282, "GetDehydratedPolicyFromCacheOrAD", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\SharingPolicy\\SharingPolicyCache.cs");

            tenantOrTopologyConfigurationSession.SessionSettings.IsSharedConfigChecked = true;
            bool flag2 = policyId == SharingPolicyCache.DynamicDefaultPolicy;

            if (flag2)
            {
                SharingPolicyCache.Tracer.TraceDebug <OrganizationId>(0L, "Find Default Policy Id for Org {0} ", orgId);
                policyId = SharingPolicyCache.GetDefaultSharingPolicyId(tenantOrTopologyConfigurationSession);
                if (policyId == null)
                {
                    return(null);
                }
                lock (SharingPolicyCache.cacheSyncLock)
                {
                    if (SharingPolicyCache.dehydratedDefaultCache.TryGetValue(policyId.ObjectGuid, out sharingPolicyCache))
                    {
                        SharingPolicyCache.Tracer.TraceDebug <ADObjectId>(0L, "Found Sharing Policy {0} in dehydrated cache.", policyId);
                        return(sharingPolicyCache);
                    }
                }
            }
            SharingPolicy sharingPolicy = tenantOrTopologyConfigurationSession.Read <SharingPolicy>(policyId);

            if (sharingPolicy == null)
            {
                SharingPolicyCache.Tracer.TraceError <ADObjectId, bool>(0L, "Unable to find SharingPolicy {0} in the AD. PolicyId is default:{1}", policyId, flag2);
                return(null);
            }
            sharingPolicyCache = new SharingPolicyCache(sharingPolicy, true);
            lock (SharingPolicyCache.cacheSyncLock)
            {
                SharingPolicyCache.dehydratedDefaultCache[policyId.ObjectGuid] = sharingPolicyCache;
            }
            return(sharingPolicyCache);
        }
Esempio n. 16
0
 public virtual void SetUp()
 {
     resCalc       = new DefaultResourceCalculator();
     minAlloc      = Org.Apache.Hadoop.Yarn.Api.Records.Resource.NewInstance(1024, 1);
     maxAlloc      = Org.Apache.Hadoop.Yarn.Api.Records.Resource.NewInstance(64 * 1024, 20);
     totalCapacity = Org.Apache.Hadoop.Yarn.Api.Records.Resource.NewInstance(100 * 1024
                                                                             , 100);
     clock        = Org.Mockito.Mockito.Mock <Clock>();
     queueMetrics = Org.Mockito.Mockito.Mock <QueueMetrics>();
     policy       = Org.Mockito.Mockito.Mock <SharingPolicy>();
     replanner    = Org.Mockito.Mockito.Mock <Planner>();
     Org.Mockito.Mockito.When(clock.GetTime()).ThenReturn(1L);
 }
Esempio n. 17
0
        public static SharingPolicy ReadSharingPolicy(Guid mailboxGuid, bool isArchive, IRecipientSession recipientSession)
        {
            ADRecipient adrecipient = DirectoryHelper.ReadADRecipient(mailboxGuid, isArchive, recipientSession);

            if (adrecipient == null)
            {
                throw new ObjectNotFoundException(ServerStrings.ADUserNotFound);
            }
            ADUser aduser = adrecipient as ADUser;

            if (aduser == null)
            {
                ExTraceGlobals.StorageTracer.TraceError <ADRecipient>((long)mailboxGuid.GetHashCode(), "ExchangePrincipal::ReadSharingPolicy. This is not an ADUser so policy doesn't apply. Recipient = {0}.", adrecipient);
                return(null);
            }
            ADObjectId        adobjectId = aduser.SharingPolicy;
            ADSessionSettings adsessionSettings;

            if (SharedConfiguration.IsDehydratedConfiguration(aduser.OrganizationId))
            {
                SharedConfiguration sharedConfiguration = SharedConfiguration.GetSharedConfiguration(aduser.OrganizationId);
                adsessionSettings = sharedConfiguration.GetSharedConfigurationSessionSettings();
            }
            else
            {
                adsessionSettings = aduser.OrganizationId.ToADSessionSettings();
                adsessionSettings.IsSharedConfigChecked = true;
            }
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, adsessionSettings, 248, "ReadSharingPolicy", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\DirectoryHelper.cs");

            if (adobjectId == null)
            {
                FederatedOrganizationId federatedOrganizationId = tenantOrTopologyConfigurationSession.GetFederatedOrganizationId(tenantOrTopologyConfigurationSession.SessionSettings.CurrentOrganizationId);
                if (federatedOrganizationId != null)
                {
                    adobjectId = federatedOrganizationId.DefaultSharingPolicyLink;
                }
            }
            SharingPolicy sharingPolicy = null;

            if (adobjectId != null)
            {
                sharingPolicy = tenantOrTopologyConfigurationSession.Read <SharingPolicy>(adobjectId);
                if (sharingPolicy == null)
                {
                    throw new ObjectNotFoundException(ServerStrings.SharingPolicyNotFound(adobjectId.Name));
                }
            }
            return(sharingPolicy);
        }
Esempio n. 18
0
        private EvaluationContext(SharingPolicy policy, IFileSystem fileSystem)
        {
            // Unsupported case: isolated context with non null file system.
            // Isolated means caches aren't reused, but the given file system might cache.
            ErrorUtilities.VerifyThrowArgument(
                policy == SharingPolicy.Shared || fileSystem == null,
                "IsolatedContextDoesNotSupportFileSystem");

            Policy = policy;

            SdkResolverService      = new CachingSdkResolverService();
            FileEntryExpansionCache = new ConcurrentDictionary <string, IReadOnlyList <string> >();
            FileSystem          = fileSystem ?? new CachingFileSystemWrapper(FileSystems.Default);
            EngineFileUtilities = new EngineFileUtilities(new FileMatcher(FileSystem, FileEntryExpansionCache));
        }
Esempio n. 19
0
        /// <summary>
        ///     Factory for <see cref="EvaluationContext" />
        /// </summary>
        /// <param name="policy"> The <see cref="SharingPolicy"/> to use.</param>
        /// <param name="fileSystem">The <see cref="IFileSystem"/> to use.
        ///     This parameter is compatible only with <see cref="SharingPolicy.Shared"/>.
        ///     The method throws if a file system is used with <see cref="SharingPolicy.Isolated"/>.
        ///     The reasoning is that <see cref="SharingPolicy.Isolated"/> means not reusing any caches between evaluations,
        ///     and the passed in <paramref name="fileSystem"/> might cache state.
        /// </param>
        public static EvaluationContext Create(SharingPolicy policy, MSBuildFileSystemBase fileSystem)
        {
            // Unsupported case: isolated context with non null file system.
            // Isolated means caches aren't reused, but the given file system might cache.
            ErrorUtilities.VerifyThrowArgument(
                policy == SharingPolicy.Shared || fileSystem == null,
                "IsolatedContextDoesNotSupportFileSystem");

            var context = new EvaluationContext(
                policy,
                fileSystem);

            TestOnlyHookOnCreate?.Invoke(context);

            return(context);
        }
Esempio n. 20
0
 internal InMemoryPlan(QueueMetrics queueMetrics, SharingPolicy policy, ReservationAgent
                       agent, Org.Apache.Hadoop.Yarn.Api.Records.Resource totalCapacity, long step, ResourceCalculator
                       resCalc, Org.Apache.Hadoop.Yarn.Api.Records.Resource minAlloc, Org.Apache.Hadoop.Yarn.Api.Records.Resource
                       maxAlloc, string queueName, Planner replanner, bool getMoveOnExpiry, Clock clock
                       )
 {
     this.queueMetrics    = queueMetrics;
     this.policy          = policy;
     this.agent           = agent;
     this.step            = step;
     this.totalCapacity   = totalCapacity;
     this.resCalc         = resCalc;
     this.minAlloc        = minAlloc;
     this.maxAlloc        = maxAlloc;
     this.rleSparseVector = new RLESparseResourceAllocation(resCalc, minAlloc);
     this.queueName       = queueName;
     this.replanner       = replanner;
     this.getMoveOnExpiry = getMoveOnExpiry;
     this.clock           = clock;
 }
Esempio n. 21
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        protected internal virtual Plan InitializePlan(string planQueueName)
        {
            string        planQueuePath = GetPlanQueuePath(planQueueName);
            SharingPolicy adPolicy      = GetAdmissionPolicy(planQueuePath);

            adPolicy.Init(planQueuePath, GetReservationSchedulerConfiguration());
            // Calculate the max plan capacity
            Resource           minAllocation = GetMinAllocation();
            Resource           maxAllocation = GetMaxAllocation();
            ResourceCalculator rescCalc      = GetResourceCalculator();

            Org.Apache.Hadoop.Yarn.Api.Records.Resource totCap = GetPlanQueueCapacity(planQueueName
                                                                                      );
            Plan plan = new InMemoryPlan(GetRootQueueMetrics(), adPolicy, GetAgent(planQueuePath
                                                                                   ), totCap, planStepSize, rescCalc, minAllocation, maxAllocation, planQueueName,
                                         GetReplanner(planQueuePath), GetReservationSchedulerConfiguration().GetMoveOnExpiry
                                             (planQueuePath));

            Log.Info("Intialized plan {0} based on reservable queue {1}", plan.ToString(), planQueueName
                     );
            return(plan);
        }
Esempio n. 22
0
        public EncryptionResults Encrypt(IExchangePrincipal mailboxOwner, IRecipientSession recipientSession, ExternalUserCollection externalUserCollection, ValidRecipient[] recipients, string sender, string containerClass, string folderId, IFrontEndLocator frontEndLocator)
        {
            SharingDataType sharingDataType = SharingDataType.FromContainerClass(containerClass);

            if (sharingDataType == null || !sharingDataType.IsExternallySharable)
            {
                throw new ArgumentOutOfRangeException("containerClass");
            }
            ADUser aduser = DirectoryHelper.ReadADRecipient(mailboxOwner.MailboxInfo.MailboxGuid, mailboxOwner.MailboxInfo.IsArchive, recipientSession) as ADUser;

            if (aduser == null)
            {
                SharedFolderDataEncryption.Tracer.TraceError <SharedFolderDataEncryption, string>((long)this.GetHashCode(), "{0}: The Active Directory user was not found. Sender={1}.", this, sender);
                throw new ObjectNotFoundException(ServerStrings.ADUserNotFound);
            }
            ProxyAddress item = new SmtpProxyAddress(sender, false);

            if (!aduser.EmailAddresses.Contains(item))
            {
                SharedFolderDataEncryption.Tracer.TraceError <SharedFolderDataEncryption, string>((long)this.GetHashCode(), "{0}: The SMTP address was not found in the user AD object for this mailbox. Sender={1}.", this, sender);
                throw new ObjectNotFoundException(ServerStrings.ADUserNotFound);
            }
            SharingPolicy sharingPolicy = DirectoryHelper.ReadSharingPolicy(mailboxOwner.MailboxInfo.MailboxGuid, mailboxOwner.MailboxInfo.IsArchive, recipientSession);

            SharedFolderDataEncryption.Tracer.TraceDebug <SharedFolderDataEncryption, object>((long)this.GetHashCode(), "{0}: Sharing policy to be applied to this user: {1}", this, (sharingPolicy == null) ? "<null>" : sharingPolicy.Id);
            SharingPolicyAction sharingPolicyActions = SharedFolderDataEncryption.GetSharingPolicyActions(sharingDataType.StoreObjectType);

            SharedFolderDataRecipient[] externalIdentities = SharedFolderDataEncryption.GetExternalIdentities(externalUserCollection, recipients);
            List <InvalidRecipient>     list = new List <InvalidRecipient>();
            Dictionary <TokenTarget, List <SharedFolderDataRecipient> > dictionary = new Dictionary <TokenTarget, List <SharedFolderDataRecipient> >(externalIdentities.Length, SharedFolderDataEncryption.TokenTargetComparer);

            for (int i = 0; i < recipients.Length; i++)
            {
                SharedFolderDataRecipient item2          = externalIdentities[i];
                ValidRecipient            validRecipient = recipients[i];
                SmtpAddress smtpAddress = new SmtpAddress(validRecipient.SmtpAddress);
                string      domain      = smtpAddress.Domain;
                if (sharingPolicy == null || !sharingPolicy.IsAllowedForAnySharing(domain, sharingPolicyActions))
                {
                    SharedFolderDataEncryption.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Sharing policy does not allow user to share with domain {0}", domain);
                    list.Add(new InvalidRecipient(validRecipient.SmtpAddress, InvalidRecipientResponseCodeType.SystemPolicyBlocksSharingWithThisRecipient));
                }
                else
                {
                    SmtpAddress smtpAddress2 = new SmtpAddress(validRecipient.SmtpAddressForEncryption);
                    TokenTarget tokenTarget  = TargetUriResolver.Resolve(smtpAddress2.Domain, aduser.OrganizationId);
                    if (tokenTarget == null)
                    {
                        list.Add(new InvalidRecipient(validRecipient.SmtpAddress, InvalidRecipientResponseCodeType.RecipientOrganizationNotFederated));
                    }
                    else
                    {
                        List <SharedFolderDataRecipient> list2;
                        if (!dictionary.TryGetValue(tokenTarget, out list2))
                        {
                            list2 = new List <SharedFolderDataRecipient>(1);
                            dictionary.Add(tokenTarget, list2);
                        }
                        list2.Add(item2);
                    }
                }
            }
            List <EncryptedSharedFolderData> list3 = new List <EncryptedSharedFolderData>(dictionary.Count);
            SharedFolderData sharedFolderData      = new SharedFolderData();

            sharedFolderData.DataType          = sharingDataType.ExternalName;
            sharedFolderData.FolderId          = folderId;
            sharedFolderData.SharingUrl        = this.GetSharingUrl(aduser, frontEndLocator);
            sharedFolderData.FederationUri     = this.externalAuthentication.TokenValidator.TargetUri.ToString();
            sharedFolderData.SenderSmtpAddress = sender;
            DelegationTokenRequest delegationTokenRequest = new DelegationTokenRequest
            {
                FederatedIdentity = aduser.GetFederatedIdentity(),
                EmailAddress      = aduser.GetFederatedSmtpAddress(new SmtpAddress(sender)).ToString(),
                Offer             = Offer.SharingInviteMessage
            };
            SecurityTokenService securityTokenService = this.externalAuthentication.GetSecurityTokenService(aduser.OrganizationId);

            foreach (KeyValuePair <TokenTarget, List <SharedFolderDataRecipient> > keyValuePair in dictionary)
            {
                delegationTokenRequest.Target = keyValuePair.Key;
                sharedFolderData.Recipients   = keyValuePair.Value.ToArray();
                try
                {
                    RequestedToken requestedToken = securityTokenService.IssueToken(delegationTokenRequest);
                    list3.Add(this.Encrypt(requestedToken, sharedFolderData));
                }
                catch (WSTrustException ex)
                {
                    foreach (SharedFolderDataRecipient sharedFolderDataRecipient in sharedFolderData.Recipients)
                    {
                        list.Add(new InvalidRecipient(sharedFolderDataRecipient.SmtpAddress, SharedFolderDataEncryption.GetResponseCodeFromException(ex), ex.ToString()));
                    }
                }
            }
            return(new EncryptionResults(list3.ToArray(), list.ToArray()));
        }
Esempio n. 23
0
		protected override void ResolveLocalSecondaryIdentities()
		{
			base.ResolveLocalSecondaryIdentities();
			Mailbox mailbox = (Mailbox)this.GetDynamicParameters();
			if (this.RemoveManagedFolderAndPolicy)
			{
				mailbox.ManagedFolderMailboxPolicy = null;
			}
			if (base.Fields.IsModified(MailboxSchema.RetentionPolicy))
			{
				if (this.RetentionPolicy != null)
				{
					RetentionPolicy retentionPolicy = (RetentionPolicy)base.GetDataObject<RetentionPolicy>(this.RetentionPolicy, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorRetentionPolicyNotFound(this.RetentionPolicy.ToString())), new LocalizedString?(Strings.ErrorRetentionPolicyNotUnique(this.RetentionPolicy.ToString())), ExchangeErrorCategory.Client);
					mailbox.RetentionPolicy = (ADObjectId)retentionPolicy.Identity;
					mailbox.ManagedFolderMailboxPolicy = null;
				}
				else
				{
					mailbox.RetentionPolicy = null;
				}
			}
			base.SetReferenceParameter<RecipientIdParameter>(MailboxSchema.ForwardingAddress, this.ForwardingAddress, mailbox, new GetRecipientDelegate<RecipientIdParameter>(this.GetRecipient));
			if (base.Fields.IsModified(MailboxSchema.OfflineAddressBook))
			{
				if (this.OfflineAddressBook != null)
				{
					OfflineAddressBook offlineAddressBook = (OfflineAddressBook)base.GetDataObject<OfflineAddressBook>(this.OfflineAddressBook, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorOfflineAddressBookNotFound(this.OfflineAddressBook.ToString())), new LocalizedString?(Strings.ErrorOfflineAddressBookNotUnique(this.OfflineAddressBook.ToString())), ExchangeErrorCategory.Client);
					mailbox.OfflineAddressBook = (ADObjectId)offlineAddressBook.Identity;
				}
				else
				{
					mailbox.OfflineAddressBook = null;
				}
			}
			if (base.Fields.IsModified(ADRecipientSchema.AddressBookPolicy))
			{
				AddressBookMailboxPolicyIdParameter addressBookMailboxPolicyIdParameter = (AddressBookMailboxPolicyIdParameter)base.Fields[ADRecipientSchema.AddressBookPolicy];
				if (addressBookMailboxPolicyIdParameter != null)
				{
					AddressBookMailboxPolicy addressBookMailboxPolicy = (AddressBookMailboxPolicy)base.GetDataObject<AddressBookMailboxPolicy>(addressBookMailboxPolicyIdParameter, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorAddressBookMailboxPolicyNotFound(addressBookMailboxPolicyIdParameter.ToString())), new LocalizedString?(Strings.ErrorAddressBookMailboxPolicyNotUnique(addressBookMailboxPolicyIdParameter.ToString())), ExchangeErrorCategory.Client);
					mailbox[ADRecipientSchema.AddressBookPolicy] = (ADObjectId)addressBookMailboxPolicy.Identity;
				}
				else
				{
					mailbox[ADRecipientSchema.AddressBookPolicy] = null;
				}
			}
			if (base.Fields.IsModified(ADRecipientSchema.ThrottlingPolicy))
			{
				if (SharedConfiguration.IsDehydratedConfiguration(base.CurrentOrganizationId))
				{
					base.WriteError(new TaskInvalidOperationException(Strings.ErrorLinkOpOnDehydratedTenant("ThrottlingPolicy")), ExchangeErrorCategory.Context, this.DataObject.Identity);
				}
				ThrottlingPolicyIdParameter throttlingPolicyIdParameter = (ThrottlingPolicyIdParameter)base.Fields[ADRecipientSchema.ThrottlingPolicy];
				if (throttlingPolicyIdParameter != null)
				{
					ThrottlingPolicy throttlingPolicy = (ThrottlingPolicy)base.GetDataObject<ThrottlingPolicy>(throttlingPolicyIdParameter, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorThrottlingPolicyNotFound(throttlingPolicyIdParameter.ToString())), new LocalizedString?(Strings.ErrorThrottlingPolicyNotUnique(throttlingPolicyIdParameter.ToString())), ExchangeErrorCategory.Client);
					mailbox[ADRecipientSchema.ThrottlingPolicy] = (ADObjectId)throttlingPolicy.Identity;
				}
				else
				{
					mailbox[ADRecipientSchema.ThrottlingPolicy] = null;
				}
			}
			if (base.Fields.IsModified(ADUserSchema.SharingPolicy))
			{
				if (SharedConfiguration.IsDehydratedConfiguration(base.CurrentOrganizationId))
				{
					base.WriteError(new LocalizedException(Strings.ErrorLinkOpOnDehydratedTenant("SharingPolicy")), ExchangeErrorCategory.Client, this.DataObject);
				}
				SharingPolicyIdParameter sharingPolicyIdParameter = (SharingPolicyIdParameter)base.Fields[ADUserSchema.SharingPolicy];
				if (sharingPolicyIdParameter != null)
				{
					SharingPolicy sharingPolicy = (SharingPolicy)base.GetDataObject<SharingPolicy>(sharingPolicyIdParameter, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorSharingPolicyNotFound(sharingPolicyIdParameter.ToString())), new LocalizedString?(Strings.ErrorSharingPolicyNotUnique(sharingPolicyIdParameter.ToString())), ExchangeErrorCategory.Client);
					mailbox[ADUserSchema.SharingPolicy] = (ADObjectId)sharingPolicy.Identity;
				}
				else
				{
					mailbox[ADUserSchema.SharingPolicy] = null;
				}
			}
			if (base.Fields.IsModified(ADUserSchema.RemoteAccountPolicy))
			{
				RemoteAccountPolicyIdParameter remoteAccountPolicyIdParameter = (RemoteAccountPolicyIdParameter)base.Fields[ADUserSchema.RemoteAccountPolicy];
				if (remoteAccountPolicyIdParameter != null)
				{
					RemoteAccountPolicy remoteAccountPolicy = (RemoteAccountPolicy)base.GetDataObject<RemoteAccountPolicy>(remoteAccountPolicyIdParameter, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorRemoteAccountPolicyNotFound(remoteAccountPolicyIdParameter.ToString())), new LocalizedString?(Strings.ErrorRemoteAccountPolicyNotUnique(remoteAccountPolicyIdParameter.ToString())), ExchangeErrorCategory.Client);
					mailbox[ADUserSchema.RemoteAccountPolicy] = (ADObjectId)remoteAccountPolicy.Identity;
				}
				else
				{
					mailbox[ADUserSchema.RemoteAccountPolicy] = null;
				}
			}
			if (base.Fields.IsModified(ADRecipientSchema.RoleAssignmentPolicy))
			{
				MailboxPolicyIdParameter mailboxPolicyIdParameter = (MailboxPolicyIdParameter)base.Fields[ADRecipientSchema.RoleAssignmentPolicy];
				if (mailboxPolicyIdParameter != null)
				{
					IConfigurationSession tenantLocalConfigSession = RecipientTaskHelper.GetTenantLocalConfigSession(base.CurrentOrganizationId, base.ExecutingUserOrganizationId, base.RootOrgContainerId);
					RoleAssignmentPolicy roleAssignmentPolicy = (RoleAssignmentPolicy)base.GetDataObject<RoleAssignmentPolicy>(mailboxPolicyIdParameter, tenantLocalConfigSession, null, new LocalizedString?(Strings.ErrorRoleAssignmentPolicyNotFound(mailboxPolicyIdParameter.ToString())), new LocalizedString?(Strings.ErrorRoleAssignmentPolicyNotUnique(mailboxPolicyIdParameter.ToString())), ExchangeErrorCategory.Client);
					mailbox[ADRecipientSchema.RoleAssignmentPolicy] = (ADObjectId)roleAssignmentPolicy.Identity;
				}
				else
				{
					mailbox[ADRecipientSchema.RoleAssignmentPolicy] = null;
				}
			}
			if (base.Fields.IsModified(ADRecipientSchema.MailboxPlan))
			{
				if (this.MailboxPlan != null)
				{
					ADUser aduser = base.ProvisioningCache.TryAddAndGetOrganizationDictionaryValue<ADUser, string>(CannedProvisioningCacheKeys.CacheKeyMailboxPlanIdParameterId, base.CurrentOrganizationId, this.MailboxPlan.RawIdentity, () => (ADUser)base.GetDataObject<ADUser>(this.MailboxPlan, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxPlanNotFound(this.MailboxPlan.ToString())), new LocalizedString?(Strings.ErrorMailboxPlanNotUnique(this.MailboxPlan.ToString())), ExchangeErrorCategory.Client));
					MailboxTaskHelper.ValidateMailboxPlanRelease(aduser, new Task.ErrorLoggerDelegate(base.WriteError));
					mailbox[ADRecipientSchema.MailboxPlan] = (ADObjectId)aduser.Identity;
					return;
				}
				mailbox[ADRecipientSchema.MailboxPlan] = null;
			}
		}
Esempio n. 24
0
        private void ProcessMessageRequest(MessageAction action)
        {
            SharingMessageItem sharingMessageItem = null;
            bool flag = false;

            RecipientInfoAC[] array = (RecipientInfoAC[])base.GetParameter("Recips");
            if (array != null && array.Length != 0)
            {
                AutoCompleteCache.UpdateAutoCompleteCacheFromRecipientInfoList(array, base.OwaContext.UserContext);
            }
            SharingMessageItem requestItem;

            sharingMessageItem = (requestItem = base.GetRequestItem <SharingMessageItem>(new PropertyDefinition[0]));
            try
            {
                if (!sharingMessageItem.IsPublishing && (sharingMessageItem.SharingMessageType.IsInvitationOrAcceptOfRequest || sharingMessageItem.SharingMessageType.IsRequest))
                {
                    SharingLevel level = this.UpdateInviteOrRequestProperties(sharingMessageItem);
                    this.SetSharingLevel(sharingMessageItem, level);
                }
                bool flag2 = base.UpdateMessage(sharingMessageItem, StoreObjectType.Message);
                if (action == MessageAction.Save)
                {
                    ExTraceGlobals.MailTracer.TraceDebug((long)this.GetHashCode(), "Saving Sharing message");
                    Utilities.SaveItem(sharingMessageItem, true);
                    this.RenderChangeKey(sharingMessageItem);
                }
                else if (action == MessageAction.Send)
                {
                    if (flag2)
                    {
                        throw new OwaEventHandlerException("Unresolved recipients", LocalizedStrings.GetNonEncoded(2063734279));
                    }
                    if (sharingMessageItem.Recipients.Count == 0 && action == MessageAction.Send)
                    {
                        throw new OwaEventHandlerException("No recipients", LocalizedStrings.GetNonEncoded(1878192149));
                    }
                    if (Utilities.RecipientsOnlyHaveEmptyPDL <Recipient>(base.UserContext, sharingMessageItem.Recipients))
                    {
                        base.RenderPartialFailure(1389137820);
                        return;
                    }
                    ExTraceGlobals.MailTracer.TraceDebug((long)this.GetHashCode(), "Sending sharing message");
                    bool flag3 = false;
                    if (base.IsParameterSet("ForceSend"))
                    {
                        flag3 = (bool)base.GetParameter("ForceSend");
                    }
                    sharingMessageItem.SetSubmitFlags(flag3 ? SharingSubmitFlags.Auto : SharingSubmitFlags.None);
                    try
                    {
                        if (flag)
                        {
                            sharingMessageItem.SendWithoutSavingMessage();
                        }
                        else
                        {
                            sharingMessageItem.Send();
                        }
                    }
                    catch (ObjectNotFoundException e)
                    {
                        this.SendIdAndChangeKeyToClientOnError(sharingMessageItem, e);
                        this.SanitizingWriter.Write("<p id=\"err\" _msg=\"");
                        this.SanitizingWriter.Write(LocalizedStrings.GetNonEncoded(-1608187286), sharingMessageItem.SharedFolderName);
                        this.SanitizingWriter.Write("\"");
                        this.SanitizingWriter.Write(" _shareErr=\"");
                        this.SanitizingWriter.Write(1);
                        this.SanitizingWriter.Write("\"></p>");
                    }
                    catch (InvalidSharingRecipientsException ex)
                    {
                        this.SendIdAndChangeKeyToClientOnError(sharingMessageItem, ex);
                        this.SanitizingWriter.Write("<div id=\"err\" _msg=\"\" _shareErr=\"");
                        SharingPolicy sharingPolicy = DirectoryHelper.ReadSharingPolicy(base.UserContext.MailboxSession.MailboxOwner.MailboxInfo.MailboxGuid, base.UserContext.MailboxSession.MailboxOwner.MailboxInfo.IsArchive, base.UserContext.MailboxSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid));
                        if (sharingPolicy != null && sharingPolicy.IsAllowedForAnonymousCalendarSharing() && ex.InvalidRecipientsResolution != null)
                        {
                            switch (ex.InvalidRecipientsResolution.Resolution)
                            {
                            case InvalidSharingRecipientsResolutionType.PublishAndTryAgain:
                                this.SanitizingWriter.Write(3);
                                this.SanitizingWriter.Write("\" _folderId=\"");
                                this.SanitizingWriter.Write(ex.InvalidRecipientsResolution.FolderId);
                                this.SanitizingWriter.Write("\">");
                                this.RenderPublishAndTryAgainDialog(ex);
                                break;

                            case InvalidSharingRecipientsResolutionType.SendPublishLinks:
                                this.SanitizingWriter.Write(4);
                                this.SanitizingWriter.Write("\">");
                                this.RenderSendPublishLinksDialog(ex);
                                break;

                            default:
                                throw;
                            }
                        }
                        else
                        {
                            this.SanitizingWriter.Write(2);
                            this.SanitizingWriter.Write("\">");
                            this.RenderInvalidRecipientsDialog(ex);
                        }
                        this.SanitizingWriter.Write("</div>");
                    }
                    catch (Exception e2)
                    {
                        this.SendIdAndChangeKeyToClientOnError(sharingMessageItem, e2);
                        throw;
                    }
                    if (Globals.ArePerfCountersEnabled)
                    {
                        OwaSingleCounters.MessagesSent.Increment();
                    }
                }
                RenderingUtilities.RenderNavigationTreeDirtyFlag(this.Writer, base.UserContext, NavigationTreeDirtyFlag.Calendar, new NavigationModule[]
                {
                    NavigationModule.Calendar
                });
            }
            finally
            {
                if (requestItem != null)
                {
                    ((IDisposable)requestItem).Dispose();
                }
            }
        }
Esempio n. 25
0
 /// <summary>
 ///     Factory for <see cref="EvaluationContext" />
 /// </summary>
 public static EvaluationContext Create(SharingPolicy policy)
 {
     // ReSharper disable once IntroduceOptionalParameters.Global
     // do not remove this method to avoid breaking binary compatibility
     return(Create(policy, fileSystem: null));
 }
Esempio n. 26
0
 internal EvaluationContext(SharingPolicy policy)
 {
     Policy = policy;
 }