How to determine if a given node is visible to the public?
Hello!
I am trying to figure out if it's possible, via API, to determine if a given node is visible to the public. E.g. is the "read posts" permission granted by default on that node. (which I suppose isn't a FULL check of the whole permissions tree but probably adequate for our needs)
I've found that the roles collection will give you the list of roles for the node (https://developer.khoros.com/khoroscommunitydevdocs/docs/role-api-support#roles-collection-constraint-combinations ) - but that isn't actually helpful for figuring out what the permissions are, especially the DEFAULT permissions.
I've also found the coreNode.permissions.hasPermission (https://developer.khoros.com/khoroscommunitydevdocs/reference/permissionshaspermissionpermission_identifier) call - but I think this can only be used to check if the user in context has a specific permission, not whether or not a node has a certain default permission.
(I'm not actually a developer / won't be the one developing this, just trying to determine if a specific enhancement request is possible :-))
Thanks!!
coreNode.permissions.hasPermission context object probably is the closest you can get. But it's rather limited as you can only check for the current user AND current node. E.g. you cannot use it easily in a navigation component to show/hide elements without reading permissions.
I'm wondering what you are trying to build though that wouldn't work with Khoros built-in permissioning? The API is quite good at hiding stuff where the current user doesn't have read permissions. Isn't that sufficient for your use case?