Conversation
| ([db identity default-allow? values-map] | ||
| ([db identity] | ||
| (wrap-identity-policy db identity nil)) | ||
| ([db identity values-map] |
There was a problem hiding this comment.
I think removing default-allow? is a breaking change. What's the best way to manage it? (I'm very much in favor of removing it)
There was a problem hiding this comment.
Policy queries were just introduced and we are pre-release so I'm not concerned about it.
dpetran
left a comment
There was a problem hiding this comment.
This removes the default-allow? flag for creating a policy-wrapped db and requires the user to specify a policy they can use to read or modify the db. It also provides an example policy that provides read-all/modify-all authorization.
One thing I'm not clear on, though, is what "default" means now. By my read we are removing the default and now there is no default, the user must always be explicit. Or is there some fallback mechanism I missed?
I think of it as default, and the old method was default as well - it was just inflexible. This is now flexible and definable in policies. Default means it doesn't target a property or a class, so it is for "everything else" where no explicit policy exists. |
Removes
default-allow?policy flag in favor of default policies.When looking at configuring fluree/server for zero-trust, it introduced the challenge of specifying a config for
default-allow?on a per ledger basis. This made it clear that this behavior really belonged as part of the policy itself, and such a config shouldn't be needed.Having the 'default' behavior part of the policy also offered these enhanced capabilities:
As we look to have zero-trust mode, this also makes it possible to create a 'root' policy (just a default policy that always returns truthy) and attach it to an identity, presumably the same identity that created the ledger. This is how v2 worked.
Creating a 'root' policy is just like any other policy, except there is no
f:onPropertyorf:onClassspecified (thus, default). The following is the most permissive/simple example of a root policy:To attached an identity to the above policy, just use
f:policyClassset to the@typein the policy define above (ex:RootPolicy):While any query
wherecondition can be specified forf:query- an empty map has no where condition, so it allows?$thisto just flow through (truthy).