Add Active and ProhibitLogin to API (#15689)

* Added active and prohibit_login.

* Do not omit fields for normal users.
tokarchuk/v1.17
KN4CK3R 4 years ago committed by GitHub
parent d86d123322
commit f8335444de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      modules/convert/user.go
  2. 4
      modules/structs/user.go
  3. 10
      templates/swagger/v1_json.tmpl

@ -58,6 +58,8 @@ func toUser(user *models.User, signed, authed bool) *api.User {
result.IsAdmin = user.IsAdmin
result.LastLogin = user.LastLoginUnix.AsTime()
result.Language = user.Language
result.IsActive = user.IsActive
result.ProhibitLogin = user.ProhibitLogin
}
return result
}

@ -33,6 +33,10 @@ type User struct {
Created time.Time `json:"created,omitempty"`
// Is user restricted
Restricted bool `json:"restricted"`
// Is user active
IsActive bool `json:"active"`
// Is user login prohibited
ProhibitLogin bool `json:"prohibit_login"`
// the user's location
Location string `json:"location"`
// the user's website

@ -16250,6 +16250,11 @@
"description": "User represents a user",
"type": "object",
"properties": {
"active": {
"description": "Is user active",
"type": "boolean",
"x-go-name": "IsActive"
},
"avatar_url": {
"description": "URL to the user's avatar",
"type": "string",
@ -16306,6 +16311,11 @@
"type": "string",
"x-go-name": "UserName"
},
"prohibit_login": {
"description": "Is user login prohibited",
"type": "boolean",
"x-go-name": "ProhibitLogin"
},
"restricted": {
"description": "Is user restricted",
"type": "boolean",

Loading…
Cancel
Save