API: Apply "golangci-lint" recommendations #5330

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-11-22 09:25:01 +01:00
parent 264bc78d51
commit 4eac10c9d1
35 changed files with 146 additions and 146 deletions

View File

@@ -35,13 +35,10 @@ func AuthAny(c *gin.Context, resource acl.Resource, perms acl.Permissions) (s *e
c.Header(header.CacheControl, header.CacheControlNoStore)
// Allow requests based on an access token for specific resources.
switch resource {
case acl.ResourceVision:
if perms.Contains(acl.ActionUse) && vision.ServiceApi && vision.ServiceKey != "" && vision.ServiceKey == authToken {
s = entity.NewSessionFromToken(c, authToken, acl.ResourceVision.String(), "service-key")
event.AuditInfo([]string{clientIp, "%s", "%s %s as %s", status.Granted}, s.RefID, perms.First(), string(resource), s.GetClientRole().String())
return s
}
if resource == acl.ResourceVision && perms.Contains(acl.ActionUse) && vision.ServiceApi && vision.ServiceKey != "" && vision.ServiceKey == authToken {
s = entity.NewSessionFromToken(c, authToken, acl.ResourceVision.String(), "service-key")
event.AuditInfo([]string{clientIp, "%s", "%s %s as %s", status.Granted}, s.RefID, perms.First(), string(resource), s.GetClientRole().String())
return s
}
// Find active session to perform authorization check or deny if no session was found.