Skip to content

Commit f74a136

Browse files
authored
Add a login/login-name/username disambiguation to affected endpoint parameters and response/request models (#34901)
Issue: [link](#9637) Changes introduced: I have clarified the problematic terms (`login`, `login_name`, and `username`) in all affected endpoints. The changes were made to relevant: - HTTP endpoint parameters' descriptions - response/request models' fields
1 parent 662db4a commit f74a136

27 files changed

+131
-112
lines changed

modules/structs/admin_user.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ import "time"
88

99
// CreateUserOption create user options
1010
type CreateUserOption struct {
11-
SourceID int64 `json:"source_id"`
11+
SourceID int64 `json:"source_id"`
12+
// identifier of the user, provided by the external authenticator (if configured)
13+
// default: empty
1214
LoginName string `json:"login_name"`
15+
// username of the user
1316
// required: true
1417
Username string `json:"username" binding:"Required;Username;MaxSize(40)"`
1518
FullName string `json:"full_name" binding:"MaxSize(100)"`
@@ -32,6 +35,8 @@ type CreateUserOption struct {
3235
type EditUserOption struct {
3336
// required: true
3437
SourceID int64 `json:"source_id"`
38+
// identifier of the user, provided by the external authenticator (if configured)
39+
// default: empty
3540
// required: true
3641
LoginName string `json:"login_name" binding:"Required"`
3742
// swagger:strfmt email

modules/structs/hook.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ type PayloadUser struct {
7171
// Full name of the commit author
7272
Name string `json:"name"`
7373
// swagger:strfmt email
74-
Email string `json:"email"`
74+
Email string `json:"email"`
75+
// username of the user
7576
UserName string `json:"username"`
7677
}
7778

modules/structs/issue_tracked_time.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type AddTimeOption struct {
1414
Time int64 `json:"time" binding:"Required"`
1515
// swagger:strfmt date-time
1616
Created time.Time `json:"created"`
17-
// User who spent the time (optional)
17+
// username of the user who spent the time working on the issue (optional)
1818
User string `json:"user_name"`
1919
}
2020

@@ -26,7 +26,8 @@ type TrackedTime struct {
2626
// Time in seconds
2727
Time int64 `json:"time"`
2828
// deprecated (only for backwards compatibility)
29-
UserID int64 `json:"user_id"`
29+
UserID int64 `json:"user_id"`
30+
// username of the user
3031
UserName string `json:"user_name"`
3132
// deprecated (only for backwards compatibility)
3233
IssueID int64 `json:"issue_id"`

modules/structs/org.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type Organization struct {
1515
Location string `json:"location"`
1616
Visibility string `json:"visibility"`
1717
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
18+
// username of the organization
1819
// deprecated
1920
UserName string `json:"username"`
2021
}
@@ -30,6 +31,7 @@ type OrganizationPermissions struct {
3031

3132
// CreateOrgOption options for creating an organization
3233
type CreateOrgOption struct {
34+
// username of the organization
3335
// required: true
3436
UserName string `json:"username" binding:"Required;Username;MaxSize(40)"`
3537
FullName string `json:"full_name" binding:"MaxSize(100)"`

modules/structs/user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import (
1515
type User struct {
1616
// the user's id
1717
ID int64 `json:"id"`
18-
// the user's username
18+
// login of the user, same as `username`
1919
UserName string `json:"login"`
20-
// the user's authentication sign-in name.
20+
// identifier of the user, provided by the external authenticator (if configured)
2121
// default: empty
2222
LoginName string `json:"login_name"`
2323
// The ID of the user's Authentication Source

modules/structs/user_email.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type Email struct {
1111
Verified bool `json:"verified"`
1212
Primary bool `json:"primary"`
1313
UserID int64 `json:"user_id"`
14+
// username of the user
1415
UserName string `json:"username"`
1516
}
1617

routers/api/v1/admin/org.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func CreateOrg(ctx *context.APIContext) {
2929
// parameters:
3030
// - name: username
3131
// in: path
32-
// description: username of the user that will own the created organization
32+
// description: username of the user who will own the created organization
3333
// type: string
3434
// required: true
3535
// - name: organization

routers/api/v1/admin/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func CreateRepo(ctx *context.APIContext) {
2222
// parameters:
2323
// - name: username
2424
// in: path
25-
// description: username of the user. This user will own the created repository
25+
// description: username of the user who will own the created repository
2626
// type: string
2727
// required: true
2828
// - name: repository

routers/api/v1/admin/user.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func EditUser(ctx *context.APIContext) {
175175
// parameters:
176176
// - name: username
177177
// in: path
178-
// description: username of user to edit
178+
// description: username of the user whose data is to be edited
179179
// type: string
180180
// required: true
181181
// - name: body
@@ -272,7 +272,7 @@ func DeleteUser(ctx *context.APIContext) {
272272
// parameters:
273273
// - name: username
274274
// in: path
275-
// description: username of user to delete
275+
// description: username of the user to delete
276276
// type: string
277277
// required: true
278278
// - name: purge
@@ -328,7 +328,7 @@ func CreatePublicKey(ctx *context.APIContext) {
328328
// parameters:
329329
// - name: username
330330
// in: path
331-
// description: username of the user
331+
// description: username of the user who is to receive a public key
332332
// type: string
333333
// required: true
334334
// - name: key
@@ -358,7 +358,7 @@ func DeleteUserPublicKey(ctx *context.APIContext) {
358358
// parameters:
359359
// - name: username
360360
// in: path
361-
// description: username of user
361+
// description: username of the user whose public key is to be deleted
362362
// type: string
363363
// required: true
364364
// - name: id
@@ -405,7 +405,7 @@ func SearchUsers(ctx *context.APIContext) {
405405
// format: int64
406406
// - name: login_name
407407
// in: query
408-
// description: user's login name to search for
408+
// description: identifier of the user, provided by the external authenticator
409409
// type: string
410410
// - name: page
411411
// in: query
@@ -456,7 +456,7 @@ func RenameUser(ctx *context.APIContext) {
456456
// parameters:
457457
// - name: username
458458
// in: path
459-
// description: existing username of user
459+
// description: current username of the user
460460
// type: string
461461
// required: true
462462
// - name: body

routers/api/v1/admin/user_badge.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func ListUserBadges(ctx *context.APIContext) {
2222
// parameters:
2323
// - name: username
2424
// in: path
25-
// description: username of user
25+
// description: username of the user whose badges are to be listed
2626
// type: string
2727
// required: true
2828
// responses:
@@ -53,7 +53,7 @@ func AddUserBadges(ctx *context.APIContext) {
5353
// parameters:
5454
// - name: username
5555
// in: path
56-
// description: username of user
56+
// description: username of the user to whom a badge is to be added
5757
// type: string
5858
// required: true
5959
// - name: body
@@ -87,7 +87,7 @@ func DeleteUserBadges(ctx *context.APIContext) {
8787
// parameters:
8888
// - name: username
8989
// in: path
90-
// description: username of user
90+
// description: username of the user whose badge is to be deleted
9191
// type: string
9292
// required: true
9393
// - name: body

0 commit comments

Comments
 (0)