This commit is contained in:
aozhiwei 2024-08-04 10:57:41 +08:00
parent bbb1012d13
commit aa1b9442da

View File

@ -41,22 +41,18 @@ func (this *PermissionTable) Load() {
this.loadUser() this.loadUser()
} }
func (this *PermissionTable) CheckAPIPermission(account string, cmd string) bool { func (this *PermissionTable) CheckAPIPermission(accountAddress string, cmd string) bool {
if account == "" || cmd == "" { u, exist := this.userHash.Load(accountAddress)
return false
}
accper, exist := this.userHash.Load(account)
if !exist { if !exist {
return false return false
} }
ret, exist := (*accper).api.Load(cmd) ret, exist := (*u).api.Load(cmd)
if exist { if exist {
return *ret return *ret
} }
ret, exist = (*accper).api.Load(constant.FULL_PERMISSION) ret, exist = (*u).api.Load(constant.FULL_PERMISSION)
if exist { if exist {
return *ret return *ret
} }