1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 00:09:40 +02:00

chore(loops): remove loop var copy EE-7342 (#12023)

This commit is contained in:
andres-portainer 2024-07-09 12:47:34 -03:00 committed by GitHub
parent 6e7a42727a
commit 7fd1a644a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 61 additions and 48 deletions

View file

@ -42,7 +42,6 @@ func createRegistryAuthenticationHeader(
var matchingRegistry *portainer.Registry
for _, registry := range accessContext.registries {
registry := registry
if registry.ID == registryID &&
(accessContext.isAdmin ||
security.AuthorizedRegistryAccess(&registry, accessContext.user, accessContext.teamMemberships, accessContext.endpointID)) {
@ -52,14 +51,16 @@ func createRegistryAuthenticationHeader(
}
}
if matchingRegistry != nil {
if err = registryutils.EnsureRegTokenValid(dataStore, matchingRegistry); err != nil {
return
}
authenticationHeader.Serveraddress = matchingRegistry.URL
authenticationHeader.Username, authenticationHeader.Password, err = registryutils.GetRegEffectiveCredential(matchingRegistry)
if matchingRegistry == nil {
return
}
if err = registryutils.EnsureRegTokenValid(dataStore, matchingRegistry); err != nil {
return
}
authenticationHeader.Serveraddress = matchingRegistry.URL
authenticationHeader.Username, authenticationHeader.Password, err = registryutils.GetRegEffectiveCredential(matchingRegistry)
return
}