Skip to content

Commit 102c2df

Browse files
KN4CK3RAbdulrhmnGhanem
authored andcommitted
Add Active and ProhibitLogin to API (go-gitea#15689)
* Added active and prohibit_login. * Do not omit fields for normal users.
1 parent 10810c2 commit 102c2df

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

modules/convert/user.go

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ func toUser(user *models.User, signed, authed bool) *api.User {
5858
result.IsAdmin = user.IsAdmin
5959
result.LastLogin = user.LastLoginUnix.AsTime()
6060
result.Language = user.Language
61+
result.IsActive = user.IsActive
62+
result.ProhibitLogin = user.ProhibitLogin
6163
}
6264
return result
6365
}

modules/structs/user.go

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ type User struct {
3333
Created time.Time `json:"created,omitempty"`
3434
// Is user restricted
3535
Restricted bool `json:"restricted"`
36+
// Is user active
37+
IsActive bool `json:"active"`
38+
// Is user login prohibited
39+
ProhibitLogin bool `json:"prohibit_login"`
3640
// the user's location
3741
Location string `json:"location"`
3842
// the user's website

templates/swagger/v1_json.tmpl

+10
Original file line numberDiff line numberDiff line change
@@ -16250,6 +16250,11 @@
1625016250
"description": "User represents a user",
1625116251
"type": "object",
1625216252
"properties": {
16253+
"active": {
16254+
"description": "Is user active",
16255+
"type": "boolean",
16256+
"x-go-name": "IsActive"
16257+
},
1625316258
"avatar_url": {
1625416259
"description": "URL to the user's avatar",
1625516260
"type": "string",
@@ -16306,6 +16311,11 @@
1630616311
"type": "string",
1630716312
"x-go-name": "UserName"
1630816313
},
16314+
"prohibit_login": {
16315+
"description": "Is user login prohibited",
16316+
"type": "boolean",
16317+
"x-go-name": "ProhibitLogin"
16318+
},
1630916319
"restricted": {
1631016320
"description": "Is user restricted",
1631116321
"type": "boolean",

0 commit comments

Comments
 (0)