Esempio n. 1
0
        /// <summary>
        /// 页面对应的审核用户树
        /// </summary>
        /// <param name="pid"></param>
        /// <returns></returns>
        public static List <EasyUiTreeNode> GetPageAuditUsersTree(int pid)
        {
            using (var proxy = new RedisProxy(RedisProxy.DbSystem))
            {
                int friend = proxy.GetValue <int>($"audit:page:link:{pid}");
                if (friend > 0)
                {
                    pid = friend;
                }

                var page = PageItemLogical.GetPageItem(pid);
                if (page == null)
                {
                    return(new List <EasyUiTreeNode>());
                }
                int level;
                if (!page.LevelAudit)
                {
                    level = 0;//BusinessContext.Current.LoginUser.DepartmentId;
                }
                else
                {
                    level = BusinessContext.Current.LoginUser.DepartmentLevel - 1;
                    if (level < 1)
                    {
                        level = 1;
                    }
                    else if (level > 2)
                    {
                        level = 2;
                    }
                }
                return(proxy.Get <List <EasyUiTreeNode> >($"audit:page:users:nodes:{pid}:{level}"));
            }
        }
Esempio n. 2
0
        void AuditNode(RedisProxy proxy, int pageId, List <PositionPersonnelData> users)
        {
            var page = PageItemLogical.GetPageItem(pageId);

            if (!page.LevelAudit)
            {
                var orgs = OrganizationBusinessLogic.LoadAreaTreeForUi(0);
                AuditNode(orgs[0], users);
                proxy.Set($"audit:page:users:nodes:{pageId}:0", orgs);
                proxy.Set($"audit:page:users:ids:{pageId}:0", users.Select(p => p.UserId).LinkToString(","));
                return;
            }
            foreach (var levels in users.GroupBy(p => p.OrgLevel))
            {
                var orgs = OrganizationBusinessLogic.LoadAreaTreeForUi(0);
                AuditNode(orgs[0], levels.ToList());
                if (orgs[0].HaseChildren)
                {
                    foreach (var ch in orgs[0].Children.Where(p => p.Tag != "personnel").ToArray())
                    {
                        if (!ch.HaseChildren)
                        {
                            orgs[0].Children.Remove(ch);
                        }
                    }
                }
                proxy.Set($"audit:page:users:nodes:{pageId}:{levels.Key}", orgs);
                proxy.Set($"audit:page:users:ids:{pageId}:{levels.Key}", levels.Select(p => p.UserId).LinkToString(","));
            }
        }
Esempio n. 3
0
 /// <summary>
 ///     载入页面关联的按钮配置
 /// </summary>
 /// <param name="loginUser">登录用户</param>
 /// <param name="page">页面,不能为空</param>
 /// <returns>按钮配置集合</returns>
 List <string> IPowerChecker.LoadPageButtons(ILoginUser loginUser, IPageItem page)
 {
     if (page == null)
     {
         return(new List <string>());
     }
     return(PageItemLogical.LoadPageButtons(page.Id));
 }
Esempio n. 4
0
 /// <summary>
 ///     载入页面关联的按钮配置
 /// </summary>
 /// <param name="loginUser">登录用户</param>
 /// <param name="page">页面,不能为空</param>
 /// <returns>按钮配置集合</returns>
 List <string> IPowerChecker.LoadPageButtons(ILoginUser loginUser, IPageItem page)
 {
     if (page == null)
     {
         return(new List <string>());
     }
     return(BusinessContext.Current.IsSystemMode
         ? PageItemLogical.LoadPageButtons(page.Id)
         : RoleCache.LoadButtons(loginUser.RoleId, page.ID));
 }
Esempio n. 5
0
        private static PositionDataScopeType DataScope()
        {
            if (BusinessContext.Current.IsSystemMode)
            {
                return(PositionDataScopeType.None);
            }
            var page = BusinessContext.Current.PageItem ?? PageItemLogical.GetPageByDataType(typeof(TData));

            if (page == null)
            {
                return(PositionDataScopeType.None);
            }
            var power =
                BusinessContext.Current.PowerChecker.LoadPagePower(BusinessContext.Current.LoginUser, page) as
                RolePowerData;

            return(power?.DataScope ?? PositionDataScopeType.None);
        }
Esempio n. 6
0
 /// <summary>
 /// 保存页面的动作
 /// </summary>
 void IPowerChecker.SavePageAction(long pageid, string name, string title, string action, string type)
 {
     PageItemLogical.SavePageAction(pageid, name, title, action, type);
 }
Esempio n. 7
0
 /// <summary>
 ///     载入页面配置
 /// </summary>
 /// <param name="url">不包含域名的相对url</param>
 /// <returns>页面配置</returns>
 public IPageItem LoadPageConfig(string url)
 {
     return(PageItemLogical.GetPageItem(url));
 }