Lowercase all log strings (#3173)

from #3161

---------

Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
qwerty287
2024-01-11 19:17:07 +01:00
committed by GitHub
parent f56f9cb1c0
commit b0a2b1cf2d
23 changed files with 82 additions and 81 deletions

View File

@@ -74,7 +74,7 @@ func SetRepo() gin.HandlerFunc {
}
// debugging
log.Debug().Err(err).Msgf("Cannot find repository %s", fullName)
log.Debug().Err(err).Msgf("cannot find repository %s", fullName)
if user == nil {
c.AbortWithStatus(http.StatusUnauthorized)
@@ -113,13 +113,13 @@ func SetPerm() gin.HandlerFunc {
var err error
perm, err = _store.PermFind(user, repo)
if err != nil {
log.Error().Err(err).Msgf("Error fetching permission for %s %s",
log.Error().Err(err).Msgf("error fetching permission for %s %s",
user.Login, repo.FullName)
}
if time.Unix(perm.Synced, 0).Add(time.Hour).Before(time.Now()) {
_repo, err := server.Config.Services.Forge.Repo(c, user, repo.ForgeRemoteID, repo.Owner, repo.Name)
if err == nil {
log.Debug().Msgf("Synced user permission for %s %s", user.Login, repo.FullName)
log.Debug().Msgf("synced user permission for %s %s", user.Login, repo.FullName)
perm = _repo.Perm
perm.Repo = repo
perm.RepoID = repo.ID
@@ -151,7 +151,7 @@ func SetPerm() gin.HandlerFunc {
log.Debug().Msgf("%s granted %+v permission to %s",
user.Login, perm, repo.FullName)
} else {
log.Debug().Msgf("Guest granted %+v to %s", perm, repo.FullName)
log.Debug().Msgf("guest granted %+v to %s", perm, repo.FullName)
}
c.Set("perm", perm)
@@ -171,11 +171,11 @@ func MustPull(c *gin.Context) {
// debugging
if user != nil {
c.AbortWithStatus(http.StatusNotFound)
log.Debug().Msgf("User %s denied read access to %s",
log.Debug().Msgf("user %s denied read access to %s",
user.Login, c.Request.URL.Path)
} else {
c.AbortWithStatus(http.StatusUnauthorized)
log.Debug().Msgf("Guest denied read access to %s %s",
log.Debug().Msgf("guest denied read access to %s %s",
c.Request.Method,
c.Request.URL.Path,
)
@@ -196,11 +196,11 @@ func MustPush(c *gin.Context) {
// debugging
if user != nil {
c.AbortWithStatus(http.StatusNotFound)
log.Debug().Msgf("User %s denied write access to %s",
log.Debug().Msgf("user %s denied write access to %s",
user.Login, c.Request.URL.Path)
} else {
c.AbortWithStatus(http.StatusUnauthorized)
log.Debug().Msgf("Guest denied write access to %s %s",
log.Debug().Msgf("guest denied write access to %s %s",
c.Request.Method,
c.Request.URL.Path,
)

View File

@@ -147,14 +147,14 @@ func MustOrgMember(admin bool) gin.HandlerFunc {
perm, err := server.Config.Services.Membership.Get(c, user, org.Name)
if err != nil {
log.Error().Err(err).Msg("Failed to check membership")
log.Error().Err(err).Msg("failed to check membership")
c.String(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
c.Abort()
return
}
if perm == nil || (!admin && !perm.Member) || (admin && !perm.Admin) {
c.String(http.StatusForbidden, "User not authorized")
c.String(http.StatusForbidden, "user not authorized")
c.Abort()
return
}