15922: Preserve writable_by in user and collection responses.
[arvados.git] / sdk / go / arvados / user.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package arvados
6
7 import "time"
8
9 // User is an arvados#user record
10 type User struct {
11         UUID                 string                 `json:"uuid"`
12         IsActive             bool                   `json:"is_active"`
13         IsAdmin              bool                   `json:"is_admin"`
14         Username             string                 `json:"username"`
15         Email                string                 `json:"email"`
16         FullName             string                 `json:"full_name"`
17         FirstName            string                 `json:"first_name"`
18         LastName             string                 `json:"last_name"`
19         IdentityURL          string                 `json:"identity_url"`
20         IsInvited            bool                   `json:"is_invited"`
21         OwnerUUID            string                 `json:"owner_uuid"`
22         CreatedAt            time.Time              `json:"created_at"`
23         ModifiedAt           time.Time              `json:"modified_at"`
24         ModifiedByUserUUID   string                 `json:"modified_by_user_uuid"`
25         ModifiedByClientUUID string                 `json:"modified_by_client_uuid"`
26         Prefs                map[string]interface{} `json:"prefs"`
27         WritableBy           []string               `json:"writable_by,omitempty"`
28 }
29
30 // UserList is an arvados#userList resource.
31 type UserList struct {
32         Items          []User `json:"items"`
33         ItemsAvailable int    `json:"items_available"`
34         Offset         int    `json:"offset"`
35         Limit          int    `json:"limit"`
36 }
37
38 // CurrentUser calls arvados.v1.users.current, and returns the User
39 // record corresponding to this client's credentials.
40 func (c *Client) CurrentUser() (User, error) {
41         var u User
42         err := c.RequestAndDecode(&u, "GET", "arvados/v1/users/current", nil, nil)
43         return u, err
44 }