Skip to content

Commit e35a39e

Browse files
authored
Include login_name in adminCreateUser response (#20283)
`login_name` (Authentication Sign-in Name) is not included in the response of `adminUserCreate` API. This PR is to return user-specified `login_name` if there is one.
1 parent e49ef56 commit e35a39e

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

modules/convert/user.go

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func toUser(user *user_model.User, signed, authed bool) *api.User {
7373
// only site admin will get these information and possibly user himself
7474
if authed {
7575
result.IsAdmin = user.IsAdmin
76+
result.LoginName = user.LoginName
7677
result.LastLogin = user.LastLoginUnix.AsTime()
7778
result.Language = user.Language
7879
result.IsActive = user.IsActive

modules/structs/user.go

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ type User struct {
1717
ID int64 `json:"id"`
1818
// the user's username
1919
UserName string `json:"login"`
20+
// the user's authentication sign-in name.
21+
// default: empty
22+
LoginName string `json:"login_name"`
2023
// the user's full name
2124
FullName string `json:"full_name"`
2225
// swagger:strfmt email

templates/swagger/v1_json.tmpl

+6
Original file line numberDiff line numberDiff line change
@@ -18487,6 +18487,12 @@
1848718487
"type": "string",
1848818488
"x-go-name": "UserName"
1848918489
},
18490+
"login_name": {
18491+
"description": "the user's authentication sign-in name.",
18492+
"type": "string",
18493+
"default": "empty",
18494+
"x-go-name": "LoginName"
18495+
},
1849018496
"prohibit_login": {
1849118497
"description": "Is user login prohibited",
1849218498
"type": "boolean",

0 commit comments

Comments
 (0)