Mimic oc10 user enabled as string
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
Bugfix: Mimic oc10 user enabled as string in provisioning api
|
||||||
|
|
||||||
|
The oc10 user provisioning API uses a string for the boolean `enabled` flag. 😭
|
||||||
|
|
||||||
|
https://github.com/owncloud/ocis-ocs/pull/39
|
||||||
@@ -8,7 +8,7 @@ type Users struct {
|
|||||||
// User holds the payload for a GetUser response
|
// User holds the payload for a GetUser response
|
||||||
type User struct {
|
type User struct {
|
||||||
// TODO needs better naming, clarify if we need a userid, a username or both
|
// TODO needs better naming, clarify if we need a userid, a username or both
|
||||||
Enabled bool `json:"enabled" xml:"enabled"`
|
Enabled string `json:"enabled" xml:"enabled"`
|
||||||
UserID string `json:"id" xml:"id"`
|
UserID string `json:"id" xml:"id"`
|
||||||
Username string `json:"username" xml:"username"`
|
Username string `json:"username" xml:"username"`
|
||||||
DisplayName string `json:"displayname" xml:"displayname"`
|
DisplayName string `json:"displayname" xml:"displayname"`
|
||||||
|
|||||||
+17
-3
@@ -56,6 +56,13 @@ func (o Ocs) GetUser(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
o.logger.Debug().Interface("account", account).Msg("got user")
|
o.logger.Debug().Interface("account", account).Msg("got user")
|
||||||
|
|
||||||
|
// mimic the oc10 bool as string for the user enabled property
|
||||||
|
var enabled string
|
||||||
|
if account.AccountEnabled {
|
||||||
|
enabled = "true"
|
||||||
|
} else {
|
||||||
|
enabled = "false"
|
||||||
|
}
|
||||||
render.Render(w, r, response.DataRender(&data.User{
|
render.Render(w, r, response.DataRender(&data.User{
|
||||||
UserID: account.Id, // TODO userid vs username! implications for clients if we return the userid here? -> implement graph ASAP?
|
UserID: account.Id, // TODO userid vs username! implications for clients if we return the userid here? -> implement graph ASAP?
|
||||||
Username: account.PreferredName,
|
Username: account.PreferredName,
|
||||||
@@ -63,8 +70,8 @@ func (o Ocs) GetUser(w http.ResponseWriter, r *http.Request) {
|
|||||||
Email: account.Mail,
|
Email: account.Mail,
|
||||||
UIDNumber: account.UidNumber,
|
UIDNumber: account.UidNumber,
|
||||||
GIDNumber: account.GidNumber,
|
GIDNumber: account.GidNumber,
|
||||||
Enabled: account.AccountEnabled,
|
Enabled: enabled,
|
||||||
// FIXME only return quota for users/{userid} endpoint (not /user)
|
// FIXME onlyfor users/{userid} endpoint (not /user)
|
||||||
// TODO query storage registry for free space? of home storage, maybe...
|
// TODO query storage registry for free space? of home storage, maybe...
|
||||||
Quota: &data.Quota{
|
Quota: &data.Quota{
|
||||||
Free: 2840756224000,
|
Free: 2840756224000,
|
||||||
@@ -160,6 +167,13 @@ func (o Ocs) AddUser(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
o.logger.Debug().Interface("account", account).Msg("added user")
|
o.logger.Debug().Interface("account", account).Msg("added user")
|
||||||
|
|
||||||
|
// mimic the oc10 bool as string for the user enabled property
|
||||||
|
var enabled string
|
||||||
|
if account.AccountEnabled {
|
||||||
|
enabled = "true"
|
||||||
|
} else {
|
||||||
|
enabled = "false"
|
||||||
|
}
|
||||||
render.Render(w, r, response.DataRender(&data.User{
|
render.Render(w, r, response.DataRender(&data.User{
|
||||||
UserID: account.Id,
|
UserID: account.Id,
|
||||||
Username: account.PreferredName,
|
Username: account.PreferredName,
|
||||||
@@ -167,7 +181,7 @@ func (o Ocs) AddUser(w http.ResponseWriter, r *http.Request) {
|
|||||||
Email: account.Mail,
|
Email: account.Mail,
|
||||||
UIDNumber: account.UidNumber,
|
UIDNumber: account.UidNumber,
|
||||||
GIDNumber: account.UidNumber,
|
GIDNumber: account.UidNumber,
|
||||||
Enabled: account.AccountEnabled,
|
Enabled: enabled,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user