Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ORCA-57] Allow backend services to fetch a clinic by share code #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions auth/authorizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ var _ = Describe("Request Authorizer", func() {
Expect(err).ToNot(HaveOccurred())
})

It("allows backend services to fetch clinics by share code /v1/clinics/share_code/acmeclinic", func() {
input := map[string]interface{}{
"path": []string{"v1", "clinics", "share_code", "acmeclinic"},
"method": "GET",
"auth": map[string]interface{}{
"subjectId": "orca",
"serverAccess": true,
},
}
err := authorizer.EvaluatePolicy(context.Background(), input)
Expect(err).ToNot(HaveOccurred())
})

It("allows shoreline to list clinics for a given user id", func() {
input := map[string]interface{}{
"path": []string{"v1", "patients", "12345", "clinics"},
Expand Down
6 changes: 3 additions & 3 deletions auth/policy.rego
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ allow {
input.path = ["v1", "clinics", "share_code", _]
}

# Allow backend services to fetch a clinic by id
# GET /v1/clinics/:clinicId
# Allow backend services to fetch clinics by share code
# GET /v1/clinics/share_code/:shareCode
allow {
is_backend_service
input.method == "GET"
input.path = ["v1", "clinics", _]
input.path = ["v1", "clinics", "share_code", _]
}

# Allow currently authenticated clinician to update clinic
Expand Down