Skip to content

Commit

Permalink
auth: ensure RoleGrantPermission is compatible with older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
tangcong committed Mar 22, 2020
1 parent 0eee733 commit 3d67756
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions auth/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,16 +800,6 @@ func (as *authStore) RoleGrantPermission(r *pb.AuthRoleGrantPermissionRequest) (
})

if idx < len(role.KeyPermission) && bytes.Equal(role.KeyPermission[idx].Key, r.Perm.Key) && bytes.Equal(role.KeyPermission[idx].RangeEnd, r.Perm.RangeEnd) {
if role.KeyPermission[idx].PermType == r.Perm.PermType {
as.lg.Warn(
"ignored grant permission request to a role, existing permission",
zap.String("role-name", r.Name),
zap.ByteString("key", r.Perm.Key),
zap.ByteString("range-end", r.Perm.RangeEnd),
zap.String("permission-type", authpb.Permission_Type_name[int32(r.Perm.PermType)]),
)
return &pb.AuthRoleGrantPermissionResponse{}, nil
}
// update existing permission
role.KeyPermission[idx].PermType = r.Perm.PermType
} else {
Expand Down

0 comments on commit 3d67756

Please sign in to comment.