perf: 将管理员校验的字段改为userid,从而解决普通用户绕过校验的问题 (#175)

This commit is contained in:
二丫讲梵
2023-04-05 16:49:57 +08:00
committed by GitHub
parent 187566dd91
commit 9c85125907
6 changed files with 16 additions and 5 deletions

View File

@@ -57,6 +57,10 @@ func JudgeUsers(s string) bool {
// JudgeAdminUsers 判断用户是否为系统管理员
func JudgeAdminUsers(s string) bool {
// 如果secret或者用户的userid都为空的话那么默认没有管理员
if len(Config.AppSecrets) == 0 || s == "" {
return false
}
// 如果没有指定,则没有人是管理员
if len(Config.AdminUsers) == 0 {
return false