]> source.dussan.org Git - gitea.git/commitdiff
Add Active and ProhibitLogin to API (#15689)
authorKN4CK3R <KN4CK3R@users.noreply.github.com>
Tue, 11 May 2021 00:22:29 +0000 (02:22 +0200)
committerGitHub <noreply@github.com>
Tue, 11 May 2021 00:22:29 +0000 (02:22 +0200)
* Added active and prohibit_login.

* Do not omit fields for normal users.

modules/convert/user.go
modules/structs/user.go
templates/swagger/v1_json.tmpl

index 364914f2ad02f08f5665fc952824ce01d4645c04..088ede5add5079cdbb2c5b0d0b60cc9453e9228a 100644 (file)
@@ -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
 }
index b5d5b9298ef011942eabb11d5f942a1b9e1453a4..2dbc5305382ab52e78b998456b1e770515b2dfc3 100644 (file)
@@ -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
index 8255ed6e6ea49b77080bfed8bf9f1f7c746b5f67..e3ac4a4c8a68cafeea99139e4b3c80b9c2f7b580 100644 (file)
       "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",
           "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",