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:
Jim Kalafut 2019-06-20 15:36:54 -07:00 committed by GitHub
parent 3d231d985d
commit 6d08c94866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -27,17 +27,17 @@ func pathUsers(b *backend) *framework.Path {
return &framework.Path{
Pattern: `users/(?P<name>.+)`,
Fields: map[string]*framework.FieldSchema{
"name": &framework.FieldSchema{
"name": {
Type: framework.TypeString,
Description: "Name of the LDAP user.",
},
"groups": &framework.FieldSchema{
Type: framework.TypeString,
"groups": {
Type: framework.TypeCommaStringSlice,
Description: "Comma-separated list of additional groups associated with the user.",
},
"policies": &framework.FieldSchema{
"policies": {
Type: framework.TypeCommaStringSlice,
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
}
groups := strutil.RemoveDuplicates(strutil.ParseStringSlice(d.Get("groups").(string), ","), lowercaseGroups)
groups := strutil.RemoveDuplicates(d.Get("groups").([]string), lowercaseGroups)
policies := policyutil.ParsePolicies(d.Get("policies"))
for i, g := range groups {
groups[i] = strings.TrimSpace(g)