Merge pull request #27 from butonic/provisinging-api-fixes

This commit is contained in:
Alex Unger
2020-07-30 10:53:17 +02:00
committed by GitHub
2 changed files with 29 additions and 10 deletions

View File

@@ -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"`

View File

@@ -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",
},
}))
}