3
0

Fix system data-privacy connection endpoint

- There was nil pointer due to dalConnection was not initialised in data-privacy struct.
- Update PrivacyDataConnection struct as per DalConnection struct, and responses accordingly
This commit is contained in:
Vivek Patel
2022-09-07 16:14:20 +05:30
parent 0bf47a2fc4
commit efc8a324b4
2 changed files with 34 additions and 18 deletions

View File

@@ -52,6 +52,7 @@ func DataPrivacy(s store.Storer, ac dataPrivacyAccessController, al actionlog.Re
store: s,
ac: ac,
eventbus: eb,
dalConn: DefaultDalConnection,
}
}
@@ -71,19 +72,23 @@ func (svc dataPrivacy) FindConnections(ctx context.Context, filter types.DalConn
err = cc.Walk(func(c *types.DalConnection) error {
pc := types.PrivacyDalConnection{
ID: c.ID,
Name: c.Meta.Name,
Handle: c.Handle,
Type: c.Type,
Location: c.Meta.Location,
Ownership: c.Meta.Ownership,
SensitivityLevel: c.Config.Privacy.SensitivityLevelID,
CreatedAt: c.CreatedAt,
CreatedBy: c.CreatedBy,
UpdatedAt: c.UpdatedAt,
UpdatedBy: c.UpdatedBy,
DeletedAt: c.DeletedAt,
DeletedBy: c.DeletedBy,
ID: c.ID,
Handle: c.Handle,
Type: c.Type,
Meta: types.PrivacyDalConnectionMeta{
Name: c.Meta.Name,
Ownership: c.Meta.Ownership,
Location: c.Meta.Location,
},
Config: types.PrivacyDalConnectionConfig{
Privacy: c.Config.Privacy,
},
CreatedAt: c.CreatedAt,
CreatedBy: c.CreatedBy,
UpdatedAt: c.UpdatedAt,
UpdatedBy: c.UpdatedBy,
DeletedAt: c.DeletedAt,
DeletedBy: c.DeletedBy,
}
out = append(out, &pc)
return nil

View File

@@ -102,14 +102,15 @@ type (
PrivacyDalConnection struct {
ID uint64 `json:"connectionID,string"`
Name string `json:"name"`
Handle string `json:"handle"`
Type string `json:"type"`
Type string `json:"type"`
// descriptions, notes, and other user-provided meta-data
Meta PrivacyDalConnectionMeta `json:"meta"`
Location geolocation.Full `json:"location"`
Ownership string `json:"ownership"`
SensitivityLevel uint64 `json:"sensitivityLevel,string,omitempty"`
// collection of configurations for various subsystems that
// use this connection and how it affects their behaviour
Config PrivacyDalConnectionConfig `json:"config"`
CreatedAt time.Time `json:"createdAt,omitempty"`
CreatedBy uint64 `json:"createdBy,string" `
@@ -119,6 +120,16 @@ type (
DeletedBy uint64 `json:"deletedBy,string,omitempty" `
}
PrivacyDalConnectionMeta struct {
Name string `json:"name"`
Ownership string `json:"ownership"`
Location geolocation.Full `json:"location"`
}
PrivacyDalConnectionConfig struct {
Privacy ConnectionConfigPrivacy `json:"privacy"`
}
RequestStatus string
RequestKind string
)