Update LDAP "groups" parameter to use TypeCommaStringSlice (#6942)
No functional change, but the updated type plays nicer with the OpenAPI-driven UI.
This commit is contained in:
parent
3d231d985d
commit
6d08c94866
|
@ -27,17 +27,17 @@ func pathUsers(b *backend) *framework.Path {
|
||||||
return &framework.Path{
|
return &framework.Path{
|
||||||
Pattern: `users/(?P<name>.+)`,
|
Pattern: `users/(?P<name>.+)`,
|
||||||
Fields: map[string]*framework.FieldSchema{
|
Fields: map[string]*framework.FieldSchema{
|
||||||
"name": &framework.FieldSchema{
|
"name": {
|
||||||
Type: framework.TypeString,
|
Type: framework.TypeString,
|
||||||
Description: "Name of the LDAP user.",
|
Description: "Name of the LDAP user.",
|
||||||
},
|
},
|
||||||
|
|
||||||
"groups": &framework.FieldSchema{
|
"groups": {
|
||||||
Type: framework.TypeString,
|
Type: framework.TypeCommaStringSlice,
|
||||||
Description: "Comma-separated list of additional groups associated with the user.",
|
Description: "Comma-separated list of additional groups associated with the user.",
|
||||||
},
|
},
|
||||||
|
|
||||||
"policies": &framework.FieldSchema{
|
"policies": {
|
||||||
Type: framework.TypeCommaStringSlice,
|
Type: framework.TypeCommaStringSlice,
|
||||||
Description: "Comma-separated list of policies associated with the user.",
|
Description: "Comma-separated list of policies associated with the user.",
|
||||||
},
|
},
|
||||||
|
@ -126,7 +126,7 @@ func (b *backend) pathUserWrite(ctx context.Context, req *logical.Request, d *fr
|
||||||
lowercaseGroups = true
|
lowercaseGroups = true
|
||||||
}
|
}
|
||||||
|
|
||||||
groups := strutil.RemoveDuplicates(strutil.ParseStringSlice(d.Get("groups").(string), ","), lowercaseGroups)
|
groups := strutil.RemoveDuplicates(d.Get("groups").([]string), lowercaseGroups)
|
||||||
policies := policyutil.ParsePolicies(d.Get("policies"))
|
policies := policyutil.ParsePolicies(d.Get("policies"))
|
||||||
for i, g := range groups {
|
for i, g := range groups {
|
||||||
groups[i] = strings.TrimSpace(g)
|
groups[i] = strings.TrimSpace(g)
|
||||||
|
|
Loading…
Reference in New Issue