puck
puck copied to clipboard
Issues with permissions docs
Observed some issues with the permissions docs:
- The permissions API reference is missing description and links for
getPermissionsandrefreshPermissionsAPIs. - The
getPermissionsAPI example says it must typically be wrapped in a useEffect as resolving dynamic permissions will update the reference, but it also says that calling it will resolve dynamic permissions. This implies it would create an infinite loop. Either the docs are bad, or the API is wrong. Needs investigation.
Another issue with the permissions docs is that we don’t fully document which permissions are supported at each level. This could also be a problem with the permissions types, since we currently allow all permissions at all levels, even when some don’t apply:
- We currently allow all permissions at the root config level, even though the only one that makes sense is
edit(you can't delete, drag, insert, or duplicate the root). resolvePermissionscan return all permissions, butinsertdoesn’t make sense in that context. This is becauseresolvePermissionsonly applies to the instance where it's running, and in that case, the instance is already inserted, so disablinginserthas no effect.
We should improve the documentation on this, and probably adjust the types to reflect these distinctions more clearly.