satellite/admin/back-office: Don't send project ID
The project ID must never be sent out from the server because old projects used that ID as salt for creating access grants. We must always expose the public ID and the server must retrieve the ID when the public ID is sent in to the server and needs it for performing some DB queries. Change-Id: I4a9d94049ef84f578b62907827d6c09dfd1db4db
This commit is contained in:
parent
94bbda81dc
commit
5d492a9e01
@ -35,7 +35,7 @@ type User struct {
|
||||
// StorageUsed, BandwidthUsed, and SegmentUsed are nil if there was
|
||||
// an error connecting to the Redis live accounting cache.
|
||||
type ProjectUsageLimits struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ID uuid.UUID `json:"id"` // This is the public ID
|
||||
Name string `json:"name"`
|
||||
StorageLimit int64 `json:"storageLimit"`
|
||||
StorageUsed *int64 `json:"storageUsed"`
|
||||
@ -87,7 +87,7 @@ func (s *Service) GetUserByEmail(ctx context.Context, email string) (*User, api.
|
||||
usageLimits := make([]ProjectUsageLimits, 0, len(projects))
|
||||
for _, project := range projects {
|
||||
usage := ProjectUsageLimits{
|
||||
ID: project.ID,
|
||||
ID: project.PublicID,
|
||||
Name: project.Name,
|
||||
}
|
||||
|
||||
|
@ -100,10 +100,10 @@ func TestGetUser(t *testing.T) {
|
||||
BandwidthLimit: &bandwidthLimit,
|
||||
SegmentLimit: &segmentLimit,
|
||||
}
|
||||
projects = append(projects, proj)
|
||||
|
||||
_, err := consoleDB.Projects().Insert(ctx, proj)
|
||||
proj, err := consoleDB.Projects().Insert(ctx, proj)
|
||||
require.NoError(t, err)
|
||||
projects = append(projects, proj)
|
||||
|
||||
_, err = consoleDB.ProjectMembers().Insert(ctx, user.ID, proj.ID)
|
||||
require.NoError(t, err)
|
||||
@ -153,7 +153,7 @@ func TestGetUser(t *testing.T) {
|
||||
for i, info := range user.ProjectUsageLimits {
|
||||
proj := projects[i]
|
||||
name := proj.Name
|
||||
require.Equal(t, proj.ID, info.ID, name)
|
||||
require.Equal(t, proj.PublicID, info.ID, name)
|
||||
require.Equal(t, name, info.Name, name)
|
||||
require.EqualValues(t, *proj.StorageLimit, info.StorageLimit, name)
|
||||
require.EqualValues(t, *proj.BandwidthLimit, info.BandwidthLimit, name)
|
||||
|
Loading…
Reference in New Issue
Block a user