2016-03-15 20:12:55 +00:00
|
|
|
package userpass
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/vault/logical"
|
|
|
|
"github.com/hashicorp/vault/logical/framework"
|
|
|
|
)
|
|
|
|
|
|
|
|
func pathUserPolicies(b *backend) *framework.Path {
|
|
|
|
return &framework.Path{
|
2016-03-15 21:47:13 +00:00
|
|
|
Pattern: "users/" + framework.GenericNameRegex("username") + "/policies$",
|
2016-03-15 20:12:55 +00:00
|
|
|
Fields: map[string]*framework.FieldSchema{
|
2016-03-15 21:47:13 +00:00
|
|
|
"username": &framework.FieldSchema{
|
2016-03-15 20:12:55 +00:00
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Username for this user.",
|
|
|
|
},
|
|
|
|
"policies": &framework.FieldSchema{
|
|
|
|
Type: framework.TypeString,
|
|
|
|
Description: "Comma-separated list of policies",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
Callbacks: map[logical.Operation]framework.OperationFunc{
|
|
|
|
logical.UpdateOperation: b.pathUserPoliciesUpdate,
|
|
|
|
},
|
|
|
|
|
|
|
|
HelpSynopsis: pathUserPoliciesHelpSyn,
|
|
|
|
HelpDescription: pathUserPoliciesHelpDesc,
|
|
|
|
}
|
|
|
|
}
|
2016-03-15 21:32:39 +00:00
|
|
|
|
2016-03-15 20:12:55 +00:00
|
|
|
func (b *backend) pathUserPoliciesUpdate(
|
|
|
|
req *logical.Request, d *framework.FieldData) (*logical.Response, error) {
|
2016-03-15 21:32:39 +00:00
|
|
|
return b.userCreateUpdate(req, d)
|
2016-03-15 20:12:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const pathUserPoliciesHelpSyn = `
|
|
|
|
Update the policies associated with the username.
|
|
|
|
`
|
|
|
|
|
|
|
|
const pathUserPoliciesHelpDesc = `
|
|
|
|
This endpoint allows updating the policies associated with the username.
|
|
|
|
`
|