Example #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (PageUtils.DetermineRedirectToInstaller())
            {
                return;
            }

            if (!Body.IsAdministratorLoggin)
            {
                PageUtils.RedirectToLoginPage();
                return;
            }

            if (Body.AdministratorInfo.IsLockedOut)
            {
                PageUtils.RedirectToLoginPage("对不起,您的账号已被锁定,无法进入系统!");
                return;
            }

            var redirectUrl = PageMain.GetRedirectUrl();

            var permissions             = PermissionsManager.GetPermissions(Body.AdministratorName);
            var publishmentSystemIdList = ProductPermissionsManager.Current.PublishmentSystemIdList;

            if (publishmentSystemIdList == null || publishmentSystemIdList.Count == 0)
            {
                if (permissions.IsSystemAdministrator)
                {
                    redirectUrl = PageAppAdd.GetRedirectUrl();
                }
            }

            LtlContent.Text = $@"
<script language=""javascript"">
function redirectUrl()
{{
   location.href = ""{redirectUrl}"";
}}
setTimeout(""redirectUrl()"", 2000);
</script>
";
        }
Example #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            LtlUserName.Text = AdminManager.GetDisplayName(Body.AdministratorName, true);

            _menuId      = Body.GetQueryString("menuID");
            _permissions = PermissionsManager.GetPermissions(Body.AdministratorName);

            if (string.IsNullOrEmpty(_menuId))
            {
                var publishmentSystemId = PublishmentSystemId;

                if (publishmentSystemId == 0)
                {
                    publishmentSystemId = Body.AdministratorInfo.PublishmentSystemId;
                }

                var publishmentSystemIdList = ProductPermissionsManager.Current.PublishmentSystemIdList;

                //站点要判断是否存在,是否有权限,update by sessionliang 20160104
                if (publishmentSystemId == 0 || !PublishmentSystemManager.IsExists(publishmentSystemId) || !publishmentSystemIdList.Contains(publishmentSystemId))
                {
                    //ArrayList publishmentSystemIDArrayList = PublishmentSystemManager.GetPublishmentSystemIDArrayListOrderByLevel();
                    // List<int> publishmentSystemIDList = ProductPermissionsManager.Current.PublishmentSystemIDList;
                    if (publishmentSystemIdList != null && publishmentSystemIdList.Count > 0)
                    {
                        publishmentSystemId = publishmentSystemIdList[0];
                    }
                }

                _publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);

                if (_publishmentSystemInfo != null && _publishmentSystemInfo.PublishmentSystemId > 0)
                {
                    if (PublishmentSystemId == 0)
                    {
                        PageUtils.Redirect(GetRedirectUrl(_publishmentSystemInfo.PublishmentSystemId, string.Empty));
                        return;
                    }

                    var showPublishmentSystem = false;

                    var permissionList = new List <string>();
                    if (ProductPermissionsManager.Current.WebsitePermissionDict.ContainsKey(_publishmentSystemInfo.PublishmentSystemId))
                    {
                        var websitePermissionList = ProductPermissionsManager.Current.WebsitePermissionDict[_publishmentSystemInfo.PublishmentSystemId];
                        if (websitePermissionList != null)
                        {
                            showPublishmentSystem = true;
                            permissionList.AddRange(websitePermissionList);
                        }
                    }

                    ICollection nodeIdCollection = ProductPermissionsManager.Current.ChannelPermissionDict.Keys;
                    foreach (int nodeId in nodeIdCollection)
                    {
                        if (ChannelUtility.IsAncestorOrSelf(_publishmentSystemInfo.PublishmentSystemId, _publishmentSystemInfo.PublishmentSystemId, nodeId))
                        {
                            showPublishmentSystem = true;
                            var list = ProductPermissionsManager.Current.ChannelPermissionDict[nodeId];
                            permissionList.AddRange(list);
                        }
                    }

                    var publishmentSystemIdHashtable = new Hashtable();
                    if (publishmentSystemIdList != null)
                    {
                        foreach (var thePublishmentSystemId in publishmentSystemIdList)
                        {
                            publishmentSystemIdHashtable.Add(thePublishmentSystemId, thePublishmentSystemId);
                        }
                    }

                    if (!publishmentSystemIdHashtable.Contains(PublishmentSystemId))
                    {
                        showPublishmentSystem = false;
                    }

                    if (!showPublishmentSystem)
                    {
                        PageUtils.RedirectToErrorPage("您没有此发布系统的操作权限!");
                        return;
                    }

                    var appId = EPublishmentSystemTypeUtils.GetValue(_publishmentSystemInfo.PublishmentSystemType);

                    NtLeftMenuSite.FileName            = $"~/SiteFiles/Configuration/Menus/{appId}/Management.config";
                    NtLeftMenuSite.PublishmentSystemId = _publishmentSystemInfo.PublishmentSystemId;
                    NtLeftMenuSite.PermissionList      = permissionList;

                    ClientScriptRegisterClientScriptBlock("NodeTreeScript", NodeNaviTreeItem.GetNavigationBarScript());
                }
                else
                {
                    if (_permissions.IsSystemAdministrator)
                    {
                        PageUtils.Redirect(PageAppAdd.GetRedirectUrl());
                        return;
                    }
                }
            }
            else if (!string.IsNullOrEmpty(_menuId))
            {
                var permissionList = new List <string>();
                if (ProductPermissionsManager.Current.WebsitePermissionDict.ContainsKey(PublishmentSystemId))
                {
                    var websitePermissionList = ProductPermissionsManager.Current.WebsitePermissionDict[PublishmentSystemId];
                    if (websitePermissionList != null)
                    {
                        permissionList.AddRange(websitePermissionList);
                    }
                }

                permissionList.AddRange(_permissions.PermissionList);
                NtLeftMenuSystem.FileName       = $"~/SiteFiles/Configuration/Menus/{_menuId}.config";
                NtLeftMenuSystem.PermissionList = permissionList;

                ClientScriptRegisterClientScriptBlock("NodeTreeScript", NavigationTreeItem.GetNavigationBarScript());
            }

            var topMenuList = new List <int> {
                1, 2
            };

            //cms超管和有权限的管理员
            if (_permissions.IsConsoleAdministrator || _permissions.PermissionList.Count > 0)
            {
                topMenuList.Add(3);
            }
            RptTopMenu.DataSource     = topMenuList;
            RptTopMenu.ItemDataBound += RptTopMenu_ItemDataBound;
            RptTopMenu.DataBind();

            //update at 20141106,避免空引用异常
            if (_publishmentSystemInfo != null && _publishmentSystemInfo.PublishmentSystemId > 0)
            {
                BaiRongDataProvider.AdministratorDao.UpdatePublishmentSystemId(Body.AdministratorName, _publishmentSystemInfo.PublishmentSystemId);
            }
        }
Example #3
0
        private bool GetPublishmentSystemListHtml(StringBuilder builder)
        {
            var publishmentSystemIdList = ProductPermissionsManager.Current.PublishmentSystemIdList;

            //操作者拥有的站点列表
            var mySystemInfoArrayList = new ArrayList();

            var parentWithChildren = new Hashtable();

            if (ProductPermissionsManager.Current.IsSystemAdministrator)
            {
                foreach (var publishmentSystemId in publishmentSystemIdList)
                {
                    AddToMySystemInfoArrayList(mySystemInfoArrayList, parentWithChildren, publishmentSystemId);
                }
            }
            else
            {
                ICollection nodeIdCollection = ProductPermissionsManager.Current.ChannelPermissionDict.Keys;
                ICollection publishmentSystemIdCollection = ProductPermissionsManager.Current.WebsitePermissionDict.Keys;
                foreach (var publishmentSystemId in publishmentSystemIdList)
                {
                    var showPublishmentSystem = IsShowPublishmentSystem(publishmentSystemId, publishmentSystemIdCollection, nodeIdCollection);
                    if (showPublishmentSystem)
                    {
                        AddToMySystemInfoArrayList(mySystemInfoArrayList, parentWithChildren, publishmentSystemId);
                    }
                }
            }

            if (_permissions.IsConsoleAdministrator)
            {
                var redirectUrl = PageAppAdd.GetRedirectUrl();
                builder.Append(
                    $@"<li style=""background:#eee;""><a href=""{PageUtils.GetLoadingUrl(redirectUrl)}""><i class=""icon-plus icon-large
""></i> 创建新站点</a></li>");

                builder.Append(@"<li class=""divider""></li>");
            }

            if (_hqPublishmentSystemInfo != null || mySystemInfoArrayList.Count > 0)
            {
                if (_hqPublishmentSystemInfo != null)
                {
                    AddSite(builder, _hqPublishmentSystemInfo, parentWithChildren, 0);
                }

                if (mySystemInfoArrayList.Count > 0)
                {
                    var count = 0;
                    foreach (PublishmentSystemInfo publishmentSystemInfo in mySystemInfoArrayList)
                    {
                        if (publishmentSystemInfo.IsHeadquarters == false)
                        {
                            count++;
                            AddSite(builder, publishmentSystemInfo, parentWithChildren, 0);
                        }
                        if (count == 13)
                        {
                            builder.Append(@"<li class=""divider""></li>");
                            builder.Append(
                                $@"<li style=""background:#eee;""><a href=""javascript:;"" onclick=""{ModalPublishmentSystemSelect
                                    .GetOpenLayerString()}""><i class=""icon-search icon-large
                    ""></i> 列出全部站点...</a></li>");
                            break;
                        }
                    }
                }
            }

            //if (builder.Length > 0)
            //{
            //    builder.Append(@"<li class=""divider""></li>");
            //}

            return(_permissions.IsSystemAdministrator || publishmentSystemIdList.Count > 0);
        }