I could fetch all visitor groups and also visitor groups that a user belongs to.
However I have a requirement, that when a user visits a page, I need to show who all (visitor groups) can see the page. Couldn't find anything online through which I can fetch this data.
Does this help? It shows all visitor groups used on the page, also all visitor groups that are used on content on the page too.
This seems to be a good thing but I am not sure if it serves my purpose.
I need to show the list of visitor groups that have access to a page (content) when that page is viewed by user in front end. This is to let people be aware of all groups that can view that content.
I am already fetching list of visitor groups, also can fetch visitor groups that a user has access to but not the list of visitor groups that can see the page irrespective of logged in user.
If you are using visitor groups to control access to a page then this will be set in the AccessControlList (ACL). Just to confirm you mean visitor groups and not roles as defined in the admin UI?
Either way you can get hold of the AccessControlList using the ACL property of the page which gives you the roles and visitor groups that have access to content. From here you can work out the roles/visitor groups that have access to content.
Perfect. ACL was exactly what I was looking for. Big Thanks.