Skip to content

Commit

Permalink
modify care team confirmation context for alerting
Browse files Browse the repository at this point in the history
Care team invitation/confirmation contexts are currently a
clients.Permissions object. To support alerting, the context is extended to
include a alerts.Config (defined in platform).

The custom JSON unmarshaler allows flexibility in parsing the following
received contexts:

    1. The existing permissions only context
    2. A hybrid context with old-style permissions plus an alertsConfig
    3. A future context with a "Permissions" and an alertsConfig as sibling
       properties

When the API is migrated to scenario #3 above, the custom marshaler can be
removed.

Bringing in platform as a dependency brought many vendor changes as well.

Part of BACK-2500
  • Loading branch information
ewollesen committed Oct 2, 2023
1 parent ccec1a4 commit 606f8d8
Show file tree
Hide file tree
Showing 362 changed files with 75,708 additions and 1,656 deletions.
1 change: 1 addition & 0 deletions api/hydrophoneApi.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const (
STATUS_ERR_FINDING_USER = "Error finding the user"
STATUS_ERR_FINDING_CLINIC = "Error finding the clinic"
STATUS_ERR_DECODING_CONFIRMATION = "Error decoding the confirmation"
STATUS_ERR_DECODING_CONTEXT = "Error decoding the confirmation context"
STATUS_ERR_CREATING_PATIENT = "Error creating patient"
STATUS_ERR_FINDING_PREVIEW = "Error finding the invite preview"

Expand Down
10 changes: 7 additions & 3 deletions api/invite.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,13 @@ func (a *Api) AcceptInvite(res http.ResponseWriter, req *http.Request, vars map[
return
}

var permissions commonClients.Permissions
conf.DecodeContext(&permissions)
setPerms, err := a.gatekeeper.SetPermissions(inviteeID, invitorID, permissions)
ctc := &models.CareTeamContext{}
if err := conf.DecodeContext(ctc); err != nil {
statusErr := &status.StatusError{Status: status.NewStatus(http.StatusBadRequest, STATUS_ERR_DECODING_CONTEXT)}
a.sendModelAsResWithStatus(res, statusErr, http.StatusBadRequest)
return
}
setPerms, err := a.gatekeeper.SetPermissions(inviteeID, invitorID, ctc.Permissions)
if err != nil {
log.Printf("AcceptInvite error setting permissions [%v]\n", err)
a.sendModelAsResWithStatus(
Expand Down
42 changes: 32 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,78 @@ module github.com/tidepool-org/hydrophone
go 1.19

require (
github.com/aws/aws-sdk-go v1.34.22
github.com/golang/mock v1.5.0
github.com/aws/aws-sdk-go v1.35.3
github.com/golang/mock v1.6.0
github.com/gorilla/mux v1.8.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/pkg/errors v0.9.1
github.com/tidepool-org/clinic/client v0.0.0-20230530132534-34c26ecb89ee
github.com/tidepool-org/clinic/client v0.0.0-20230815132146-bd6c2982ff6d
github.com/tidepool-org/go-common v0.10.1-0.20230508194719-72b56b95a79a
github.com/tidepool-org/platform v1.33.1-0.20231002152532-fcc215f0afe0
go.mongodb.org/mongo-driver v1.11.1
go.uber.org/fx v1.13.1
go.uber.org/zap v1.16.0
)

require (
github.com/Shopify/sarama v1.27.0 // indirect
github.com/ant0ine/go-json-rest v3.3.2+incompatible // indirect
github.com/avast/retry-go v3.0.0+incompatible // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/cloudevents/sdk-go/protocol/kafka_sarama/v2 v2.2.0 // indirect
github.com/cloudevents/sdk-go/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deepmap/oapi-codegen v1.11.0 // indirect
github.com/eapache/go-resiliency v1.2.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/fatih/color v1.9.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/githubnemo/CompileDaemon v1.4.0 // indirect
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/jcmturner/gofork v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.3.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/lightstep/tracecontext.go v0.0.0-20181129014701-1757c391b1ac // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mjibson/esc v0.2.0 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/onsi/ginkgo v1.16.4 // indirect
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
github.com/radovskyb/watcher v1.0.7 // indirect
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.1 // indirect
github.com/xdg-go/stringprep v1.0.3 // indirect
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c // indirect
github.com/xdg/stringprep v1.0.0 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.opencensus.io v0.22.0 // indirect
go.opencensus.io v0.22.4 // indirect
go.uber.org/atomic v1.6.0 // indirect
go.uber.org/dig v1.10.0 // indirect
go.uber.org/multierr v1.5.0 // indirect
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
golang.org/x/net v0.0.0-20220513224357-95641704303c // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/oauth2 v0.4.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/tools v0.9.3 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/jcmturner/aescts.v1 v1.0.1 // indirect
gopkg.in/jcmturner/dnsutils.v1 v1.0.1 // indirect
gopkg.in/jcmturner/gokrb5.v7 v7.5.0 // indirect
gopkg.in/jcmturner/rpc.v1 v1.1.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
)
Loading

0 comments on commit 606f8d8

Please sign in to comment.