Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make sure that:
Closes #1847.
@mp911de this is my attempt at fixing the bug #1847. I added internal private classes that represent each type of argument and they all inherit from a private interface
SetuserArg
, which has abuild
method that adds the argument.AclSetuserArgs
then just maintains aList
ofSetuserArg
which allows for maintaining order when adding arguments.A few other things fixed in this change:
AclSetuserArgs
was always adding theoff
argument if none ofon()
oroff()
were called. This could result in a bug where a user of the client would expect something likeAclSetuserArgs.Builder.addPassword("pass")
to not change the on/off state. Now,on
oroff
arguments will only be added if they are added to the builder.reset()
option onAclSetuserArgs
, then no other arguments would be added to the command. Redis allows for a command like:acl setuser test reset on +hello
. Such a command would first reset the user to a newly created state, and then turn it on and allow thehello
command. This has been fixed so that any commands can be included with thereset
command.resetpass
argument was missing, I have added that argument here as well.Please let me know what you think about this change. Thank you!