天涯何

博客园 首页 新随笔 联系 管理

  //验证用户组织架构 string[] orgIds
    protected bool checkeOrg(string[] DepCheckId)
    {
        //根据用户id获取用户所在部门
        H3.Organization.User user = (H3.Organization.User) this.Engine.Organization.GetUnit(userId);//获取用户
        if(user != null) 
        {
            //获取部门集合
            string[] pIds = user.ParentIds;
            if(pIds != null && pIds.Length > 0) 
            {
                //循环用户部门,匹配权限部门
                foreach(string pid in pIds) 
                {
                    //校验权限部门
                    if(!string.IsNullOrEmpty(pid))
                    {
                        if(((IList) DepCheckId).Contains(pid)) return true;
                        //循环获取父部门
                        if(checkeDepart(DepCheckId, pid)) return true;
                    }
                }
            }
        }
        return false;
    }

 

posted on 2022-05-26 16:12  天涯何  阅读(70)  评论(0)    收藏  举报