Пример #1
0
 /// <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
        /// <summary>
        /// 删除资讯
        /// </summary>
        public static bool CMS_DeleteContentItem(this Authorizer authorizer, ContentItem contentItem)
        {
            IUser currentUser = UserContext.CurrentUser;
            if (currentUser == null)
            {
                return false;
            }

            if (authorizer.CMS_ManageContentFolder(contentItem.ContentFolder))
                return true;

            if (contentItem.AuditStatus != AuditStatus.Success && contentItem.UserId == currentUser.UserId)
                return true;

            return false;
        }
Пример #3
0
        /// <summary>
        /// 编辑内容项
        /// </summary>
        /// <param name="authorizer"></param>
        /// <param name="contentItem"></param>
        public static bool CMS_EditContentItem(this Authorizer authorizer, ContentItem contentItem)
        {
            if (authorizer.IsAdministrator(CmsConfig.Instance().ApplicationId))
                return true;

            if (authorizer.CMS_ManageContentFolder(contentItem.ContentFolder))
                return true;
            IUser currentUser = UserContext.CurrentUser;
            if (currentUser == null)
            {
                return false;
            }
            if (contentItem.AuditStatus != AuditStatus.Success && contentItem.UserId == currentUser.UserId)
                return true;
            return false;
        }