Exemplo n.º 1
0
        public static PublishedFolder Create(PublishingUrl publishingUrl)
        {
            Util.ThrowOnNullArgument(publishingUrl, "publishingUrl");
            PublishedFolder.SleepIfNecessary();
            SharingAnonymousIdentityCache      instance = SharingAnonymousIdentityCache.Instance;
            SharingAnonymousIdentityCacheKey   key      = publishingUrl.CreateKey();
            SharingAnonymousIdentityCacheValue sharingAnonymousIdentityCacheValue = instance.Get(key);

            if (!sharingAnonymousIdentityCacheValue.IsAccessAllowed)
            {
                ExTraceGlobals.SharingTracer.TraceError <PublishingUrl, Type>(0L, "PublishedFolder.Create(PublishingUrl): Cannot find access allowed folder from the request url: path = {0}, type = {1}.", publishingUrl, publishingUrl.GetType());
                throw new PublishedFolderAccessDeniedException();
            }
            ExTraceGlobals.SharingTracer.TraceDebug <SecurityIdentifier, string, string>(0L, "PublishedFolder.Create(PublishingUrl): User {0} has Sharing Anonymous identity {1}. The corresponding folder identity is {2}.", sharingAnonymousIdentityCacheValue.Sid, publishingUrl.Identity, sharingAnonymousIdentityCacheValue.FolderId);
            StoreObjectId storeObjectId = null;

            try
            {
                storeObjectId = StoreObjectId.Deserialize(sharingAnonymousIdentityCacheValue.FolderId);
            }
            catch (CorruptDataException innerException)
            {
                ExTraceGlobals.SharingTracer.TraceError <string>(0L, "PublishedFolder.Create(PublishingUrl): The folder identity '{0}' is invalid.", sharingAnonymousIdentityCacheValue.FolderId);
                throw new PublishedFolderAccessDeniedException(innerException);
            }
            if (publishingUrl.DataType == SharingDataType.ReachCalendar || publishingUrl.DataType == SharingDataType.Calendar)
            {
                ObscureUrl obscureUrl = publishingUrl as ObscureUrl;
                return(new PublishedCalendar(publishingUrl.Domain, sharingAnonymousIdentityCacheValue.Sid, storeObjectId, (obscureUrl == null) ? null : new ObscureKind?(obscureUrl.ObscureKind), (obscureUrl == null) ? null : obscureUrl.ReachUserSid));
            }
            throw new NotSupportedException();
        }
Exemplo n.º 2
0
        private void AcquireBudgetAndStartTiming()
        {
            ExTraceGlobals.SharingTracer.TraceDebug <SecurityIdentifier>((long)this.GetHashCode(), "Acquiring and check the budget for sid {0}.", this.sid);
            this.budget = StandardBudget.Acquire(this.sid, BudgetType.Anonymous, ADSessionSettings.FromRootOrgScopeSet());
            this.budget.CheckOverBudget();
            ExTraceGlobals.SharingTracer.TraceDebug <SecurityIdentifier>((long)this.GetHashCode(), "Start timing for sid {0}.", this.sid);
            PublishedFolder.SleepIfNecessary();
            string callerInfo = "PublishedFolder.AcquireBudgetAndStartTiming";

            this.budget.StartConnection(callerInfo);
            this.budget.StartLocal(callerInfo, default(TimeSpan));
        }
Exemplo n.º 3
0
 internal void PopulateUrls(Folder folderToShare)
 {
     using (PublishedFolder publishedFolder = PublishedFolder.Create(folderToShare))
     {
         PublishedCalendar publishedCalendar = publishedFolder as PublishedCalendar;
         if (publishedCalendar != null)
         {
             if (this.PrimarySharingProvider == SharingProvider.SharingProviderPublish)
             {
                 publishedCalendar.TrySetObscureKind(ObscureKind.Normal);
             }
             this.ICalUrl = publishedCalendar.ICalUrl;
         }
         this.BrowseUrl = publishedFolder.BrowseUrl;
     }
 }