使用指针类型存储白名单、用户名和密码,允许批量传入授权配置

This commit is contained in:
2025-05-19 10:57:56 +08:00
parent 24351e1c56
commit 8c824595f4
3 changed files with 11 additions and 9 deletions

View File

@@ -20,13 +20,15 @@ func Permit(ctx *fiber.Ctx) (err error) {
}
// 获取请求参数
req, err := core.Decrypt[PermitReq](&sec, app.PlatformSecret)
req, err := core.Decrypt[[]PermitReq](&sec, app.PlatformSecret)
if err != nil {
return err
}
// 保存授权配置
app.Permits.Store(req.Id, &req.Permit)
for _, permit := range *req {
app.Permits.Store(permit.Id, &permit.Permit)
}
return nil
}