Skip to content

Commit

Permalink
Add Active and ProhibitLogin to API (go-gitea#15689)
Browse files Browse the repository at this point in the history
* Added active and prohibit_login.

* Do not omit fields for normal users.
  • Loading branch information
KN4CK3R authored and AbdulrhmnGhanem committed Aug 10, 2021
1 parent 10810c2 commit 102c2df
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/convert/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 4 additions & 0 deletions modules/structs/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 102c2df

Please sign in to comment.