This use-case simulates an organization that prepares taxes for its clients.
A Professional
needs to access a Client
's Document
in order to prepare their taxes. There are two rules that grant access:
-
That the
Professional
has been granted access to the document. This could be becausea. she belongs to an organization whose features (service line, location, etc.) are a match for features of the
Document
, orb. because she has been granted ad hoc access.
-
That the
Client
has given consent for professionals in a particular country to look at documents they own. A consent is modeled as aConsent
entity, which is passed in with the authorization request'scontext
.
Rules 1a and 2 are expressed as static policies, and rule 1b is expressed as a link to a template.
Rules 2 is expressed as a forbid
rule so that it affects any ad hoc permit
policies added later. Alternatively, it could have been expressed as an additional when
clause in the permit
policies, both the static one and the template.
The test setup defines the following entities, in entities.json
:
Professional
sAlice
andBob
. They are both part oforg-1
in thecorporate
serviceline, and are located atIAD
andJFK
, respectively.Client
Ramon
is contracting with thecorporate
servicelineDocument
sABC
andDEF
, owned byRamon
, and located atIAD
andJFK
, respectively.
The setup also includes file linked
, which links the ad-hoc access template to grant Alice
access to document DEF
.
Then we have five scenarios:
- Alice requests access to ABC -- this is allowed per rules 1a and 2: Alice is part of the appropriate serviceline, organization, and location, and the request shows that her particular location has been consented to
- Alice requests access to DEF -- this is allowed per rules 1b and 2: She has been granted ad hoc access, and the request shows that her particular location has been consented to
- Bob requests access to DEF -- this is allowed per rules 1a and 2.
- Alice requests access to ABC -- this time the request is denied because rule 2 is not satisfied: the provided consent does not include Alice's location
- Bob requests access to ABC -- this is not allowed because neither rules 1a nor 1b are satisfied.