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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user