Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance ACL WHOAMI command to display active ACL rules for the current connection #1821

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from

Conversation

hwware
Copy link
Member

@hwware hwware commented Mar 5, 2025

Current ACL WHOAMI can only display the username for the current connection.
It need to call ACL LIST to get the active ACL rules, thus there are 2 disadvantages:

  1. CALL 2 commands to get ACL rules for the current connection
  2. ACL LIST will display all users and their ACL rules, it is not necessary,

This PR allows the current connection to call once "ACL WHOAMI FULL" to get all information.

@hwware hwware added enhancement New feature or request needs-doc-pr This change needs to update a documentation page. Remove label once doc PR is open. labels Mar 5, 2025
@hwware hwware force-pushed the acl-WHOAMI-extension branch from a88175a to 8b23382 Compare March 5, 2025 16:12
Copy link

codecov bot commented Mar 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.98%. Comparing base (2c9db1a) to head (8b23382).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1821      +/-   ##
============================================
- Coverage     71.03%   70.98%   -0.05%     
============================================
  Files           123      123              
  Lines         65665    65672       +7     
============================================
- Hits          46645    46618      -27     
- Misses        19020    19054      +34     
Files with missing lines Coverage Δ
src/acl.c 90.74% <100.00%> (+0.04%) ⬆️
src/commands.def 100.00% <ø> (ø)

... and 12 files with indirect coverage changes

Copy link
Collaborator

@hpatro hpatro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the use case for this ?

if (c->user != NULL) {
addReplyBulkCBuffer(c, c->user->name, sdslen(c->user->name));
if (c->argc == 3) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally don't like variadic arguments that change the type of response. So would also somewhat prefer another command.

Also, do we want this to be a variant of ACL GETUSER instead? Somewhat related to this issue, #1807.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another command? you mean a new command? I am afraid the user need to remember one more.
I guess this command is not same as ACL GETUSER, because this command only apply to current connection, even user do not know the username either.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this command is not same as ACL GETUSER, because this command only apply to current connection, even user do not know the username either.

A new command, like ACL GETMYSELF, is what I'm suggesting. I agree it's one more command.

@hwware
Copy link
Member Author

hwware commented Mar 6, 2025

What's the use case for this ?

As the top comment describe, I thought

@hpatro
Copy link
Collaborator

hpatro commented Mar 6, 2025

What's the use case for this ?

As the top comment describe, I thought

I mean it's not an expensive operation and don't see what's the pain behind doing it one after another.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-doc-pr This change needs to update a documentation page. Remove label once doc PR is open.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants