How to find page which is using specific user group for access

Hello,
I need to find a way, how to list all pages, which are using specific user group for access.
Example:
I have one group called RestrictedGroup. I can list all group members but I would also like to see all pages, where this group is used for controlling the access rights. Is there any trick how to do it?
Thanks
Jan

Note to @evalica: Is this use case taken into account in http://design.xwiki.org/xwiki/bin/view/Proposal/RightsUI9xCheck ? (ie could it be used to list all pages “viewables” by a given user/group too for example?).

@jans: this feature doens’t exist but it can be coded using scripting (http://platform.xwiki.org/xwiki/bin/view/DevGuide/Scripting). However it’s not very easy to do in a performant way. A quick way (but slow) would to iterate over all documents in the wiki and use an api to check if a given user or group has the permission you want to access it.

For example:

{{velocity}}
#foreach ($item in $services.query.xwql("where doc.space = 'Some.Space' or doc.space like 'Some.Space.%'").addFilter("unique").execute())
  * $item - $xwiki.hasAccessLevel('view', 'XWiki.SomeUser', $item)
#end
{{/velocity}}

if this is a common use case, we could implement the feature to support wildcards like (*) in the ‘Location’ input and just add the wanted group in the ‘User’ input.