Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include login_name in adminCreateUser response #20283

Merged
merged 12 commits into from
Jul 15, 2022
6 changes: 6 additions & 0 deletions modules/convert/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ func toUser(user *user_model.User, signed, authed bool) *api.User {
StarredRepos: user.NumStars,
}

if authed {
result.LoginName = user.LoginName
kimbj95 marked this conversation as resolved.
Show resolved Hide resolved
} else {
result.LoginName = ""
kimbj95 marked this conversation as resolved.
Show resolved Hide resolved
}

result.Visibility = user.Visibility.String()

// hide primary email if API caller is anonymous or user keep email private
Expand Down
2 changes: 2 additions & 0 deletions modules/structs/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ type User struct {
ID int64 `json:"id"`
// the user's username
UserName string `json:"login"`
// the user's login name
kimbj95 marked this conversation as resolved.
Show resolved Hide resolved
LoginName string `json:"login_name"`
// the user's full name
FullName string `json:"full_name"`
// swagger:strfmt email
Expand Down
5 changes: 5 additions & 0 deletions templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18479,6 +18479,11 @@
"type": "string",
"x-go-name": "UserName"
},
"login_name": {
"description": "the user's login name",
"type": "string",
"x-go-name": "LoginName"
},
"prohibit_login": {
"description": "Is user login prohibited",
"type": "boolean",
Expand Down