0
0
Redisquery~10 mins

ACL system for user permissions in Redis - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - ACL system for user permissions
Start: Define Users and Roles
Assign Permissions to Roles
Assign Roles to Users
User Requests Access
Check User's Roles
Check Permissions in Roles
Allow or Deny Access
The ACL system starts by defining users and roles, assigning permissions to roles, then roles to users. When a user requests access, the system checks their roles and permissions to allow or deny access.
Execution Sample
Redis
ACL SETUSER alice on >password ~* +GET +SET
ACL SETUSER bob on >bobpass ~* +GET
ACL CAT alice
ACL WHOAMI
This code creates two users with different permissions, lists alice's permissions, and checks the current user.
Execution Table
StepCommandActionResultNotes
1ACL SETUSER alice on >password ~* +GET +SETCreate user alice with GET and SET permissionsUser alice created and enabledUser alice can GET and SET
2ACL SETUSER bob on >bobpass ~* +GETCreate user bob with GET permission onlyUser bob created and enabledUser bob can only GET
3ACL CAT aliceList alice's permissionsPermissions: GET, SETShows alice's allowed commands
4ACL WHOAMIShow current userOutput: defaultNo user authenticated yet
5AUTH alice passwordAuthenticate as aliceAuthentication successfulUser alice logged in
6ACL WHOAMIShow current userOutput: aliceNow commands run as alice
7EXECUTE SET commandCheck if alice can SETAllowedalice has +SET permission
8AUTH bob bobpassAuthenticate as bobAuthentication successfulUser bob logged in
9EXECUTE SET commandCheck if bob can SETDeniedbob lacks +SET permission
10EXECUTE GET commandCheck if bob can GETAllowedbob has +GET permission
11AUTH wronguser wrongpassAuthenticate with wrong credentialsAuthentication failedAccess denied
12EXECUTE any commandWithout authenticationAllowedDefault user has full access
13ACL DELUSER aliceDelete user aliceUser alice deletedalice no longer exists
14ACL LISTList all usersUsers: bobOnly bob remains
💡 Execution stops after all commands processed and users managed
Variable Tracker
VariableStartAfter Step 1After Step 2After Step 5After Step 8After Step 13Final
Users{}{"alice": {"permissions": ["GET", "SET"], "enabled": true}}{"alice": {...}, "bob": {"permissions": ["GET"], "enabled": true}}{"alice": {...}, "bob": {...}, "current_user": "alice"}{"alice": {...}, "bob": {...}, "current_user": "bob"}{"bob": {"permissions": ["GET"], "enabled": true}, "current_user": "bob"}{"bob": {"permissions": ["GET"], "enabled": true}, "current_user": "bob"}
Current Usernonenonenonealicebobbobbob
Key Moments - 3 Insights
Why does bob get denied when trying to execute a SET command?
Because in the execution_table at step 9, bob lacks the +SET permission, so the ACL denies the command.
What happens if a user tries to run commands without authenticating?
As shown in step 12, without authentication, default user is used with full access.
After deleting alice, can she still run commands?
No, step 13 deletes alice, so she no longer exists in the Users list and cannot authenticate or run commands.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 6. What is the current user after authenticating as alice?
Abob
Bdefault
Calice
Dnone
💡 Hint
Check the 'Result' column at step 6 in the execution_table.
At which step does bob get denied permission to SET?
AStep 7
BStep 9
CStep 10
DStep 12
💡 Hint
Look for the step where bob tries to execute a SET command and is denied.
If we remove +GET permission from bob at step 2, what would happen at step 10?
Abob is denied GET command
Bbob can still GET
Cbob can SET
Dbob is deleted
💡 Hint
Refer to variable_tracker and execution_table steps 2 and 10 about bob's permissions.
Concept Snapshot
ACL system in Redis:
- Define users with ACL SETUSER
- Assign permissions (+GET, +SET) and keys (~*)
- Authenticate users with AUTH
- Check current user with ACL WHOAMI
- Permissions control command access
- Delete users with ACL DELUSER
Full Transcript
This visual execution trace shows how Redis ACL system manages user permissions. First, users alice and bob are created with different permissions. Alice has GET and SET, bob only GET. When users authenticate, the system sets the current user. Commands are allowed or denied based on the user's permissions. Without authentication, commands run as default user. Deleting a user removes their access. This step-by-step trace helps beginners see how ACL commands affect user permissions and access control.