Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
cunla committed Dec 24, 2024
1 parent c07c998 commit 3c39ab0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions fakeredis/_msgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@

NO_PERMISSION_ERROR = "NOPERM User {} has no permissions to run the '{}' command"
NO_PERMISSION_KEY_ERROR = "NOPERM No permissions to access a key"
NO_PERMISSION_CHANNEL_ERROR = "NOPERM No permissions to access a channel"

# Command flags
FLAG_NO_SCRIPT = "s" # Command not allowed in scripts
Expand Down
6 changes: 3 additions & 3 deletions fakeredis/model/_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ def validate_command(self, username: bytes, client_info: bytes, fields: List[byt
if len(keys_not_allowed) > 0:
self.add_log_record(b"key", b"toplevel", keys_not_allowed[0], username, client_info)
raise SimpleError(msgs.NO_PERMISSION_KEY_ERROR)
if "@pubsub" in command_info[6]:
if b"@pubsub" in command_info[6]:
channels_not_allowed = user_acl.channels_not_allowed(command_info, fields)
if len(channels_not_allowed) > 0:
self.add_log_record(b"key", b"toplevel", keys_not_allowed[0], username, client_info)
raise SimpleError(msgs.NO_PERMISSION_KEY_ERROR)
self.add_log_record(b"channel", b"toplevel", channels_not_allowed[0], username, client_info)
raise SimpleError(msgs.NO_PERMISSION_CHANNEL_ERROR)

0 comments on commit 3c39ab0

Please sign in to comment.