forked from gitea/gitea
1
0
Fork 0

Only update access usernames where the username is changing #282

This commit is contained in:
Christopher Brickley 2014-07-11 20:57:00 -04:00
parent c127d84777
commit 63e47405b2
1 changed files with 6 additions and 4 deletions

View File

@ -297,13 +297,15 @@ func ChangeUserName(user *User, newUserName string) (err error) {
}
for j := range accesses {
accesses[j].UserName = newUserName
// if the access is not the user's access (already updated above)
if accesses[j].UserName != user.LowerName {
accesses[j].RepoName = newUserName + "/" + repos[i].LowerName
if err = UpdateAccessWithSession(sess, &accesses[j]); err != nil {
return err
}
}
}
}
// Change user directory name.
if err = os.Rename(UserPath(user.LowerName), UserPath(newUserName)); err != nil {