//----------------------------------------------------------------------
        public static IList GetTopicAdminCmds( User user, ForumBoard board, MvcContext ctx )
        {
            IList results = new ArrayList();

            // 1、获取用户的角色
            SecurityTool tool = ForumSecurityService.GetSecurityTool( board, ctx );
            IList actions = tool.GetActionsByRole( user.Role );
            addAdminActionsToResults( actions, results );

            // 2、获取用户的等级
            if (user.RankId > 0) {
                actions = tool.GetActionsByRole( user.Rank );
                addAdminActionsToResults( actions, results );
            }

            // 3、owner的角色
            if (ctx.owner.obj.GetType() != typeof( Site )) {
                IRole roleInOwner = ctx.owner.obj.GetUserRole( user );
                actions = tool.GetActionsByRole( roleInOwner );
                addAdminActionsToResults( actions, results );
            }

            // 3、版主
            ModeratorService moderatorService = new ModeratorService();
            if (moderatorService.IsModerator( board, user )) {

                IList moderatorActions = tool.GetActionsByRole( ForumRole.Moderator );
                addAdminActionsToResults( moderatorActions, results );
            }

            return results;
        }
Beispiel #2
0
 public ModeratorController()
 {
     forumService = new ForumService();
     boardService = new ForumBoardService();
     userService = new UserService();
     moderatorService = new ModeratorService();
 }
Beispiel #3
0
 public PostController()
 {
     boardService = new ForumBoardService();
     topicService = new ForumTopicService();
     postService = new ForumPostService();
     attachService = new AttachmentService();
     moderatorService = new ModeratorService();
 }
 public TopicListController()
 {
     forumService = new ForumService();
     boardService = new ForumBoardService();
     topicService = new ForumTopicService();
     categoryService = new ForumCategoryService();
     moderatorService = new ModeratorService();
 }
 public PostController() {
     boardService = new ForumBoardService();
     topicService = new ForumTopicService();
     postService = new ForumPostService();
     attachService = new AttachmentService();
     moderatorService = new ModeratorService();
     buyService = new ForumBuyLogService();
     incomeService = new UserIncomeService();
 }
 public ForumController() {
     forumService = new ForumService();
     boardService = new ForumBoardService();
     categoryService = new ForumCategoryService();
     topicService = new ForumTopicService();
     moderatorService = new ModeratorService();
     logService = new ForumLogService();
     postService = new ForumPostService();
 }
Beispiel #7
0
 public PostBlockController()
 {
     topicService = new ForumTopicService();
     boardService = new ForumBoardService();
     userService = new UserService();
     rateService = new ForumRateService();
     currencyService = new CurrencyService();
     buylogService = new ForumBuyLogService();
     moderatorService = new ModeratorService();
 }
        private static Boolean hasAction( ISecurity objSecurity, MvcContext ctx ) {

            // 未提供权限配置的页面通过
            if (objSecurity == null) return true;

            SecurityTool securityTool = ForumSecurityService.GetSecurityTool( objSecurity, ctx );// objSecurity.SecurityTool;


            // 不需要权限管理的页面通过
            if (securityTool.IsForbiddenAction( ctx.route.getControllerAndActionPath() ) == false) return true;

            // 空页面——通过
            String currentPath = ctx.url.Path;
            if (strUtil.IsNullOrEmpty( currentPath )) return true;

            // 编辑权限例外:用户可以编辑自己的帖子

            // 只要系统角色,或论坛角色之一具有权限,则用户具有权限(当用户具有多重身份之时)

            // 1、获取用户的角色

            //系统角色
            SiteRole role = ((User)ctx.viewer.obj).Role;
            IList actions = securityTool.GetActionsByRole( role );
            if (hasAction_private( actions, ctx )) return true;

            // 2、获取用户在特定owner中的角色
            if (ctx.owner.obj.GetType() != typeof( Site )) {
                IRole roleInOwner = ctx.owner.obj.GetUserRole( ctx.viewer.obj );
                IList ownerRoleActions = securityTool.GetActionsByRole( roleInOwner );
                if (hasAction_private( ownerRoleActions, ctx )) return true;
            }

            // 3、获取用户的等级
            SiteRank rank = ((User)ctx.viewer.obj).Rank;
            if (rank.Id > 0) {
                actions = securityTool.GetActionsByRole( rank );
                if (hasAction_private( actions, ctx )) return true;
            }

            // 4、是否在论坛担任角色

            if (objSecurity is ForumBoard) {

                ModeratorService moderatorService = new ModeratorService();

                if (moderatorService.IsModerator( objSecurity as ForumBoard, (User)ctx.viewer.obj )) {
                    IList moderatorActions = securityTool.GetActionsByRole( ForumRole.Moderator );
                    if (hasAction_private( moderatorActions, ctx )) return true;
                }

            }

            return false;
        }
 public PostAdminController()
 {
     topicService = new ForumTopicService();
     boardService = new ForumBoardService();
     postService = new ForumPostService();
     currencyService = new CurrencyService();
     userService = new UserService();
     rateService = new ForumRateService();
     buyService = new ForumBuyLogService();
     userIncomeService = new UserIncomeService();
     moderatorService = new ModeratorService();
 }
Beispiel #10
0
        public TopicController()
        {
            boardService = new ForumBoardService();
            topicService = new ForumTopicService();
            postService = new ForumPostService();
            incomeService = new UserIncomeService();
            attachService = new AttachmentService();

            userService = new UserService();
            rateService = new ForumRateService();
            currencyService = new CurrencyService();
            buylogService = new ForumBuyLogService();
            moderatorService = new ModeratorService();
        }
 public BoardController()
 {
     boardService = new ForumBoardService();
     moderatorService = new ModeratorService();
 }