|
|
@ -297,13 +297,15 @@ func ChangeUserName(user *User, newUserName string) (err error) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for j := range accesses { |
|
|
|
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 |
|
|
|
accesses[j].RepoName = newUserName + "/" + repos[i].LowerName |
|
|
|
if err = UpdateAccessWithSession(sess, &accesses[j]); err != nil { |
|
|
|
if err = UpdateAccessWithSession(sess, &accesses[j]); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Change user directory name.
|
|
|
|
// Change user directory name.
|
|
|
|
if err = os.Rename(UserPath(user.LowerName), UserPath(newUserName)); err != nil { |
|
|
|
if err = os.Rename(UserPath(user.LowerName), UserPath(newUserName)); err != nil { |
|
|
|