コード例 #1
0
ファイル: Authorizer.cs プロジェクト: ClaytonWang/Dw3cSNS
 /// <summary>
 /// 发布内容项
 /// </summary>
 /// <param name="folder">栏目</param>
 /// <param name="authorizer"></param>
 public static bool CMS_CreateContentItem(this Authorizer authorizer, ContentFolder folder)
 {
     if (authorizer.IsAdministrator(CmsConfig.Instance().ApplicationId))
     {
         return true;
     }
     return authorizer.CMS_ManageContentFolder(folder);
 }
コード例 #2
0
ファイル: Authorizer.cs プロジェクト: ClaytonWang/Dw3cSNS
        /// <summary>
        /// 管理栏目
        /// </summary>
        /// <param name="authorizer"></param>
        /// <param name="folder">栏目</param>
        public static bool CMS_ManageContentFolder(this Authorizer authorizer, ContentFolder folder)
        {
            IUser currentUser = UserContext.CurrentUser;

            if (currentUser == null)
                return false;

            if (authorizer.IsAdministrator(CmsConfig.Instance().ApplicationId))
                return true;

            if (folder.Moderators.Any(n => n.UserId == currentUser.UserId))
                return true;

            if (folder.Parents.Any(n => n.Moderators != null && n.Moderators.Any(m => m.UserId == currentUser.UserId)))
                return true;

            return false;
        }
コード例 #3
0
ファイル: FolderEditModel.cs プロジェクト: hbulzy/SYS
        public ContentFolder AsContentFolder()
        {
            ContentFolder contentFolder = new ContentFolder();

            if (this.ContentFolderId > 0)
                contentFolder = new ContentFolderService().Get(this.ContentFolderId);

            contentFolder.FolderName = this.FolderName;

            contentFolder.Description = this.Description ?? string.Empty;

            contentFolder.IsEnabled = this.IsEnabled;

            contentFolder.IsAsNavigation = this.IsAsNavigation;

            contentFolder.ParentId = this.ParentId.HasValue ? this.ParentId.Value : 0;

            contentFolder.Page_Detail = this.Page_Detail ?? string.Empty;

            contentFolder.Page_List = this.Page_List ?? string.Empty;

            contentFolder.IsLinkToNewWindow = this.IsLinkToNewWindow;

            contentFolder.LinkUrl = this.LinkUrl ?? string.Empty;

            contentFolder.IsLink = this.IsLink;

            contentFolder.ContentTypeKeys = string.Join(",", this.ContentTypeKeys);

            contentFolder.Icon = this.icon ?? string.Empty;

            contentFolder.METATitle = this.METATitle ?? string.Empty;
            contentFolder.METAKeywords = this.METAKeywords ?? string.Empty;
            contentFolder.METADescription = this.METADescription ?? string.Empty;
            contentFolder.NeedAuditing = this.NeedAuditing;
            contentFolder.Editor = this.Editor ?? string.Empty;
            return contentFolder;
        }