Skip to content

Add a login/login-name/username disambiguation to affected endpoint parameters and response/request models #34901

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

Merged
merged 5 commits into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion modules/structs/admin_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import "time"

// CreateUserOption create user options
type CreateUserOption struct {
SourceID int64 `json:"source_id"`
SourceID int64 `json:"source_id"`
// identifier of the user, provided by the external authenticator (if configured)
// default: empty
LoginName string `json:"login_name"`
// username of the user
// required: true
Username string `json:"username" binding:"Required;Username;MaxSize(40)"`
FullName string `json:"full_name" binding:"MaxSize(100)"`
Expand All @@ -32,6 +35,8 @@ type CreateUserOption struct {
type EditUserOption struct {
// required: true
SourceID int64 `json:"source_id"`
// identifier of the user, provided by the external authenticator (if configured)
// default: empty
// required: true
LoginName string `json:"login_name" binding:"Required"`
// swagger:strfmt email
Expand Down
3 changes: 2 additions & 1 deletion modules/structs/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ type PayloadUser struct {
// Full name of the commit author
Name string `json:"name"`
// swagger:strfmt email
Email string `json:"email"`
Email string `json:"email"`
// username of the user
UserName string `json:"username"`
}

Expand Down
5 changes: 3 additions & 2 deletions modules/structs/issue_tracked_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type AddTimeOption struct {
Time int64 `json:"time" binding:"Required"`
// swagger:strfmt date-time
Created time.Time `json:"created"`
// User who spent the time (optional)
// username of the user who spent the time working on the issue (optional)
User string `json:"user_name"`
}

Expand All @@ -26,7 +26,8 @@ type TrackedTime struct {
// Time in seconds
Time int64 `json:"time"`
// deprecated (only for backwards compatibility)
UserID int64 `json:"user_id"`
UserID int64 `json:"user_id"`
// username of the user
UserName string `json:"user_name"`
// deprecated (only for backwards compatibility)
IssueID int64 `json:"issue_id"`
Expand Down
2 changes: 2 additions & 0 deletions modules/structs/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Organization struct {
Location string `json:"location"`
Visibility string `json:"visibility"`
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
// username of the organization
// deprecated
UserName string `json:"username"`
}
Expand All @@ -30,6 +31,7 @@ type OrganizationPermissions struct {

// CreateOrgOption options for creating an organization
type CreateOrgOption struct {
// username of the organization
// required: true
UserName string `json:"username" binding:"Required;Username;MaxSize(40)"`
FullName string `json:"full_name" binding:"MaxSize(100)"`
Expand Down
4 changes: 2 additions & 2 deletions modules/structs/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
type User struct {
// the user's id
ID int64 `json:"id"`
// the user's username
// login of the user, same as `username`
UserName string `json:"login"`
// the user's authentication sign-in name.
// identifier of the user, provided by the external authenticator (if configured)
// default: empty
LoginName string `json:"login_name"`
// The ID of the user's Authentication Source
Expand Down
1 change: 1 addition & 0 deletions modules/structs/user_email.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Email struct {
Verified bool `json:"verified"`
Primary bool `json:"primary"`
UserID int64 `json:"user_id"`
// username of the user
UserName string `json:"username"`
}

Expand Down
2 changes: 1 addition & 1 deletion routers/api/v1/admin/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func CreateOrg(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of the user that will own the created organization
// description: username of the user who will own the created organization
// type: string
// required: true
// - name: organization
Expand Down
2 changes: 1 addition & 1 deletion routers/api/v1/admin/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func CreateRepo(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of the user. This user will own the created repository
// description: username of the user who will own the created repository
// type: string
// required: true
// - name: repository
Expand Down
12 changes: 6 additions & 6 deletions routers/api/v1/admin/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func EditUser(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of user to edit
// description: username of the user whose data is to be edited
// type: string
// required: true
// - name: body
Expand Down Expand Up @@ -272,7 +272,7 @@ func DeleteUser(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of user to delete
// description: username of the user to delete
// type: string
// required: true
// - name: purge
Expand Down Expand Up @@ -328,7 +328,7 @@ func CreatePublicKey(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of the user
// description: username of the user who is to receive a public key
// type: string
// required: true
// - name: key
Expand Down Expand Up @@ -358,7 +358,7 @@ func DeleteUserPublicKey(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of user
// description: username of the user whose public key is to be deleted
// type: string
// required: true
// - name: id
Expand Down Expand Up @@ -405,7 +405,7 @@ func SearchUsers(ctx *context.APIContext) {
// format: int64
// - name: login_name
// in: query
// description: user's login name to search for
// description: identifier of the user, provided by the external authenticator
// type: string
// - name: page
// in: query
Expand Down Expand Up @@ -456,7 +456,7 @@ func RenameUser(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: existing username of user
// description: current username of the user
// type: string
// required: true
// - name: body
Expand Down
6 changes: 3 additions & 3 deletions routers/api/v1/admin/user_badge.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func ListUserBadges(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of user
// description: username of the user whose badges are to be listed
// type: string
// required: true
// responses:
Expand Down Expand Up @@ -53,7 +53,7 @@ func AddUserBadges(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of user
// description: username of the user to whom a badge is to be added
// type: string
// required: true
// - name: body
Expand Down Expand Up @@ -87,7 +87,7 @@ func DeleteUserBadges(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of user
// description: username of the user whose badge is to be deleted
// type: string
// required: true
// - name: body
Expand Down
6 changes: 3 additions & 3 deletions routers/api/v1/org/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func CheckUserBlock(ctx *context.APIContext) {
// required: true
// - name: username
// in: path
// description: user to check
// description: username of the user to check
// type: string
// required: true
// responses:
Expand All @@ -71,7 +71,7 @@ func BlockUser(ctx *context.APIContext) {
// required: true
// - name: username
// in: path
// description: user to block
// description: username of the user to block
// type: string
// required: true
// - name: note
Expand Down Expand Up @@ -101,7 +101,7 @@ func UnblockUser(ctx *context.APIContext) {
// required: true
// - name: username
// in: path
// description: user to unblock
// description: username of the user to unblock
// type: string
// required: true
// responses:
Expand Down
10 changes: 5 additions & 5 deletions routers/api/v1/org/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func IsMember(ctx *context.APIContext) {
// required: true
// - name: username
// in: path
// description: username of the user
// description: username of the user to check for an organization membership
// type: string
// required: true
// responses:
Expand Down Expand Up @@ -186,7 +186,7 @@ func IsPublicMember(ctx *context.APIContext) {
// required: true
// - name: username
// in: path
// description: username of the user
// description: username of the user to check for a public organization membership
// type: string
// required: true
// responses:
Expand Down Expand Up @@ -240,7 +240,7 @@ func PublicizeMember(ctx *context.APIContext) {
// required: true
// - name: username
// in: path
// description: username of the user
// description: username of the user whose membership is to be publicized
// type: string
// required: true
// responses:
Expand Down Expand Up @@ -282,7 +282,7 @@ func ConcealMember(ctx *context.APIContext) {
// required: true
// - name: username
// in: path
// description: username of the user
// description: username of the user whose membership is to be concealed
// type: string
// required: true
// responses:
Expand Down Expand Up @@ -324,7 +324,7 @@ func DeleteMember(ctx *context.APIContext) {
// required: true
// - name: username
// in: path
// description: username of the user
// description: username of the user to remove from the organization
// type: string
// required: true
// responses:
Expand Down
4 changes: 2 additions & 2 deletions routers/api/v1/org/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func ListUserOrgs(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of user
// description: username of the user whose organizations are to be listed
// type: string
// required: true
// - name: page
Expand Down Expand Up @@ -112,7 +112,7 @@ func GetUserOrgsPermissions(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of user
// description: username of the user whose permissions are to be obtained
// type: string
// required: true
// - name: org
Expand Down
6 changes: 3 additions & 3 deletions routers/api/v1/org/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ func GetTeamMember(ctx *context.APIContext) {
// required: true
// - name: username
// in: path
// description: username of the member to list
// description: username of the user whose data is to be listed
// type: string
// required: true
// responses:
Expand Down Expand Up @@ -467,7 +467,7 @@ func AddTeamMember(ctx *context.APIContext) {
// required: true
// - name: username
// in: path
// description: username of the user to add
// description: username of the user to add to a team
// type: string
// required: true
// responses:
Expand Down Expand Up @@ -509,7 +509,7 @@ func RemoveTeamMember(ctx *context.APIContext) {
// required: true
// - name: username
// in: path
// description: username of the user to remove
// description: username of the user to remove from a team
// type: string
// required: true
// responses:
Expand Down
6 changes: 3 additions & 3 deletions routers/api/v1/repo/collaborators.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func IsCollaborator(ctx *context.APIContext) {
// required: true
// - name: collaborator
// in: path
// description: username of the collaborator
// description: username of the user to check for being a collaborator
// type: string
// required: true
// responses:
Expand Down Expand Up @@ -145,7 +145,7 @@ func AddOrUpdateCollaborator(ctx *context.APIContext) {
// required: true
// - name: collaborator
// in: path
// description: username of the collaborator to add
// description: username of the user to add or update as a collaborator
// type: string
// required: true
// - name: body
Expand Down Expand Up @@ -264,7 +264,7 @@ func GetRepoPermissions(ctx *context.APIContext) {
// required: true
// - name: collaborator
// in: path
// description: username of the collaborator
// description: username of the collaborator whose permissions are to be obtained
// type: string
// required: true
// responses:
Expand Down
4 changes: 2 additions & 2 deletions routers/api/v1/repo/issue_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func AddIssueSubscription(ctx *context.APIContext) {
// required: true
// - name: user
// in: path
// description: user to subscribe
// description: username of the user to subscribe the issue to
// type: string
// required: true
// responses:
Expand Down Expand Up @@ -87,7 +87,7 @@ func DelIssueSubscription(ctx *context.APIContext) {
// required: true
// - name: user
// in: path
// description: user witch unsubscribe
// description: username of the user to unsubscribe from an issue
// type: string
// required: true
// responses:
Expand Down
2 changes: 1 addition & 1 deletion routers/api/v1/repo/issue_tracked_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func ListTrackedTimesByUser(ctx *context.APIContext) {
// required: true
// - name: user
// in: path
// description: username of user
// description: username of the user whose tracked times are to be listed
// type: string
// required: true
// responses:
Expand Down
6 changes: 3 additions & 3 deletions routers/api/v1/user/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func ListAccessTokens(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of user
// description: username of to user whose access tokens are to be listed
// type: string
// required: true
// - name: page
Expand Down Expand Up @@ -83,7 +83,7 @@ func CreateAccessToken(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of user
// description: username of the user whose token is to be created
// required: true
// type: string
// - name: body
Expand Down Expand Up @@ -149,7 +149,7 @@ func DeleteAccessToken(ctx *context.APIContext) {
// parameters:
// - name: username
// in: path
// description: username of user
// description: username of the user whose token is to be deleted
// type: string
// required: true
// - name: token
Expand Down
Loading