Rename Id to ID for annotation models (#62886)

* Rename Id to ID for annotation models

* Add xorm tags

* Rename Id to ID for API key models

* Add xorm tags
This commit is contained in:
idafurjes
2023-02-03 17:23:09 +01:00
committed by GitHub
parent a0602a2a78
commit 982939111b
34 changed files with 367 additions and 367 deletions
+5 -5
View File
@@ -63,15 +63,15 @@ func (s *APIKey) Authenticate(ctx context.Context, r *authn.Request) (*authn.Ide
// if the api key don't belong to a service account construct the identity and return it
if apiKey.ServiceAccountId == nil || *apiKey.ServiceAccountId < 1 {
return &authn.Identity{
ID: authn.NamespacedID(authn.NamespaceAPIKey, apiKey.Id),
OrgID: apiKey.OrgId,
OrgRoles: map[int64]org.RoleType{apiKey.OrgId: apiKey.Role},
ID: authn.NamespacedID(authn.NamespaceAPIKey, apiKey.ID),
OrgID: apiKey.OrgID,
OrgRoles: map[int64]org.RoleType{apiKey.OrgID: apiKey.Role},
}, nil
}
usr, err := s.userService.GetSignedInUserWithCacheCtx(ctx, &user.GetSignedInUserQuery{
UserID: *apiKey.ServiceAccountId,
OrgID: apiKey.OrgId,
OrgID: apiKey.OrgID,
})
if err != nil {
@@ -116,7 +116,7 @@ func (s *APIKey) getFromTokenLegacy(ctx context.Context, token string) (*apikey.
}
// fetch key
keyQuery := apikey.GetByNameQuery{KeyName: decoded.Name, OrgId: decoded.OrgId}
keyQuery := apikey.GetByNameQuery{KeyName: decoded.Name, OrgID: decoded.OrgId}
if err := s.apiKeyService.GetApiKeyByName(ctx, &keyQuery); err != nil {
return nil, err
}
+4 -4
View File
@@ -43,8 +43,8 @@ func TestAPIKey_Authenticate(t *testing.T) {
},
}},
expectedKey: &apikey.APIKey{
Id: 1,
OrgId: 1,
ID: 1,
OrgID: 1,
Key: hash,
Role: org.RoleAdmin,
},
@@ -62,8 +62,8 @@ func TestAPIKey_Authenticate(t *testing.T) {
},
}},
expectedKey: &apikey.APIKey{
Id: 1,
OrgId: 1,
ID: 1,
OrgID: 1,
Key: hash,
ServiceAccountId: intPtr(1),
},