You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
2
2
3
3
### The `ACL GETUSER` command
4
4
5
-
The [`ACL GETUSER`](https://redis.io/docs/latest/commands/acl-getuser/)is used to retrieve the properties of 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.
6
6
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.
8
-
9
-
Example usage:
7
+
For example:
10
8
```bash
11
9
> ACL GETUSER default
12
10
1) "flags"
13
11
2) (empty array)
12
+
...
13
+
```
14
+
15
+
The command expects the response to be a nested RESP array of property name-value pairs for a user:
The second element of the response 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.
21
+
For this stage, you'll implement just the `flags` property.
22
+
23
+
### The `flags` Property
24
+
25
+
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.
26
+
27
+
For example, after creating or modifying a user, the flags array might look like this:
28
+
29
+
```bash
30
+
> ACL GETUSER alice
31
+
1) "flags"
32
+
2) 1) "on"
33
+
2) "allkeys"
34
+
3) "allcommands"
35
+
```
36
+
37
+
For this stage, since the `default` user has no flags to report yet, you will hardcode this to be an empty RESP array (`[]`).
17
38
18
39
### Tests
19
40
@@ -23,7 +44,7 @@ The tester will execute your program like this:
23
44
$ ./your_program.sh
24
45
```
25
46
26
-
It will then send an `ACL GETUSER` command specifying the `default` user.
47
+
It will then send an `ACL GETUSER` command specifying the `default` user:
27
48
28
49
```bash
29
50
# Expect RESP array: ["flags", []]
@@ -33,12 +54,7 @@ $ redis-cli
33
54
2) (empty array)
34
55
```
35
56
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
57
+
The tester will verify that the response is a RESP array with two elements:
42
58
43
-
- A user can have multiple flags. This is why the value of flags property is an array.
44
-
- The second element of the array is the flags array, which contains the user flags. We'll get to this in the later stages.
0 commit comments