text: MWF.xApplication.Forum.IS_LOGIN=!1,MWF.xApplication.Forum.ForumSetting=null,MWF.xApplication.Forum.RoleInfoList=[],MWF.xApplication.Forum.PermissionInfoList=[],MWF.xApplication.Forum.isBBSSystemAdmin=!1,MWF.xApplication.Forum.Access=new Class({initialize:function(i,t,n){this.actions=i,this.lp=t,this.userName=n||layout.desktop.session.user.distinguishedName||"",this.anonymous="anonymous"==layout.desktop.session.user.name,this.anonymous&&MWF.Actions.get("x_organization_assemble_personal").getRegisterMode(function(i){this.signUpMode=i.data.value}.bind(this),null,!1),MWF.xApplication.Forum.ForumSetting||(MWF.xApplication.Forum.ForumSetting={},this.actions.listCategoryAll(function(i){i.data||(i.data=[]),i.data.each(function(i){MWF.xApplication.Forum.ForumSetting[i.id]=i}.bind(this))}.bind(this)))},login:function(i){MWF.xApplication.Forum.IS_LOGIN?i&&i():this.actions.login({},function(t){MWF.xApplication.Forum.RoleInfoList=t.data?t.data.roleInfoList:[],MWF.xApplication.Forum.PermissionInfoList=t.data?t.data.permissionInfoList:[],MWF.xApplication.Forum.IS_LOGIN=!0,MWF.xApplication.Forum.isBBSSystemAdmin=!!t.data&&t.data.isBBSSystemAdmin,i&&i()}.bind(this))},isAnonymous:function(){return this.anonymous},isAnonymousDynamic:function(){var i=!0;return MWF.Actions.get("x_organization_assemble_authentication").authentication(function(t){"anonymous"==t.data.tokenType?(this.userName=layout.desktop.session.user.distinguishedName="anonymous",i=!0):(this.userName=layout.desktop.session.user.distinguishedName=t.data.distinguishedName,i=!1)}.bind(this),null,!1),i},isAdmin:function(){return MWF.AC.isBBSManager()||MWF.xApplication.Forum.isBBSSystemAdmin},inArray:function(i,t,n){var o=!1;return"string"==typeOf(i)&&(i=i.split(",")),-1!=i.indexOf(n||this.userName)&&(o=!0),t&&t(o),o},isForumViewer:function(i){var t=!0;return!!this.hasForumAdminAuthority(i,null,null,!1)||(this.getCategoryData(i,(function(i){i.forumVisible!=this.lp.allPerson&&-1==MWF.xApplication.Forum.RoleInfoList.indexOf("FORUM_GUEST_"+i.id)&&(t=!1)})),t)},isSectionViewer:function(i){var t=!0;if(this.hasSectionAdminAuthority(i,null,null,!1))return!0;if("string"==typeOf(i))this.actions.getSection(i,function(i){var n=i.data;n.sectionVisible!=this.lp.allPerson&&-1==MWF.xApplication.Forum.PermissionInfoList.indexOf("SECTION_VIEW_"+n.id)&&(t=!1)}.bind(this),null,async);else{var n=i;n.sectionVisible!=this.lp.allPerson&&-1==MWF.xApplication.Forum.PermissionInfoList.indexOf("SECTION_VIEW_"+n.id)&&(t=!1)}return t},isRecommender:function(i){var t=!1;if("string"==typeOf(i))this.actions.getSection(i,function(i){var n=i.data;(-1!=MWF.xApplication.Forum.RoleInfoList.indexOf("SECTION_RECOMMENDER_"+n.id)||this.hasSectionAdminAuthority(n,null,null,!1))&&(t=!0)}.bind(this),null,async);else{var n=i;(-1!=MWF.xApplication.Forum.RoleInfoList.indexOf("SECTION_RECOMMENDER_"+n.id)||this.hasSectionAdminAuthority(n,null,null,!1))&&(t=!0)}return t},isSubjectPublisher:function(i){var t=!0;if(this.hasSectionAdminAuthority(i,null,null,!1))return!0;if("string"==typeOf(i))this.actions.getSection(i,function(i){var n=i.data;n.subjectPublishAble!=this.lp.allPerson&&-1==MWF.xApplication.Forum.RoleInfoList.indexOf("SECTION_SUBJECT_PUBLISHER_"+n.id)&&(t=!1)}.bind(this),null,async);else{var n=i;n.subjectPublishAble!=this.lp.allPerson&&-1==MWF.xApplication.Forum.RoleInfoList.indexOf("SECTION_SUBJECT_PUBLISHER_"+n.id)&&(t=!1)}return t},isReplyPublisher:function(i){var t=!0;if(this.hasSectionAdminAuthority(i,null,null,!1))return!0;if("string"==typeOf(i))this.actions.getSection(i,function(i){var n=i.data;n.replyPublishAble!=this.lp.allPerson&&-1==MWF.xApplication.Forum.RoleInfoList.indexOf("SECTION_REPLY_PUBLISHER_"+n.id)&&(t=!1)}.bind(this),null,!1);else{var n=i;n.replyPublishAble!=this.lp.allPerson&&-1==MWF.xApplication.Forum.RoleInfoList.indexOf("SECTION_REPLY_PUBLISHER_"+n.id)&&(t=!1)}return t},getCategoryData:function(i,t){"string"==typeOf(i)?MWF.xApplication.Forum.ForumSetting[i]?t&&t(MWF.xApplication.Forum.ForumSetting[i]):this.actions.getCategory(i,function(n){MWF.xApplication.Forum.ForumSetting[i]=n.data,t&&t(n.data)}.bind(this),null,!1):(MWF.xApplication.Forum.ForumSetting[i.id]||(MWF.xApplication.Forum.ForumSetting[i]=i),t&&t(i))},isForumManager:function(i,t,n,o){var s=!1;return this.getCategoryData(i,function(i){s=this.inArray(i.forumManagerName,t,n)}.bind(this)),s},isSectionManager:function(i,t,n,o){var s=!1;return"string"==typeOf(i)?this.actions.getSection(i,function(i){s=this.inArray(i.data.moderatorNames,t,n)}.bind(this),null,o):s=this.inArray(i.moderatorNames,t,n),s},hasForumAdminAuthority:function(i,t,n,o){if(!n&&this.isAdmin())return t&&t(!0),!0;return this.isForumManager(i,function(i){t&&t(i)}.bind(this),n,o)},hasSectionAdminAuthority:function(i,t,n,o){if(!n&&this.isAdmin())return t&&t(!0),!0;var s=!1,e=function(i){var e=i.moderatorNames;"string"==typeOf(e)&&(e=e.split(",")),-1!=e.indexOf(n||this.userName)&&(s=!0),s?t&&t(s):s=this.isForumManager(i.forumId,function(i){t&&t(i)}.bind(this),n,o)}.bind(this);return"string"==typeOf(i)?this.actions.getSection(i,function(i){e(i.data)}.bind(this),null,o):e(i),s}});