Skip to content

Commit c886fc2

Browse files
authored
Merge pull request #458 from codecrafters-io/TropicolX-patch-83
Revise "Respond to ACL GETUSER #gx8"
2 parents 0802d0b + ff692fc commit c886fc2

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

stage_descriptions/auth-02-gx8.md

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,41 @@
1-
In this stage, you'll add support for responding to the `ACL GETUSER` command.
1+
In this stage, you'll add support for the `ACL GETUSER` command.
22

3-
### The `ACL GETUSER` command
3+
### The `ACL GETUSER` Command
44

5-
The [`ACL GETUSER`](https://redis.io/docs/latest/commands/acl-getuser/) is used to retrieve the properties the specified user. In Redis, the `default` user is present from the start, without having to create it explicitly.
5+
The [`ACL GETUSER`](https://redis.io/docs/latest/commands/acl-getuser/) command retrieves the properties of a specified user. In Redis, the `default` user is present from the start and does not need to be created.
66

7-
The `ACL GETUSER` returns multiple properties of the user, among which `flags` is one. In this stage, you'll add support for responding to the `ACL GETUSER` command with only the flags property.
7+
For example:
88

9-
Example usage:
109
```bash
1110
> ACL GETUSER default
1211
1) "flags"
1312
2) (empty array)
13+
...
1414
```
1515

16-
The second element of the resposne is the flags array. This is because a user can have multiple flags associated with it. In this stage, you can hardcode the flags array to be an empty array.
16+
The return value is nested RESP array of property name-value pairs for a user:
17+
18+
```bash
19+
[property_name_1, property_value_1, property_name_2, property_value_2, ...]
20+
```
21+
22+
For this stage, you'll implement just the `flags` property.
23+
24+
### The `flags` Property
25+
26+
The `flags` property represents a set of attributes that describe how a user behaves or what special permissions they have. Each flag is a short label that defines part of the user’s configuration.
27+
28+
For example, after creating or modifying a user, the flags array might look like this:
29+
30+
```bash
31+
> ACL GETUSER alice
32+
1) "flags"
33+
2) 1) "on"
34+
2) "allkeys"
35+
3) "allcommands"
36+
```
37+
38+
For this stage, since the `default` user has no `flags` to report yet, you will hardcode the value to be an empty RESP array (`[]`).
1739

1840
### Tests
1941

@@ -23,7 +45,7 @@ The tester will execute your program like this:
2345
$ ./your_program.sh
2446
```
2547

26-
It'll then send an `ACL GETUSER` command specifying the `default` user.
48+
It will then send an `ACL GETUSER` command specifying the `default` user:
2749

2850
```bash
2951
# Expect RESP array: ["flags", []]
@@ -33,13 +55,7 @@ $ redis-cli
3355
2) (empty array)
3456
```
3557

36-
The tester will validate the following for the response:
37-
38-
1. The first element of the array is the string `flags`, encoded as a RESP bulk string.
39-
2. The second element of the array is a RESP array.
40-
41-
### Notes
42-
43-
- A user can have multiple flags. This is why the value of flags property is an array.
58+
The tester will verify that the response is a RESP array with two elements:
4459

45-
- The second element of the array is the flags array, which contains the user flags. We'll get to this in the later stages.
60+
1. The first element is the bulk string `flags`.
61+
2. The second element is an empty RESP array.

0 commit comments

Comments
 (0)