Beispiel #1
0
        /// <summary>
        /// 获取用户下所有权限
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public object GetUserPermission(string userid)
        {
            var user = _userinfoRepository.Get(userid);

            if (user == null)
            {
                return new { error = "用户不存在" }
            }
            ;

            var usergroup = _userGroupRepository.GetUserGroupByUser(user.Id, user.UserName).items
                            .MapperToOutPut <UserGroupOutputDto>();

            var rolegroup = _roleGroupRepository.GetRoleGroupByUser(user.Id, user.UserName).items
                            .MapperToOutPut <RoleGroupOutputDto>();

            var powergroup = _powerGroupRepository.GetPowerGroupByUser(user.Id, user.UserName).items
                             .MapperToOutPut <PowerGroupOutputDto>();

            var role = _roleInfoRepository.GetRoleByUser(user.Id, user.UserName).items
                       .MapperToOutPut <RoleInfoOutputDto>();

            var power = _powerInfoRepository.GetPowerByUser(user.Id, user.UserName).items
                        .MapperToOutPut <PowerInfoOutputDto>();

            var menu = _menuInfoRepository.GetMenuByUser(user.Id, user.UserName).items
                       .MapperToOutPut <MenuInfoOutputDto>();

            var operate = _operateInfoRepository.GetOperateByUser(user.Id, user.UserName).items
                          .MapperToOutPut <OperateInfoOutputDto>();

            return(new
            {
                usergroup,
                rolegroup,
                powergroup,
                role,
                power,
                menu,
                operate
            });
        }
    }
Beispiel #2
0
        /// <summary>
        /// 根据用户Id或名称,遍历关联角色
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public Pages <List <RoleInfoOutputDto> > GetRoleByUser(UserInfoInputDto input)
        {
            var data = _roleInfoRepository.GetRoleByUser(input.id, input.username, input.parentid, input.pageindex, input.pagesize);

            return(new Pages <List <RoleInfoOutputDto> >(data.items.MapperToOutPut <RoleInfoOutputDto>()?.ToList(), data.count));
        }