Пример #1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="name">Searcher名称</param>
 /// <param name="indexPath">索引文件所在路径(支持"~/"及unc路径)</param>
 /// <param name="asQuickSearch">是否作为快捷搜索</param>
 /// <param name="displayOrder">显示顺序</param>
 public BlogSearcher(string name, string indexPath, bool asQuickSearch, int displayOrder)
 {
     this.Name           = name;
     this.IndexPath      = Tunynet.Utilities.WebUtility.GetPhysicalFilePath(indexPath);
     this.AsQuickSearch  = asQuickSearch;
     this.DisplayOrder   = displayOrder;
     searchEngine        = SearcherFactory.GetSearchEngine(indexPath);
     publiclyAuditStatus = auditService.GetPubliclyAuditStatus(BlogConfig.Instance().ApplicationId);
 }
Пример #2
0
        /// <summary>
        /// 管理日志
        /// 管理员可以管理所有日志,精华、管理员推荐也使用该规则
        /// </summary>
        public static bool BlogThread_Manage(this Authorizer authorizer)
        {
            if (authorizer.IsAdministrator(BlogConfig.Instance().ApplicationId))
            {
                return(true);
            }

            return(false);
        }
Пример #3
0
 public string GetOwner()
 {
     return(BlogConfig.Instance().ApplicationName);
 }
Пример #4
0
        /// <summary>
        /// 删除日志
        /// 空间主人或管理员可以删除空间用户的日志
        /// </summary>
        public static bool BlogThread_Delete(this Authorizer authorizer, BlogThread blogThread)
        {
            IUser currentUser = UserContext.CurrentUser;

            if (currentUser == null)
            {
                return(false);
            }

            if (blogThread.UserId == currentUser.UserId || authorizer.IsAdministrator(BlogConfig.Instance().ApplicationId))
            {
                return(true);
            }

            return(false);
        }
Пример #5
0
        /// <summary>
        /// 查看日志
        /// 仅自己可见的只能是日志作者或管理员可以查看
        /// 部分可见的只能是日志作者、指定可见的用户或管理员可以查看
        /// </summary>
        public static bool BlogThread_View(this Authorizer authorizer, BlogThread blogThread)
        {
            if (blogThread.PrivacyStatus == PrivacyStatus.Public)
            {
                return(true);
            }

            IUser currentUser = UserContext.CurrentUser;

            if (currentUser == null)
            {
                return(false);
            }

            if (blogThread.UserId == currentUser.UserId || authorizer.IsAdministrator(BlogConfig.Instance().ApplicationId))
            {
                return(true);
            }

            if (blogThread.PrivacyStatus == PrivacyStatus.Private)
            {
                return(false);
            }

            ContentPrivacyService contentPrivacyService = new ContentPrivacyService();

            if (contentPrivacyService.Validate(blogThread, currentUser.UserId))
            {
                return(true);
            }

            return(false);
        }