mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-19 03:03:39 +09:00
chore: fix system users (#39299)
This commit is contained in:
@@ -23,7 +23,7 @@ import (
|
||||
// Authenticate queries if login/password is valid against the LDAP directory pool,
|
||||
// and create a local user if success when enabled.
|
||||
func (source *Source) Authenticate(ctx context.Context, user *user_model.User, userName, password string) (*user_model.User, error) {
|
||||
ctx = audit.WithDoer(ctx, user_model.NewAuthenticationSourceUser())
|
||||
ctx = audit.WithDoer(ctx, user_model.NewAuthSourceUser())
|
||||
|
||||
loginName := userName
|
||||
if user != nil {
|
||||
|
||||
@@ -28,7 +28,7 @@ func (source *Source) Sync(ctx context.Context, updateExisting bool) error {
|
||||
|
||||
// everything this sync changes is attributed to the authentication source,
|
||||
// not to a signed-in user
|
||||
ctx = audit.WithDoer(ctx, user_model.NewAuthenticationSourceUser())
|
||||
ctx = audit.WithDoer(ctx, user_model.NewAuthSourceUser())
|
||||
|
||||
isAttributeSSHPublicKeySet := strings.TrimSpace(source.AttributeSSHPublicKey) != ""
|
||||
var sshKeysNeedUpdate bool
|
||||
|
||||
@@ -68,7 +68,7 @@ func (source *Source) Authenticate(ctx context.Context, user *user_model.User, u
|
||||
return user, err
|
||||
}
|
||||
|
||||
audit.RecordAs(ctx, user_model.NewAuthenticationSourceUser(), audit_model.UserCreate, user)
|
||||
audit.RecordAs(ctx, user_model.NewAuthSourceUser(), audit_model.UserCreate, user)
|
||||
|
||||
return user, nil
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ func (source *Source) Authenticate(ctx context.Context, user *user_model.User, u
|
||||
return user, err
|
||||
}
|
||||
|
||||
audit.RecordAs(ctx, user_model.NewAuthenticationSourceUser(), audit_model.UserCreate, user)
|
||||
audit.RecordAs(ctx, user_model.NewAuthSourceUser(), audit_model.UserCreate, user)
|
||||
|
||||
return user, nil
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func SyncGroupsToTeams(ctx context.Context, user *user_model.User, sourceUserGro
|
||||
// SyncGroupsToTeamsCached maps authentication source groups to organization and team memberships
|
||||
func SyncGroupsToTeamsCached(ctx context.Context, user *user_model.User, sourceUserGroups container.Set[string], sourceGroupTeamMapping map[string]map[string][]string, performRemoval bool, orgCache map[string]*organization.Organization, teamCache map[string]*organization.Team) error {
|
||||
// team membership changes here come from the authentication source mapping
|
||||
ctx = audit.WithDoer(ctx, user_model.NewAuthenticationSourceUser())
|
||||
ctx = audit.WithDoer(ctx, user_model.NewAuthSourceUser())
|
||||
|
||||
membershipsToAdd, membershipsToRemove := resolveMappedMemberships(sourceUserGroups, sourceGroupTeamMapping)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user