auth: remove the special checking case for key auth
This commit is contained in:
@ -100,9 +100,6 @@ func getMergedPerms(tx backend.BatchTx, userName string) *unifiedRangePermission
|
||||
}
|
||||
|
||||
for _, perm := range role.KeyPermission {
|
||||
if len(perm.RangeEnd) == 0 {
|
||||
continue
|
||||
}
|
||||
rp := &rangePerm{begin: perm.Key, end: perm.RangeEnd}
|
||||
|
||||
switch perm.PermType {
|
||||
|
@ -560,29 +560,6 @@ func (as *authStore) isOpPermitted(userName string, key, rangeEnd []byte, permTy
|
||||
return false
|
||||
}
|
||||
|
||||
if len(rangeEnd) == 0 {
|
||||
for _, roleName := range user.Roles {
|
||||
role := getRole(tx, roleName)
|
||||
if role == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, perm := range role.KeyPermission {
|
||||
if !bytes.Equal(perm.Key, key) {
|
||||
continue
|
||||
}
|
||||
|
||||
if perm.PermType == authpb.READWRITE {
|
||||
return true
|
||||
}
|
||||
|
||||
if permTyp == perm.PermType {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if as.isRangeOpPermitted(tx, userName, key, rangeEnd, permTyp) {
|
||||
return true
|
||||
}
|
||||
|
Reference in New Issue
Block a user