Skip to content

Commit

Permalink
Adding a status to ACL users
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnSharpe committed Oct 27, 2023
1 parent 7ec7c73 commit 19bbc5b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
6 changes: 3 additions & 3 deletions role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ func TestListRoles(t *testing.T) {
},
},
Users: []*roles.GetUserInRoleResponse{},
Status: redis.String("active"),
Status: redis.String(roles.StatusActive),
},
{
ID: redis.Int(999),
Expand Down Expand Up @@ -711,7 +711,7 @@ func TestListRoles(t *testing.T) {
Name: redis.String("test-user"),
},
},
Status: redis.String("active"),
Status: redis.String(roles.StatusActive),
},
}, actual)

Expand Down Expand Up @@ -905,7 +905,7 @@ func TestGetRole(t *testing.T) {
Name: redis.String("test-user"),
},
},
Status: redis.String("active"),
Status: redis.String(roles.StatusActive),
}, actual)

}
18 changes: 15 additions & 3 deletions service/access_control_lists/users/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ func (o ListUsersResponse) String() string {
}

type GetUserResponse struct {
ID *int `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Role *string `json:"role,omitempty"`
ID *int `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Role *string `json:"role,omitempty"`
Status *string `json:"status,omitempty"`
}

func (o GetUserResponse) String() string {
Expand Down Expand Up @@ -45,3 +46,14 @@ type UpdateUserRequest struct {
func (o UpdateUserRequest) String() string {
return internal.ToString(o)
}

const (
// StatusActive is the active value of the `Status` field in `User`
StatusActive = "active"
// StatusPending is the pending value of the `Status` field in `User`
StatusPending = "pending"
// StatusError is the error value of the `Status` field in `User`
StatusError = "error"
// StatusDeleting is the deleting value of the `Status` field in `User`
StatusDeleting = "deleting"
)
8 changes: 5 additions & 3 deletions user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ func TestGetUser(t *testing.T) {
"id": 20000,
"name": "test-user",
"role": "test-role",
"status": "pending",
"links": [
{
"rel": "self",
Expand All @@ -544,8 +545,9 @@ func TestGetUser(t *testing.T) {
require.NoError(t, err)

assert.Equal(t, &users.GetUserResponse{
ID: redis.Int(20000),
Name: redis.String("test-user"),
Role: redis.String("test-role"),
ID: redis.Int(20000),
Name: redis.String("test-user"),
Role: redis.String("test-role"),
Status: redis.String(users.StatusPending),
}, actual)
}

0 comments on commit 19bbc5b

Please sign in to comment.