Skip to content

Commit

Permalink
Omit project ID attr when reading user role
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Karasek <tom.to.the.k@gmail.com>
  • Loading branch information
t0mk committed Jan 12, 2021
1 parent 1533f6f commit 0e17b94
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions path_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,16 @@ func (b *backend) operationRoleRead(ctx context.Context, req *logical.Request, d
if role == nil {
return nil, nil
}
return &logical.Response{
Data: map[string]interface{}{
"type": role.Type,
"read_only": role.ReadOnly,
"project_id": role.ProjectID,
"ttl": role.TTL / time.Second,
"max_ttl": role.MaxTTL / time.Second,
},
}, nil
respData := map[string]interface{}{
"type": role.Type,
"read_only": role.ReadOnly,
"ttl": role.TTL / time.Second,
"max_ttl": role.MaxTTL / time.Second,
}
if role.Type == TypeProject {
respData["project_id"] = role.ProjectID
}
return &logical.Response{Data: respData}, nil
}

func (b *backend) operationRoleDelete(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
Expand Down

0 comments on commit 0e17b94

Please sign in to comment.