Giter Site home page Giter Site logo

hequan2017 / go-admin Goto Github PK

View Code? Open in Web Editor NEW
401.0 16.0 92.0 234 KB

go web api,包含gin+gorm+jwt+rbac等。

Home Page: https://github.com/hequan2017/go-admin/

License: MIT License

Go 98.28% Dockerfile 1.72%
go-admin go gin casbin rbac jwt token cmdb devops linux

go-admin's Issues

一个建议,只是一个建议

启动文件 main.go

setting.Setup()
models.Setup()
logging.Setup()
inject.Init()

是否修改成 类似在 setting.go文件

func init() {
}
使用 init 启动比较优雅?

重启出现问题

enforcer, err := casbin.NewEnforcer(path, false)
assignment mismatch: 2 variables but casbin.NewEnforcer returns 1 values
请问如何解决

swag init出错

mba➜  go-admin git:(master) ✗  >swag init
2019/10/21 16:42:50 Generate swagger docs....
2019/10/21 16:42:50 Generate general API Info, search dir:./
2019/10/21 16:42:50 ParseComment error in file routers/api/v1/role.go :can not find schema type: "v1.json"

jwt不应该存放md5密码

token中不能放敏感信息,因为有效载荷是经过Base64编码生成的,并不是加密。所以不能存放敏感信息。

对象权限问题,如何解决?

readme中的例子,可以控制test访问user表,但表里的所有数据都可以访问,如何控制用户只能访问自己的用户数据,比如test用户只能访问自己创建的用户数据?

用户角色关系 应该是多对多

不知道是不是我理解错了。
AddUser方法的role_id 是int类型。不是应该是[]int{}类型吗?
添加用户的时候,用户可属于多角色

sql文件缺失

你好,最近再学习咱们这个项目,但是文档里的域名和sql的链接失效了,可以给补上sql文件吗?谢谢大神

"msg": "Token错误"

curl -X POST "http://127.0.0.1:8000/auth" -H "accept: application/json" -H "Content-Type: application/json" -d "{ "password": "admin", "username": "123456"}"

{
"code": 401,
"data": null,
"msg": "Token错误"
}

Potential case-insensitive import collision

Due to GitHub handle change (to lowercase) for long term purpose, go get may fail fetching github.com/Unknwon/com.
Please consider take some time to update it to github.com/unknwon/com in the go.mod file.
I truly apology for the inconvenience and unintended troubles caused.

作者你好,我是新手,我跑你的项目直接报错,希望能帮我看看。

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x117c4e2]

goroutine 1 [running]:
github.com/casbin/casbin/model.Model.RemoveFilteredPolicy(0xc0003d2120, 0x178722c, 0x1, 0x178722c, 0x1, 0x1, 0xc0004b33c0, 0x1, 0x1, 0xc0003b4180)
/Users/Yang/Desktop/Go/src/github.com/casbin/casbin/model/policy.go:115 +0xc2
github.com/casbin/casbin.(*Enforcer).removeFilteredPolicy(0xc00010e310, 0x178722c, 0x1, 0x178722c, 0x1, 0x1, 0xc0004b33c0, 0x1, 0x1, 0x2f35d80)
/Users/Yang/Desktop/Go/src/github.com/casbin/casbin/internal_api.go:67 +0x9e
github.com/casbin/casbin.(*Enforcer).RemoveFilteredNamedGroupingPolicy(0xc00010e310, 0x178722c, 0x1, 0x1, 0xc0004b33c0, 0x1, 0x1, 0xc0004b33c0)
/Users/Yang/Desktop/Go/src/github.com/casbin/casbin/management_api.go:254 +0x8c
github.com/casbin/casbin.(*Enforcer).RemoveFilteredGroupingPolicy(0xc00010e310, 0x1, 0xc0004b33c0, 0x1, 0x1, 0xc00012e730)
/Users/Yang/Desktop/Go/src/github.com/casbin/casbin/management_api.go:229 +0x68
github.com/casbin/casbin.(*Enforcer).DeleteRole(0xc00010e310, 0xc0004b0570, 0x4)
/Users/Yang/Desktop/Go/src/github.com/casbin/casbin/rbac_api.go:70 +0x82
github.com/hequan2017/go-admin/service/role_service.(*Role).LoadPolicy(0xc0001582a0, 0x1, 0x1, 0x0)
/Users/Yang/Desktop/Go/src/github.com/hequan2017/go-admin/service/role_service/role.go:143 +0x87
github.com/hequan2017/go-admin/service/role_service.(*Role).LoadAllPolicy(0xc0001582a0, 0x8, 0xc0003d21b0)
/Users/Yang/Desktop/Go/src/github.com/hequan2017/go-admin/service/role_service/role.go:128 +0x83
github.com/hequan2017/go-admin/middleware/inject.LoadCasbinPolicyData(0x0, 0x1858c60)
/Users/Yang/Desktop/Go/src/github.com/hequan2017/go-admin/middleware/inject/inject.go:61 +0x3d
main.main()
/Users/Yang/Desktop/Go/src/github.com/hequan2017/go-admin/main.go:33 +0x48
exit status 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.