DDD领域模型数据访问权限(九)

权限分为:数据权限和功能权限

数据权限:

查询提供附加表达式的支持:

//提供附加表达式的支持
        List<TAggreateRoot> GetByCondition(Expression<Func<TAggreateRoot, bool>> condition,
        Expression<Func<TAggreateRoot,bool>> definecondition);
        //返回聚合根分页的方法
        List<TAggreateRoot> GetByConditionPages(Expression<Func<TAggreateRoot, bool>> condition,
            Expression<Func<TAggreateRoot, bool>> definecondition,
            RequestPage request, out int totalcount);
        List<TAggreateRoot> GetByConditionPages(List<Conditions> condition, 
            Expression<Func<TAggreateRoot, bool>> definecondition,
            RequestPage request, out int totalcount);
        List<TDTO> GetByCondition<TDTO>(Expression<Func<TAggreateRoot, bool>> condition,
            Expression<Func<TAggreateRoot, bool>> definecondition);
        List<TDTO> GetByConditionPages<TDTO>(Expression<Func<TAggreateRoot, bool>> condition,
            Expression<Func<TAggreateRoot, bool>> definecondition,
    RequestPage request, out int totalcount);
        List<TDTO> GetByConditionPages<TDTO>(List<Conditions> condition, 
            Expression<Func<TAggreateRoot, bool>> definecondition,
RequestPage request, out int totalcount);

不需要查询条件的写法: 

 var query = orderdbcontext.Set<TAggreateRoot>().Where(condition.And(definecondition));

 在工程DDD.Domain新建文件夹ModelPermission: BAS_Department类

  public partial class BAS_Department:AggreateRoot
    {
        private IRepository<BAS_Department> irepository;
        public BAS_Department(IRepository<BAS_Department> irepository)
        {
            this.irepository = irepository;
        }

        /// <summary>
        /// 创建部门对象
        /// </summary>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="con_id"></param>
        public void CreateDepartment(string name,string description,Guid con_id)
        {
            var bas_department = new BAS_Department();
            bas_department.Id = base.Id;
            bas_department.Name = name;
            bas_department.Description = description;
            bas_department.Con_Id = con_id;
            irepository.Create(bas_department);
        }

        /// <summary>
        /// 根据部门名称返回部门对象
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public BAS_Department GetDepartmentByName(string name)
        {
            return irepository.GetByCondition(p => p.Name == name, p => true).SingleOrDefault();
        }
    }

 BAS_DR类:

 

 public partial class BAS_DR:AggreateRoot
    {
        private IRepository<BAS_DR> irepository;
        public BAS_DR(IRepository<BAS_DR> irepository)
        {
            this.irepository = irepository;
        }
        public BAS_DR() { }

        /// <summary>
        /// 创建DR对象,将多个部门添加到角色中
        /// </summary>
        /// <param name="departments"></param>
        /// <param name="role"></param>
        public void CreateBAS_DR(List<BAS_Department> departments,BAS_Role role)
        {
            foreach(var department in departments)
            {
                var bas_dr = new BAS_DR();
                bas_dr.Id = base.Id;
                bas_dr.BAS_Department = department;
                bas_dr.BAS_Role = role;
                irepository.Create(bas_dr);
            }
        }

        /// <summary>
        /// 根据部门对象获取对应的DR信息
        /// </summary>
        /// <param name="department"></param>
        /// <returns></returns>
        public List<BAS_DR> GetDRSByDepartment(BAS_Department department)
        {
            return irepository.GetByCondition(p => p.BAS_Department.Id == department.Id,p=>true);
        }

        /// <summary>
        /// 根据角色对象获取对应的DR信息
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        public List<BAS_DR> GetDRSByRole(BAS_Role role)
        {
            return irepository.GetByCondition(p => p.BAS_Role.Id == role.Id, p => true);
        }
    }
}

 

 BAS_IdentityContainer类:

  public partial class BAS_IdentityContianer:AggreateRoot
    {
        private IRepository<BAS_IdentityContianer> irepository;
        public BAS_IdentityContianer(IRepository<BAS_IdentityContianer> irepository)
        {
            this.irepository = irepository;
        }

        /// <summary>
        /// 创建标识容器对象
        /// </summary>
        /// <param name="con_id"></param>
        public void CreateIdentityContainer(Guid con_id)
        {
            var bas_identitycontainer = new BAS_IdentityContianer();
            bas_identitycontainer.Id = con_id;
            irepository.Create(bas_identitycontainer);
        }

       
    }

 BAS_Post类:

    public partial class BAS_Post:AggreateRoot
    {
        private IRepository<BAS_Post> irepository;
        public BAS_Post(IRepository<BAS_Post> irepository)
        {
            this.irepository = irepository;
        }

        /// <summary>
        /// 创建岗位对象
        /// </summary>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="con_id"></param>
        public void CreatePost(string name,string description,Guid con_id)
        {
            var bas_post = new BAS_Post();
            bas_post.Id = base.Id;
            bas_post.Name = name;
            bas_post.Description = description;
            bas_post.Con_Id = con_id;
            irepository.Create(bas_post);
        }

        /// <summary>
        /// 根据岗位名返回岗位对象
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public BAS_Post GetPostByName(string name)
        {
            return irepository.GetByCondition(p => p.Name == name, p => true).SingleOrDefault();
        }
    }

 BAS_PR类:

public partial class BAS_PR:AggreateRoot
    {
        public IRepository<BAS_PR> irepository;
        public  BAS_PR(IRepository<BAS_PR> irepository)
        {
            this.irepository = irepository;
        }

        public BAS_PR() { }

        /// <summary>
        /// 创建PR对象,将多个岗位添加到角色中
        /// </summary>
        /// <param name="posts"></param>
        /// <param name="role"></param>
        public void CreateBAS_PR(List<BAS_Post> posts,BAS_Role role)
        {
            foreach(var post in posts)
            {
                var bas_pr = new BAS_PR();
                bas_pr.Id = base.Id;
                bas_pr.BAS_Post = post;
                bas_pr.BAS_Role = role;
                irepository.Create(bas_pr);
            }
        }

        /// <summary>
        /// 根据岗位对象获取PR信息
        /// </summary>
        /// <param name="post"></param>
        /// <returns></returns>
        public List<BAS_PR> GetPRSByPost(BAS_Post post)
        {
            return irepository.GetByCondition(p => p.BAS_Post.Id == post.Id, p => true);
        }

        /// <summary>
        /// 根据角色对象获取PR信息
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        public List<BAS_PR> GetPRSByRole(BAS_Role role)
        {
            return irepository.GetByCondition(p => p.BAS_Role.Id == role.Id, p => true);
        }
    }

 BAS_Role类:

 public partial class BAS_Role:AggreateRoot
    {
        private IRepository<BAS_Role> irepository;
        public BAS_Role(IRepository<BAS_Role> irepository)
        {
            this.irepository = irepository;
        }

        /// <summary>
        /// 创建角色对象
        /// </summary>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="con_id"></param>
        public void CreateRole(string name,string description,Guid con_id)
        {
            var bas_role = new BAS_Role();
            bas_role.Id = base.Id;
            bas_role.Name = name;
            bas_role.Description = description;
            bas_role.Con_Id = con_id;
            irepository.Create(bas_role);
        }
        /// <summary>
        /// 根据角色名返回角色对象
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public BAS_Role GetRoleByName(string name)
        {
            return irepository.GetByCondition(p => p.Name == name, p => true).SingleOrDefault();
        }
    }
}

   BAS_UDPSet类:

public partial class BAS_UDPSet:AggreateRoot
    {
        private IRepository<BAS_UDPSet> irepository;
        public BAS_UDPSet(IRepository<BAS_UDPSet> irepository)
        {
            this.irepository = irepository;
        }

        public BAS_UDPSet() { }

        /// <summary>
        /// 创建UDP对象,将用户添加到某个部门某个岗位
        /// </summary>
        /// <param name="user"></param>
        /// <param name="department"></param>
        /// <param name="post"></param>
        /// <param name="ismain">是否为主部门主岗位</param>
        public void CreateDepartmentPostToUser(BAS_User user,BAS_Department department,
            BAS_Post post,bool ismain)
        {
            var udp = new BAS_UDPSet();
            udp.Id = base.Id;
            udp.BAS_Department = department;
            udp.BAS_Post = post;
            udp.BAS_User = user;
            udp.IsMain = ismain;
            irepository.Create(udp);
        }

        /// <summary>
        /// 根据部门获取对应的UDP信息
        /// </summary>
        /// <param name="department"></param>
        /// <returns></returns>
        public List<BAS_UDPSet> GetUDPByDepartment(BAS_Department department)
        {
            return irepository.GetByCondition(p => p.BAS_Department.Id == department.Id,
                p => true);
        }

        /// <summary>
        /// 根据用户获取对应的UDP信息
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public List<BAS_UDPSet> GetUDPByUser(BAS_User user)
        {
            return irepository.GetByCondition(p => p.BAS_User.Id == user.Id, p => true);
        }

        /// <summary>
        /// 根据岗位获取对应的UDP信息
        /// </summary>
        /// <param name="post"></param>
        /// <returns></returns>
        public List<BAS_UDPSet> GetUDPByPost(BAS_Post post)
        {
            return irepository.GetByCondition(p => p.BAS_Post.Id == post.Id, p => true);
        }
    }

 BAS_UR类:

   public partial class BAS_UR:AggreateRoot
    {
        private IRepository<BAS_UR> irepository;
        public BAS_UR(IRepository<BAS_UR> irepository)
        {
            this.irepository = irepository;
        }
        public BAS_UR() { }

        /// <summary>
        /// 创建UR对象,将多个用户添加到角色中
        /// </summary>
        /// <param name="users"></param>
        /// <param name="role"></param>
        public void CreateBAS_UR(List<BAS_User> users,BAS_Role role)
        {
            foreach(var user in users)
            {
                var bas_ur = new BAS_UR();
                bas_ur.Id = base.Id;
                bas_ur.BAS_User = user;
                bas_ur.BAS_Role = role;
                irepository.Create(bas_ur);
            }
        }
        /// <summary>
        /// 根据用户对象获取对应的UR信息
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public List<BAS_UR> GetURSByUser(BAS_User user)
        {
            return irepository.GetByCondition(p => p.BAS_User.Id == user.Id, p => true);
        }

        public List<BAS_UR> GetURSByRole(BAS_Role role)
        {
            return irepository.GetByCondition(p => p.BAS_Role.Id == role.Id, p => true);
        }
    }

 BAS_User类:

  public partial class BAS_User:AggreateRoot
    {
        private IRepository<BAS_User> irepository;
        public BAS_User(IRepository<BAS_User> irepository)
        {
            this.irepository = irepository;
        }

        /// <summary>
        /// 在仓储中创建用户对象
        /// </summary>
        /// <param name="no"></param>
        /// <param name="name"></param>
        /// <param name="mobile"></param>
        /// <param name="con_id"></param>
        /// <param name="password"></param>
        public void CreateUser(string no,string name,string mobile,Guid con_id,string password)
        {
            BAS_User bas_user = new BAS_User();
            bas_user.Id = base.Id;
            bas_user.No = no;
            bas_user.Name = name;
            bas_user.Mobile = mobile;
            bas_user.Con_Id = con_id;
            var userlogin = new BAS_UserLogin(password);
            bas_user.BAS_UserLogin = userlogin;
            irepository.Create(bas_user);
        }

        /// <summary>
        /// 根据用户NO返回用户对象
        /// </summary>
        /// <param name="no"></param>
        /// <returns></returns>
        public BAS_User GetUserByNo(string no)
        {
            return irepository.GetByCondition(p => p.No == no, p => true).SingleOrDefault();
        }

        /// <summary>
        /// 用户登录验证
        /// </summary>
        /// <param name="userno"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public bool LoginVerify(string userno,string password)
        {
            return irepository.GetByCondition(p => p.No == No && p.BAS_UserLogin.Password == password,
                p => true).Count == 1;
        }
    }

 BAS_UserLogin类:

 public partial class BAS_UserLogin:ValueObject
    {
        public BAS_UserLogin(string password)
        {
            Id = base.Id;
            Password = password;
        }
    }

 部门的领域服务:BAS_DepartmentService

 public class BAS_DepartmentService
    {
        private IRepository<BAS_Department> irepositorydepartment;
        private IRepository<BAS_IdentityContianer> irepositoryidentitycontainer;
        private IRepository<BAS_UDPSet> irepositoryudp;
        private IRepository<BAS_User> irepositoryuser;

        public BAS_DepartmentService(IRepository<BAS_Department> irepositorydepartment,
        IRepository<BAS_IdentityContianer> irepositoryidentitycontainer,
        IRepository<BAS_UDPSet> irepositoryudp,
        IRepository<BAS_User> irepositoryuser)
        {
            this.irepositorydepartment = irepositorydepartment;
            this.irepositoryidentitycontainer = irepositoryidentitycontainer;
            this.irepositoryudp = irepositoryudp;
            this.irepositoryuser = irepositoryuser;
        }

        /// <summary>
        /// 协调创建部门与标识容器对象
        /// </summary>
        /// <param name="name"></param>
        /// <param name="description"></param>
        public void CreateDepartment(string name,string description)
        {
            var bas_department = new BAS_Department(irepositorydepartment);
            var con_id = Guid.NewGuid();
            bas_department.CreateDepartment(name, description, con_id);

            var bas_identitycontainer = new BAS_IdentityContianer(irepositoryidentitycontainer);
            bas_identitycontainer.CreateIdentityContainer(con_id);
        }

        public List<BAS_Department> GetDepartmentByUserNo(string no)
        {
            var udps = new BAS_UDPService(irepositoryudp, irepositoryuser,
                irepositorydepartment, null).GetUdpByUser(no);
            var departments = new List<BAS_Department>();
            foreach(var udp in udps)
            {
                var department = irepositorydepartment.GetByCondition(p => p.Id == udp.BAS_Department.Id, p => true).SingleOrDefault();
                departments.Add(department);
            }
            return departments;
        }
    }
中间服务UDP:BAS_UDPService
public class BAS_UDPService
    {
        private IRepository<BAS_UDPSet> irepositoryudp;
        private IRepository<BAS_User> irepositoryuser;
        private IRepository<BAS_Department> irepositorydepartment;
        private IRepository<BAS_Post> irepositorypost;
        BAS_UDPSet udp;
        public BAS_UDPService( IRepository<BAS_UDPSet> irepositoryudp,
        IRepository<BAS_User> irepositoryuser,
        IRepository<BAS_Department> irepositorydepartment,
        IRepository<BAS_Post> irepositorypost)
        {
            this.irepositoryudp = irepositoryudp;
            this.irepositoryuser = irepositoryuser;
            this.irepositorydepartment = irepositorydepartment;
            this.irepositorypost = irepositorypost;

            udp = new BAS_UDPSet(irepositoryudp);
        }

        /// <summary>
        /// 将用户添加到部门和岗位
        /// </summary>
        /// <param name="userno"></param>
        /// <param name="departmentname"></param>
        /// <param name="postname"></param>
        /// <param name="ismain"></param>
        public void CreateDepartmentPostToUser(string userno,string departmentname,
            string postname,bool ismain)
        {
            var user = irepositoryuser.GetByCondition(p => p.No == userno, p => true).SingleOrDefault();
            var department = irepositorydepartment.GetByCondition(p => p.Name == departmentname,
                p => true).SingleOrDefault();
            var post = irepositorypost.GetByCondition(p => p.Name == postname, p => true).SingleOrDefault();
            udp.CreateDepartmentPostToUser(user, department, post,ismain);
        }

        /// <summary>
        /// 根据部门名获取UDP信息
        /// </summary>
        /// <param name="departmentname"></param>
        /// <returns></returns>
        public List<BAS_UDPSet> GetUdpByDepartment(string departmentname)
        {
            var department = irepositorydepartment.GetByCondition(
                p => p.Name == departmentname, p => true).SingleOrDefault();
            return udp.GetUDPByDepartment(department);
        }

        /// <summary>
        /// 根据用户NO获取UDP信息
        /// </summary>
        /// <param name="userno"></param>
        /// <returns></returns>
        public List<BAS_UDPSet> GetUdpByUser(string userno)
        {
            var user = irepositoryuser.GetByCondition(p => p.No == userno, p => true).SingleOrDefault();
            return udp.GetUDPByUser(user);
        }

        /// <summary>
        /// 根据岗位名获取UDP信息
        /// </summary>
        /// <param name="postname"></param>
        /// <returns></returns>
        public List<BAS_UDPSet> GetUdpByPost(string postname)
        {
            var post =
                irepositorypost.GetByCondition(p => p.Name == postname, p => true).SingleOrDefault();
            return udp.GetUDPByPost(post);
        }
    }
 
 

岗位BAS_PostService服务:

 public class BAS_PostService
    {
        private IRepository<BAS_Post> irepositorypost;
        private IRepository<BAS_IdentityContianer> irepositoryidentitycontianer;
        private IRepository<BAS_User> irepositoryuser;
        private IRepository<BAS_UDPSet> irepositoryudp;

        public BAS_PostService(IRepository<BAS_Post> irepositorypost
            ,IRepository<BAS_IdentityContianer> irepositoryidentitycontianer,
        IRepository<BAS_User> irepositoryuser,
        IRepository<BAS_UDPSet> irepositoryudp)
        {
            this.irepositorypost = irepositorypost;
            this.irepositoryidentitycontianer = irepositoryidentitycontianer;
            this.irepositoryuser = irepositoryuser;
            this.irepositoryudp = irepositoryudp;
        }

        /// <summary>
        /// 创建岗位
        /// </summary>
        /// <param name="name"></param>
        /// <param name="description"></param>
        public void CreatePost(string name,string description)
        {
            var bas_post = new BAS_Post(irepositorypost);
            var con_id = Guid.NewGuid();
            bas_post.CreatePost(name, description, con_id);

            var bas_identitycontainer = new BAS_IdentityContianer(irepositoryidentitycontianer);
            bas_identitycontainer.CreateIdentityContainer(con_id);
        }

        /// <summary>
        /// 通过用户NO获取用户岗位信息
        /// </summary>
        /// <param name="no"></param>
        /// <returns></returns>
        public List<BAS_Post> GetPostsByUserNO(string no)
        {
            var udps = new BAS_UDPService(irepositoryudp, irepositoryuser, null, irepositorypost)
                .GetUdpByUser(no);
           
            var posts =new List<BAS_Post>(); 
            foreach(var udp in udps)
            {
                var post = irepositorypost.GetByCondition(p => p.Id == udp.BAS_Post.Id, p => true)
                    .SingleOrDefault();
                posts.Add(post);
            }
            return posts;
        }
    }

 BAS_DRService 角色

 

  public class BAS_DRService
    {
        private IRepository<BAS_Department> irepositorydepartment;
        private IRepository<BAS_Role> irepositoryrole;
        private IRepository<BAS_DR> irepositorydr;
        BAS_DR bas_dr;

        public BAS_DRService(IRepository<BAS_Department> irepositorydepartment,
        IRepository<BAS_Role> irepositoryrole,
        IRepository<BAS_DR> irepositorydr)
        {
            this.irepositorydepartment = irepositorydepartment;
            this.irepositoryrole = irepositoryrole;
            this.irepositorydr = irepositorydr;

            bas_dr = new BAS_DR(irepositorydr);
        }

        /// <summary>
        /// 将多个部门添加到角色中
        /// </summary>
        /// <param name="departmentnames"></param>
        /// <param name="rolename"></param>
        public void CreateBAS_DR(string [] departmentnames,string rolename)
        {
            var listdepartment = new List<BAS_Department>();
            for(int i=0;i<departmentnames.Length;i++)
            {
                var department =
                    irepositorydepartment.GetByCondition(p => p.Name == departmentnames[i]
                    , p => true).SingleOrDefault();
                listdepartment.Add(department);
            }

            var role = irepositoryrole.GetByCondition(p => p.Name == rolename, p => true).SingleOrDefault();

            bas_dr.CreateBAS_DR(listdepartment, role);
        }

       
        /// <summary>
        /// 根据部门名获取DR信息
        /// </summary>
        /// <param name="departmentname"></param>
        /// <returns></returns>
        public List<BAS_DR> GetDRSByDepartmentName(string departmentname)
        {
            var department =
                irepositorydepartment.GetByCondition(p => p.Name == departmentname, p => true)
                .SingleOrDefault();
            return bas_dr.GetDRSByDepartment(department);
        }

        /// <summary>
        /// 根据角色名获取DR信息
        /// </summary>
        /// <param name="rolename"></param>
        /// <returns></returns>
        public List<BAS_DR> GetDRSbyRoleName(string rolename)
        {
            var role =
                irepositoryrole.GetByCondition(p => p.Name == rolename, p => true).SingleOrDefault();
            return bas_dr.GetDRSByRole(role);
        }

      
    }

 

  多个用户添加到角色 BAS_URService:

 

public class BAS_URService
    {
        private IRepository<BAS_User> irepositoryuser;
        private IRepository<BAS_Role> irepositoryrole;
        private IRepository<BAS_UR> irepositoryur;
        BAS_UR bas_ur;
        public BAS_URService(IRepository<BAS_User> irepositoryuser,
        IRepository<BAS_Role> irepositoryrole,
        IRepository<BAS_UR> irepositoryur)
        {
            this.irepositoryuser = irepositoryuser;
            this.irepositoryrole = irepositoryrole;
            this.irepositoryur = irepositoryur;
            bas_ur = new BAS_UR(irepositoryur);
        }

        /// <summary>
        /// 将多个用户添加到角色
        /// </summary>
        /// <param name="usernos"></param>
        /// <param name="rolename"></param>
        public void CreateBAS_UR(string[] usernos,string rolename)
        {
            var listuser = new List<BAS_User>();
            for(int i=0;i<usernos.Length;i++)
            {
                var user = irepositoryuser.GetByCondition(p => p.No == usernos[i], p => true)
                    .SingleOrDefault();
                listuser.Add(user);
            }

            var role = irepositoryrole.GetByCondition(p => p.Name == rolename, p => true).SingleOrDefault();

            bas_ur.CreateBAS_UR(listuser, role);

        }

     

        /// <summary>
        /// 根据用户No获取UR
        /// </summary>
        /// <param name="userno"></param>
        /// <returns></returns>
        public List<BAS_UR> GetURSByUserNo(string userno)
        {
            var user = irepositoryuser.GetByCondition(p => p.No == userno, p => true).SingleOrDefault();
            return bas_ur.GetURSByUser(user);
        }


      
        /// <summary>
        /// 根据角色名获取UR
        /// </summary>
        /// <param name="rolename"></param>
        /// <returns></returns>
        public List<BAS_UR> GetURsByRoleName(string rolename)
        {
            var role = irepositoryrole.GetByCondition(p => p.Name == rolename, p => true)
                .SingleOrDefault();
            return bas_ur.GetURSByRole(role);
        }

      
    }

 

 

 

 

 

 
 

 

转载于:https://www.cnblogs.com/sunliyuan/p/7862690.html

【实例简介】 项目采用经典DDD架构(用沃恩.弗农大神的话,其实这是DDD-Lite)思想进行开发,简洁而不简单,实用至上,并且所写每一行代码都经过深思熟虑,符合SOLID规则! ####当前版本 3.0 alpha版(2017-2-7) 采用全新工作流,实现自定义表单处理; 2.0版(2016-10-31) 支持多流程模板; 增加Ace admin界面支持 秀外 输入图片说明 输入图片说明 输入图片说明 慧中 教科书级的分层思想,哪怕苛刻的你阅读的是大神级精典大作(如:《企业应用架构模式》《重构与模式》《ASP.NET设计模式》等),你也可以参考本项目。不信?有图为证,Resharper自动生成的项目引用关系,毫无PS痕迹! 输入图片说明 实用 符合国情的RBAC(基于角色的访问控制),可以直接应用到你的系统权限资源 菜单权限 经理和业务员登陆系统拥有的功能菜单是不一样的 按钮权限 经理能够审批,而业务员不可以 数据权限 A业务员看不到B业务员的单据 字段权限 某些人查询客户信息时看不到客户的手机号或其它字段 用户应用系统的具体操作者,我这里设计用户是可以直接给用户分配菜单/按钮,也可以通过角色分配权限。 角色为了对许多拥有相似权限的用户进行分类管理,定义了角色的概念,以上所有的权限资源都可以分配给角色,角色和用户N:N的关系。 机构树形的公司部门结构,国内公司用的比较多,它实际上就是一个用户组,机构和用户设计成N:N的关系,也就是说有时候一个用户可以从属于两个部门,这种情况在我们客户需求中的确都出现过。 ####系统工程结构: OpenAuth.Domain 系统领域层 OpenAuth.Repository 系统仓储层,用于数据库操作 OpenAuth.App 应用层,为界面提供接口 OpenAuth.Mvc 采用基于jquery与bootstrap的B-JUI界面 OpenAuth.UnitTest 单元测试 Infrastructure 通用工具集合 ####使用 管理员可直接在登录界面点击基于精典DDD权限管理 - 点击以开发者账号登录登录; 普通应用账号使用:test(密码:test)登录; ####后续 更多狂野的功能,正在玩命加载中,敬请期待... 更多文档正在整理中.... 当然,如果你想学习完整的DDD框架,可以参考我的另一个项目(BestQ&A--开源中国推荐项目/集CQRS AES等DDD高级特性于一体的问答系统) 【实例截图】
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值