eryajf / go-ldap-admin

🌉 基于Go+Vue实现的openLDAP后台管理项目
http://ldapdoc.eryajf.net
Apache License 2.0
1.51k stars 256 forks source link

最新前后端 登录时提示无权限 #322

Closed nameGJ closed 2 months ago

nameGJ commented 5 months ago

您使用的版本? | Your usage version?

go-ldap-admin-v0.5.16 +go-ldap-admin-ui-v0.5.15

743D2F46-13F5-4c15-A92A-17D8B11A3A44

eryajf commented 5 months ago

您好 @nameGJ👋,我已收到您的反馈,我将安排时间考虑您提交的信息并进行回复。-- 这条信息是由自动回复的机器人发出的。

Hello @nameGJ. I have received your feedback, and I will arrange time to consider the information you submitted and reply. -- This message is sent by an automatic reply robot.

eryajf commented 5 months ago

请给出部署的上下文,只给一个这个,没法判断。建议参照docker-compose部署方案,肯定一遍过。

nameGJ commented 5 months ago

我并没有使用docker-compose 而是用的您后端版本发布里的压缩包直接解压运行的 前端我已修改.env.production中的VUE_APP_BASE_API配置项 并且编译部署的

eryajf commented 5 months ago

我并没有使用docker-compose 而是用的您后端版本发布里的压缩包直接解压运行的 前端我已修改.env.production中的VUE_APP_BASE_API配置项 并且编译部署的

那可以看下mysql里的数据,如果里边没有数据,则需要把sql导入一下。sql在 docs/sql/go_ldap_admin.sql

nameGJ commented 5 months ago

已经重新导出数据库 0A8F3E80-7D09-4f54-9B02-D9ABFF75548C

nameGJ commented 5 months ago

这里是日志 20240327113852

Muncan90 commented 2 months ago

已经重新导出数据库 0A8F3E80-7D09-4f54-9B02-D9ABFF75548C

the 401 error in your screenshot is being served by the middleware\CasbinMiddleware.go file which is functioning correctly

https://github.com/eryajf/go-ldap-admin/blob/d4c7ed5e32e56240231ae6da8c655dc16dc341f7/middleware/CasbinMiddleware.go#L46

the root cause is because the current version of the docs/sql/go_ldap_admin.sql file is missing a required casbin rule.

you can add it to the existing database:

INSERT INTO `casbin_rule` (`ptype`, `v0`, `v1`, `v2`, `v3`, `v4`, `v5`)
VALUES ('p', 'admin', '/menu/access/tree', 'GET', '', '', '');

then you should be able to login successfully after an application restart


您截图中的 401 错误是由正常运行的 middleware\CasbinMiddleware.go 文件提供的。

https://github.com/eryajf/go-ldap-admin/blob/d4c7ed5e32e56240231ae6da8c655dc16dc341f7/middleware/CasbinMiddleware.go#L46

根本原因是当前版本的 docs/sql/go_ldap_admin.sql 文件缺少一条必要的 casbin 规则。

您可以将其添加到现有数据库中:

INSERT INTO `casbin_rule` (`ptype`, `v0`, `v1`, `v2`, `v3`, `v4`, `v5`)
VALUES('p'、'admin'、'/menu/access/tree'、'GET'、''、''、'');

然后您就可以在应用程序重启后成功登录了