Examples include:
- Updating the hierarchy of resources during an application change.
- Refactoring policy code to add new authorization features.
Example scenario: renaming a role
Suppose you have a simple RBAC setup where users can have roles on organizations:admin role to owner, perhaps to broaden admin capabilities and make it a distinct role.
You cannot simply update the policy and replace all instances of admin with owner.
If you did, the existing admins would lose their permissions until you updated the has_role facts to use owner roles.
Because Oso policies are written in Polar, you can write temporary rules that bridge old facts to new ones, ensuring consistent authorization behavior during transitions.
Update steps
Follow these four steps to safely update facts and policies:- Deploy new policy with bridge rules
admin facts to owner facts:
- Deploy updated application code
owner facts to Oso Cloud.
At this point, aside from the bridge rule above, no code or policy needs to reference admin facts.
You could stop here if you are comfortable keeping the old admin facts. However, we recommend cleaning up both old facts and interim bridge rules.
- Batch update facts
has_role(User, "admin", Org) fact, insert a corresponding has_role(User, "owner", Org) fact.
If desired, clean up old facts with the Batch API as well with payload [{"deletes": <bulk_data>}]..
Example workflow:
- Fetch existing
adminrole facts with the Get API. - Insert new
ownerrole facts and delete oldadminfacts with the Batch API.
- Remove bridge rules
admin facts are fully replaced with owner facts, remove the temporary bridge rules from your policy.