public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var siteId = SiteId; if (siteId == 0) { siteId = AuthRequest.AdminInfo.SiteId; } var siteIdList = AuthRequest.AdminPermissions.SiteIdList; //站点要判断是否存在,是否有权限 if (siteId == 0 || !SiteManager.IsExists(siteId) || !siteIdList.Contains(siteId)) { if (siteIdList != null && siteIdList.Count > 0) { siteId = siteIdList[0]; } } _siteInfo = SiteManager.GetSiteInfo(siteId); if (_siteInfo != null && _siteInfo.Id > 0) { if (SiteId == 0) { PageUtils.Redirect(GetRedirectUrl(_siteInfo.Id)); return; } var showSite = false; var permissionList = new List <string>(AuthRequest.AdminPermissions.PermissionList); if (AuthRequest.AdminPermissions.HasSitePermissions(_siteInfo.Id)) { var websitePermissionList = AuthRequest.AdminPermissions.GetSitePermissions(_siteInfo.Id); if (websitePermissionList != null) { showSite = true; permissionList.AddRange(websitePermissionList); } } var channelPermissions = AuthRequest.AdminPermissions.GetChannelPermissions(_siteInfo.Id); if (channelPermissions.Count > 0) { showSite = true; permissionList.AddRange(channelPermissions); } var siteIdHashtable = new Hashtable(); if (siteIdList != null) { foreach (var theSiteId in siteIdList) { siteIdHashtable.Add(theSiteId, theSiteId); } } if (!siteIdHashtable.Contains(SiteId)) { showSite = false; } if (!showSite) { PageUtils.RedirectToErrorPage("您没有此发布系统的操作权限!"); return; } LtlTopMenus.Text = GetTopMenuSitesHtml() + GetTopMenuLinksHtml() + GetTopMenusHtml(); PhSite.Visible = true; LtlCreateStatus.Text = $@" <script type=""text/javascript""> function {LayerUtils.OpenPageCreateStatusFuncName}() {{ {PageCreateStatus.GetOpenLayerString(_siteInfo.Id)} }} </script> <a href=""javascript:;"" onclick=""{LayerUtils.OpenPageCreateStatusFuncName}()""> <i class=""ion-wand""></i> <span id=""progress"" class=""badge badge-xs badge-pink"">0</span> </a> "; NtLeftManagement.TopId = ConfigManager.TopMenu.IdSite; NtLeftManagement.SiteId = _siteInfo.Id; NtLeftManagement.PermissionList = permissionList; NtLeftFunctions.TopId = string.Empty; NtLeftFunctions.SiteId = _siteInfo.Id; NtLeftFunctions.PermissionList = permissionList; ClientScriptRegisterClientScriptBlock("NodeTreeScript", NodeNaviTreeItem.GetNavigationBarScript()); } else { if (AuthRequest.AdminPermissions.IsConsoleAdministrator) { PageUtils.Redirect(PageSiteAdd.GetRedirectUrl()); return; } } if (_siteInfo != null && _siteInfo.Id > 0 && AuthRequest.AdminInfo.SiteId != _siteInfo.Id) { DataProvider.AdministratorDao.UpdateSiteId(AuthRequest.AdminName, _siteInfo.Id); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var isLeft = false; var siteId = 0; var siteIdList = AuthRequest.AdminPermissions.SiteIdList; if (siteIdList.Contains(SiteId)) { siteId = SiteId; } else if (siteIdList.Contains(AuthRequest.AdminInfo.SiteId)) { siteId = AuthRequest.AdminInfo.SiteId; } //站点要判断是否存在,是否有权限 if (siteId == 0 || !SiteManager.IsExists(siteId) || !siteIdList.Contains(siteId)) { if (siteIdList.Count > 0) { siteId = siteIdList[0]; } } _siteInfo = SiteManager.GetSiteInfo(siteId); if (_siteInfo != null && _siteInfo.Id > 0) { if (SiteId == 0) { PageUtils.Redirect(GetRedirectUrl(_siteInfo.Id)); return; } var permissionList = new List <string>(AuthRequest.AdminPermissions.PermissionList); if (AuthRequest.AdminPermissions.HasSitePermissions(_siteInfo.Id)) { var websitePermissionList = AuthRequest.AdminPermissions.GetSitePermissions(_siteInfo.Id); if (websitePermissionList != null) { isLeft = true; permissionList.AddRange(websitePermissionList); } } var channelPermissions = AuthRequest.AdminPermissions.GetChannelPermissions(_siteInfo.Id); if (channelPermissions.Count > 0) { isLeft = true; permissionList.AddRange(channelPermissions); } PhSite.Visible = isLeft; LtlCreateStatus.Text = $@" <script type=""text/javascript""> function {LayerUtils.OpenPageCreateStatusFuncName}() {{ {PageCreateStatus.GetOpenLayerString(_siteInfo.Id)} }} </script> <a href=""javascript:;"" onclick=""{LayerUtils.OpenPageCreateStatusFuncName}()""> <i class=""ion-wand""></i> <span id=""progress"" class=""badge badge-xs badge-pink"">0</span> </a> "; NtLeftManagement.TopId = ConfigManager.TopMenu.IdSite; NtLeftManagement.SiteId = _siteInfo.Id; NtLeftManagement.PermissionList = permissionList; NtLeftFunctions.TopId = string.Empty; NtLeftFunctions.SiteId = _siteInfo.Id; NtLeftFunctions.PermissionList = permissionList; ClientScriptRegisterClientScriptBlock("NodeTreeScript", NodeNaviTreeItem.GetNavigationBarScript()); } else { if (IsConsoleAdministrator) { PageUtils.Redirect(PageSiteAdd.GetRedirectUrl()); return; } } if (_siteInfo != null && _siteInfo.Id > 0 && AuthRequest.AdminInfo.SiteId != _siteInfo.Id) { DataProvider.AdministratorDao.UpdateSiteId(AuthRequest.AdminName, _siteInfo.Id); } if (isLeft) { LtlTopMenus.Text = $@" <a href=""javascript:;"" class=""position-fixed"" onclick=""toggleMenu()"" style=""margin-top: 10px;margin-left: 30px;""> <i class=""ion-navicon"" style=""font-size: 28px;color: #fff;""></i> </a> <ul id=""topMenus"" class=""navigation-menu""> {GetTopMenuSitesHtml() + GetTopMenuLinksHtml() + GetTopMenusHtml()} </ul> "; } else { LtlTopMenus.Text = $@" <script>toggleMenu();</script> <ul id=""topMenus"" class=""navigation-menu"" style=""margin-left: 210px;""> {GetTopMenusHtml()} </ul> "; } }