当前位置: 首页>>代码示例>>C#>>正文


C# IContainerOwner.IsGroupContainer方法代码示例

本文整理汇总了C#中IContainerOwner.IsGroupContainer方法的典型用法代码示例。如果您正苦于以下问题:C# IContainerOwner.IsGroupContainer方法的具体用法?C# IContainerOwner.IsGroupContainer怎么用?C# IContainerOwner.IsGroupContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IContainerOwner的用法示例。


在下文中一共展示了IContainerOwner.IsGroupContainer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateDefaultViewRelativeToRequester

        /// <summary>
        /// Creates default views and returns the one relative to the requester
        /// </summary>
        /// <param name="requesterLocation">Requester relative location</param>
        /// <param name="informationObject">Information object to create the view for</param>
        /// <param name="owner">Container owner</param>
        /// <returns></returns>
        public static CloudBlob CreateDefaultViewRelativeToRequester(string requesterLocation, IInformationObject informationObject, IContainerOwner owner)
        {
            bool isAccountOwner = owner.IsAccountContainer();
            bool isGroupOwner = owner.IsGroupContainer();
            bool isDeveloperView = owner.ContainerName == "dev";
            string[] viewLocations;
            if (isAccountOwner)
                viewLocations = FixedAccountSiteLocations;
            else if (isGroupOwner)
                viewLocations = FixedGroupSiteLocations;
            else throw new NotSupportedException("Invalid owner container type for default view (non acct, non group): " + owner.ContainerName);

            string requesterDirectory = StorageSupport.GetLocationParentDirectory(requesterLocation);
            FileInfo fileInfo = new FileInfo(requesterLocation);
            //string viewRoot = fileInfo.Directory.Parent != null
            //                      ? fileInfo.Directory.Parent.Name
            //                      : fileInfo.Directory.Name;
            CloudBlob relativeViewBlob = null;
            bool hasException = false;
            bool allException = true;
            foreach (string viewLocation in viewLocations)
            {
                try
                {
                    string viewRoot = isDeveloperView ? "developer-00000000000000000000000000" : GetViewRoot(viewLocation);
                    string viewItemDirectory = Path.Combine(viewRoot, viewLocation).Replace("\\", "/") + "/";
                    string viewName = GetDefaultStaticViewName(informationObject);
                    string viewTemplateName = GetDefaultStaticTemplateName(informationObject);
                    // TODO: Relative from xyzsite => xyztemplate; now we only have website - also acct/grp specific
                    //string viewTemplateLocation = "webtemplate/oip-viewtemplate/" + viewTemplateName;
                    string viewTemplateLocation = viewItemDirectory + viewTemplateName;
                    CloudBlob viewTemplate = StorageSupport.CurrActiveContainer.GetBlob(viewTemplateLocation, owner);
                    string renderedViewLocation = viewItemDirectory + viewName;
                    CloudBlob renderTarget = StorageSupport.CurrActiveContainer.GetBlob(renderedViewLocation, owner);
                    InformationSource defaultSource = InformationSource.GetAsDefaultSource(informationObject);
                    RenderWebSupport.RenderTemplateWithContentToBlob(viewTemplate, renderTarget, defaultSource);
                    if (viewItemDirectory == requesterDirectory)
                        relativeViewBlob = renderTarget;
                    allException = false;
                }
                catch (Exception ex)
                {
                    hasException = true;
                }

            }
            if (relativeViewBlob == null && hasException == false && false)
                throw new InvalidDataException(
                    String.Format("Default view with relative location {0} not found for owner type {1}",
                                  requesterLocation, owner.ContainerName));
            return relativeViewBlob;
        }
开发者ID:kallex,项目名称:Caloom,代码行数:59,代码来源:DefaultViewSupport.cs

示例2: validateThatOwnerGetComesFromSameReferer

        private void validateThatOwnerGetComesFromSameReferer(IContainerOwner containerOwner, HttpRequest request, string contentPath)
        {
            bool isGroupRequest = containerOwner.IsGroupContainer();
            string requestGroupID = isGroupRequest ? containerOwner.LocationPrefix : null;
            bool isAccountRequest = !isGroupRequest;
            var urlReferrer = request.UrlReferrer;
            string[] groupTemplates = InstanceConfiguration.DefaultGroupTemplateList;
            string[] accountTemplates = InstanceConfiguration.DefaultAccountTemplateList;
            var refererPath = urlReferrer != null && urlReferrer.Host == request.Url.Host ? urlReferrer.AbsolutePath : "";
            bool refererIsAccount = refererPath.StartsWith("/auth/account/");
            bool refererIsGroup = refererPath.StartsWith("/auth/grp/");

            if (isGroupRequest)
            {
                bool defaultMatch = groupTemplates.Any(contentPath.StartsWith);
                if (defaultMatch && (refererIsAccount == false && refererIsGroup == false))
                    return;
            }
            else
            {
                bool defaultMatch = accountTemplates.Any(contentPath.StartsWith);
                if (defaultMatch && (refererIsAccount == false && refererIsGroup == false))
                    return;
            }
            if (urlReferrer == null)
            {
                if (contentPath.StartsWith("customui_") || contentPath.StartsWith("DEV_") || contentPath.StartsWith("webview/") || contentPath.StartsWith("wwwsite/") ||
                    contentPath.EndsWith(".html"))
                    return;
                throw new SecurityException("Url referer required for non-default template requests, that target other than customui_ folder");
            }
            if (refererIsAccount && isAccountRequest)
                return;
            if (refererPath.StartsWith("/about/"))
                return;
            if (refererIsAccount == false && refererIsGroup == false) // referer is neither account nor group from this platform
            {
                if (contentPath.EndsWith("/") || contentPath.EndsWith(".html"))
                    return;
                throw new SecurityException("Url referring outside the platform is not allowed except for .html files");
            }
            string refererOwnerPath = refererIsAccount
                                          ? GetAccountContentPath(refererPath)
                                          : GetGroupContentPath(refererPath);
            // Accept account and group referers of default templates
            if (refererIsAccount && accountTemplates.Any(refererOwnerPath.StartsWith))
                return;
            if (refererIsGroup && groupTemplates.Any(refererOwnerPath.StartsWith))
                return;
            // Custom referers
            if (refererIsAccount)
            {
                throw new SecurityException("Non-default account referer accessing non-account content");
            }
            else // Referer is group
            {
                if(isAccountRequest)
                    throw new SecurityException("Non-default group referer accessing account content");
                string refererGroupID = GetGroupID(refererPath);
                if(refererGroupID != requestGroupID)
                    throw new SecurityException("Non-default group referer accessing other group content");
            }
        }
开发者ID:kallex,项目名称:Caloom,代码行数:63,代码来源:AuthorizedBlobStorageHandler.cs

示例3: requireGroup

 private static void requireGroup(IContainerOwner owner, string errorMessage)
 {
     if(owner.IsGroupContainer() == false)
         throw new InvalidOperationException(errorMessage);
 }
开发者ID:kallex,项目名称:Caloom,代码行数:5,代码来源:ModifyInformationSupport.cs

示例4: executeOperationWithFormValues

        private static object executeOperationWithFormValues(IContainerOwner containerOwner, string operationName, NameValueCollection form, HttpFileCollection fileContent)
        {
            var filterFields = new string[] {"ExecuteOperation", "ObjectDomainName", "ObjectName", "ObjectID", "NORELOAD"};
            switch (operationName)
            {
                case "SetGroupAsDefaultForAccount":
                {
                    SetGroupAsDefaultForAccountParameters parameters = new SetGroupAsDefaultForAccountParameters
                    {
                        GroupID = form["GroupID"]
                    };
                    SetGroupAsDefaultForAccount.Execute(parameters);
                    break;
                }
                case "ClearDefaultGroupFromAccount":
                {
                    ClearDefaultGroupFromAccount.Execute();
                    break;
                }

                case "PublishToConnection":
                    {
                        var parameters = new PublishCollaborationContentOverConnectionParameters
                            {
                                ConnectionID = form["ConnectionID"]
                            };
                        PublishCollaborationContentOverConnection.Execute(parameters);
                        break;
                    }
                case "FinalizeConnectionAfterGroupAuthorization":
                    {
                        var parameters = new FinalizeConnectionAfterGroupAuthorizationParameters
                            {
                                ConnectionID = form["ConnectionID"]
                            };
                        FinalizeConnectionAfterGroupAuthorization.Execute(parameters);
                        break;
                    }
                case "DeleteConnection":
                    {
                        var parameters = new DeleteConnectionWithStructuresParameters
                            {
                                ConnectionID = form["ConnectionID"],
                                IsLaunchedByRemoteDelete = false
                            };
                        DeleteConnectionWithStructures.Execute(parameters);
                        break;
                    }
                case "SynchronizeConnectionCategories":
                    {
                        var parameters = new SynchronizeConnectionCategoriesParameters
                        {
                            ConnectionID = form["ConnectionID"]
                        };
                        SynchronizeConnectionCategories.Execute(parameters);
                        break;
                    }

                case "UpdateConnectionThisSideCategories":
                    {
                        ExecuteConnectionProcess.Execute(new ExecuteConnectionProcessParameters
                            {
                                ConnectionID = form["ConnectionID"],
                                ConnectionProcessToExecute = "UpdateConnectionThisSideCategories"
                            });
                        break;
                    }
                case "InitiateIntegrationConnection":
                    {
                        InitiateIntegrationConnectionParameters parameters = new InitiateIntegrationConnectionParameters
                            {
                                Description = form["Description"],
                                TargetBallHostName = form["TargetBallHostName"],
                                TargetGroupID = form["TargetGroupID"]
                            };
                        InitiateIntegrationConnection.Execute(parameters);
                        break;
                    }
                case "DeleteCustomUI":
                    {
                        if (containerOwner.IsGroupContainer() == false)
                            throw new NotSupportedException("CreateOrUpdateCustomUI is only supported for groups");
                        DeleteCustomUIParameters parameters = new DeleteCustomUIParameters
                            {
                                CustomUIName = form["CustomUIName"],
                                Owner = containerOwner
                            };
                        DeleteCustomUI.Execute(parameters);
                        break;
                    }
                case "CreateOrUpdateCustomUI":
                    {
                        if(containerOwner.IsGroupContainer() == false)
                            throw new NotSupportedException("CreateOrUpdateCustomUI is only supported for groups");
                        var customUIContent = fileContent["CustomUIContents"];
                        if(customUIContent == null)
                            throw new ArgumentException("CustomUIContent field is required to contain the zip contents of custom UI.");
                        CreateOrUpdateCustomUIParameters parameters = new CreateOrUpdateCustomUIParameters
                            {
                                CustomUIName = form["CustomUIName"],
//.........这里部分代码省略.........
开发者ID:kallex,项目名称:Caloom,代码行数:101,代码来源:ModifyInformationSupport.cs


注:本文中的IContainerOwner.IsGroupContainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。