auth: remove the special checking case for key auth

This commit is contained in:
Xiang Li
2016-06-13 13:18:22 -07:00
parent 9be65414eb
commit 390c89b7f9
2 changed files with 0 additions and 26 deletions

View File

@ -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 {

View File

@ -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
}