bsr: remove duplicate target scope info

We were storing the project ID both as part of the scope
and as a field directly on the target. Remove the extra field.
pull/3251/head
Johan Brandhorst-Satzkorn 3 years ago committed by Timothy Messier
parent 78ca8beb77
commit 74d10da7b4
No known key found for this signature in database
GPG Key ID: EFD2F184F7600572

@ -92,7 +92,6 @@ func (u User) writeMeta(ctx context.Context, c *container) error {
// Target contains information about the target for this session
type Target struct {
PublicId string
ProjectId string
Scope Scope
Name string // optional field
Description string // optional field
@ -113,10 +112,6 @@ func (t Target) writeMeta(ctx context.Context, c *container) error {
if err != nil {
return err
}
_, err = c.WriteMeta(ctx, "target_projectId", t.ProjectId)
if err != nil {
return err
}
if t.Name != "" {
_, err = c.WriteMeta(ctx, "target_name", t.Name)
if err != nil {

@ -3,5 +3,5 @@
.* wrappedPrivKey
.* pubKeyBsrSignature.sign
.* pubKeySelfSignature.sign
04fb6e9ce96c411f2ab185167d8b69a6d66d894d8620bf347e4003afe270f662 session.meta
c4b31c89766efe60d7c4041f37237e55e7fc4c5ba99a8f703e9f78d73d420eb8 session.meta
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 session.summary

@ -4,9 +4,9 @@ user_publicId: user123
user_scope_publicId: global
user_scope_type: global
target_publicId: target123
target_scope_publicId: global
target_scope_type: global
target_projectId: proj123
target_scope_publicId: proj123
target_scope_type: project
target_scope_parentId: org123
target_defaultPort: 0
target_sessionMaxSeconds: 0
target_sessionConnectionLimit: 0

@ -4,9 +4,9 @@ user_publicId: user123
user_scope_publicId: global
user_scope_type: global
target_publicId: target123
target_scope_publicId: global
target_scope_type: global
target_projectId: proj123
target_scope_publicId: proj123
target_scope_type: project
target_scope_parentId: org123
target_defaultPort: 0
target_sessionMaxSeconds: 0
target_sessionConnectionLimit: 0
@ -32,4 +32,4 @@ vcs123_vaultCredentialStore_vl123_vaultLibrary_publicId: vl123
vcs123_vaultCredentialStore_vl123_vaultLibrary_projectId: proj123
vcs123_vaultCredentialStore_vl123_vaultLibrary_vaultPath: /a/path
vcs123_vaultCredentialStore_vl123_vaultLibrary_httpMethod: GET
vcs123_vaultCredentialStore_vl123_vaultLibrary_credentialType: magic
vcs123_vaultCredentialStore_vl123_vaultLibrary_credentialType: magic

@ -3,5 +3,5 @@
.* wrappedPrivKey
.* pubKeyBsrSignature.sign
.* pubKeySelfSignature.sign
04fb6e9ce96c411f2ab185167d8b69a6d66d894d8620bf347e4003afe270f662 session.meta
c4b31c89766efe60d7c4041f37237e55e7fc4c5ba99a8f703e9f78d73d420eb8 session.meta
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 session.summary

@ -4,9 +4,9 @@ user_publicId: user123
user_scope_publicId: global
user_scope_type: global
target_publicId: target123
target_scope_publicId: global
target_scope_type: global
target_projectId: proj123
target_scope_publicId: proj123
target_scope_type: project
target_scope_parentId: org123
target_defaultPort: 0
target_sessionMaxSeconds: 0
target_sessionConnectionLimit: 0
@ -33,4 +33,4 @@ vcs123_vaultCredentialStore_vl123_vaultLibrary_projectId: proj123
vcs123_vaultCredentialStore_vl123_vaultLibrary_vaultPath: /a/path
vcs123_vaultCredentialStore_vl123_vaultLibrary_httpMethod: GET
vcs123_vaultCredentialStore_vl123_vaultLibrary_credentialType: magic
connection: conn_1.connection
connection: conn_1.connection

@ -4,9 +4,9 @@ user_publicId: user123
user_scope_publicId: global
user_scope_type: global
target_publicId: target123
target_scope_publicId: global
target_scope_type: global
target_projectId: proj123
target_scope_publicId: proj123
target_scope_type: project
target_scope_parentId: org123
target_defaultPort: 0
target_sessionMaxSeconds: 0
target_sessionConnectionLimit: 0
@ -32,4 +32,4 @@ vcs123_vaultCredentialStore_vl123_vaultLibrary_publicId: vl123
vcs123_vaultCredentialStore_vl123_vaultLibrary_projectId: proj123
vcs123_vaultCredentialStore_vl123_vaultLibrary_vaultPath: /a/path
vcs123_vaultCredentialStore_vl123_vaultLibrary_httpMethod: GET
vcs123_vaultCredentialStore_vl123_vaultLibrary_credentialType: magic
vcs123_vaultCredentialStore_vl123_vaultLibrary_credentialType: magic

@ -59,9 +59,12 @@ func TestSessionMeta(s string, p Protocol) *SessionMeta {
Address: "127.0.0.1",
},
Target: &Target{
PublicId: "target123",
ProjectId: "proj123",
Scope: scope,
PublicId: "target123",
Scope: Scope{
PublicId: "proj123",
Type: "project",
ParentId: "org123",
},
DefaultPort: 0,
SessionMaxSeconds: 0,
SessionConnectionLimit: 0,

Loading…
Cancel
Save