feat: vendor gitea 1.16.2

This commit is contained in:
2026-06-02 08:36:01 +00:00
parent 247cd60f69
commit 54798b4615
2145 changed files with 162965 additions and 126447 deletions
+5 -7
View File
@@ -31,17 +31,15 @@ import (
)
// RenameUser renames a user
func RenameUser(ctx context.Context, u *user_model.User, newUserName string) error {
func RenameUser(ctx context.Context, u *user_model.User, newUserName string, doer *user_model.User) error {
if newUserName == u.Name {
return nil
}
// Non-local users are not allowed to change their username.
if !u.IsOrganization() && !u.IsLocal() {
return user_model.ErrUserIsNotLocal{
UID: u.ID,
Name: u.Name,
}
// Non-local users are not allowed to change their own username, but admins are
isExternalUser := !u.IsOrganization() && !u.IsLocal()
if isExternalUser && !doer.IsAdmin {
return user_model.ErrUserIsNotLocal{UID: u.ID, Name: u.Name}
}
if err := user_model.IsUsableUsername(newUserName); err != nil {