1
0

Use the username instead of a user when adding a user to a team or giving it rights (#76)

This commit is contained in:
konrad
2019-05-25 09:47:16 +00:00
committed by Gitea
parent 3fffcbd986
commit 50d1f29125
19 changed files with 121 additions and 85 deletions

View File

@ -41,10 +41,11 @@ func (tm *TeamMember) Create(a web.Auth) (err error) {
}
// Check if the user exists
_, err = GetUserByID(tm.UserID)
user, err := GetUserByUsername(tm.Username)
if err != nil {
return
}
tm.UserID = user.ID
// Check if that user is already part of the team
exists, err := x.Where("team_id = ? AND user_id = ?", tm.TeamID, tm.UserID).