Here is a requirement I am trying to implement via XACML/ABAC for learning purposes:
Information Model
Resources: Building, Unit
- there are many buildings (ex. B1, B2, B3, ... Bn)
- each building has many units (i.e. unit is the child of building) (ex. B1U1, B1U2, B1U3, ...)
Subject: Housekeeping staff
Rules
- A housekeeper can "open" a "unit" if
- they have "open" permission on that "unit" OR
- if they have "open" permission on the "building" in which that "unit" is.
Any pointers?
Update
Essentially here is my concern: if the requirement was something like, A housekeeper can "open" "unitX" if s/he has "open" permission on "unitX". Here I would've just written a simple rule.
However, with my actual requirement, the concerns are:
Since there is not one particular resource but many resources of same type, should I be writing a separate policy for each resource? Ex. separate policy for building "B1", another for "B2" and so on?
How will the policy "know" about hierarchical relationship between building and unit.
Now that I think further about this, I think the following approach should work(?)
- Request will include the following
resource: /{buildingId}/{unitId} //this is how policy will know parent child relationship
action: open
subject: subjectId and probably all permissions that this subject has (still thinking on how to represent the permissions, any suggestions?)
- Define one policy with rule: // pseudocode if(subject.permissions include open on {buildingId} OR open on {unitId}) then permit else deny.
Any suggestions?
Thanks,
Jatin