diff --git a/pkg/service/v0/data/user.go b/pkg/service/v0/data/user.go index b882d779e..c43cc9cf5 100644 --- a/pkg/service/v0/data/user.go +++ b/pkg/service/v0/data/user.go @@ -1,20 +1,30 @@ package data -// User holds the payload for a GetUser response -type User struct { - // TODO needs better naming, clarify if we need a userid, a username or both - UserID string `json:"id" xml:"id"` - Username string `json:"username" xml:"username"` - DisplayName string `json:"displayname" xml:"displayname"` - Email string `json:"email" xml:"email"` - Enabled bool `json:"enabled" xml:"enabled"` -} - // Users holds user ids for the user listing type Users struct { Users []string `json:"users" xml:"users>element"` } +// User holds the payload for a GetUser response +type User struct { + // TODO needs better naming, clarify if we need a userid, a username or both + Enabled bool `json:"enabled" xml:"enabled"` + UserID string `json:"id" xml:"id"` + Username string `json:"username" xml:"username"` + DisplayName string `json:"displayname" xml:"displayname"` + Email string `json:"email" xml:"email"` + Quota *Quota `json:"quota" xml:"quota"` +} + +// Quota holds quota information +type Quota struct { + Free int64 `json:"free" xml:"free"` + Used int64 `json:"used" xml:"used"` + Total int64 `json:"total" xml:"total"` + Relative float32 `json:"relative" xml:"relative"` + Definition string `json:"definition" xml:"definition"` +} + // SigningKey holds the Payload for a GetSigningKey response type SigningKey struct { User string `json:"user" xml:"user"` diff --git a/pkg/service/v0/users.go b/pkg/service/v0/users.go index b12d553a5..42b87f38e 100644 --- a/pkg/service/v0/users.go +++ b/pkg/service/v0/users.go @@ -61,6 +61,15 @@ func (o Ocs) GetUser(w http.ResponseWriter, r *http.Request) { DisplayName: account.DisplayName, Email: account.Mail, Enabled: account.AccountEnabled, + // FIXME only return quota for users/{userid} endpoint (not /user) + // TODO query storage registry for free space? of home storage, maybe... + Quota: &data.Quota{ + Free: 2840756224000, + Used: 5059416668, + Total: 2845815640668, + Relative: 0.18, + Definition: "default", + }, })) }