Show provisioned users

This commit is contained in:
binwiederhier
2025-12-30 11:30:36 -05:00
parent 75b2ca7dec
commit 2a940ad289
4 changed files with 65 additions and 24 deletions

View File

@@ -24,15 +24,17 @@ func (s *Server) handleUsersGet(w http.ResponseWriter, r *http.Request, v *visit
userGrants := make([]*apiUserGrantResponse, len(grants[u.ID]))
for i, g := range grants[u.ID] {
userGrants[i] = &apiUserGrantResponse{
Topic: g.TopicPattern,
Permission: g.Permission.String(),
Topic: g.TopicPattern,
Permission: g.Permission.String(),
Provisioned: g.Provisioned,
}
}
usersResponse[i] = &apiUserResponse{
Username: u.Name,
Role: string(u.Role),
Tier: tier,
Grants: userGrants,
Username: u.Name,
Role: string(u.Role),
Tier: tier,
Grants: userGrants,
Provisioned: u.Provisioned,
}
}
return s.writeJSON(w, usersResponse)

View File

@@ -308,15 +308,17 @@ type apiUserAddOrUpdateRequest struct {
}
type apiUserResponse struct {
Username string `json:"username"`
Role string `json:"role"`
Tier string `json:"tier,omitempty"`
Grants []*apiUserGrantResponse `json:"grants,omitempty"`
Username string `json:"username"`
Role string `json:"role"`
Tier string `json:"tier,omitempty"`
Grants []*apiUserGrantResponse `json:"grants,omitempty"`
Provisioned bool `json:"provisioned,omitempty"`
}
type apiUserGrantResponse struct {
Topic string `json:"topic"` // This may be a pattern
Permission string `json:"permission"`
Topic string `json:"topic"` // This may be a pattern
Permission string `json:"permission"`
Provisioned bool `json:"provisioned,omitempty"`
}
type apiUserDeleteRequest struct {