Skip to content

Commit

Permalink
Added active and prohibit_login.
Browse files Browse the repository at this point in the history
  • Loading branch information
KN4CK3R committed May 1, 2021
1 parent a6bfe59 commit 97e948b
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 @@ -55,6 +55,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,omitempty"`
// Is user login prohibited
ProhibitLogin *bool `json:"prohibit_login,omitempty"`
}

// MarshalJSON implements the json.Marshaler interface for User, adding field(s) for backward compatibility
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 @@ -16246,6 +16246,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 @@ -16292,6 +16297,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 97e948b

Please sign in to comment.