We are trying to get all polls of a user with in a selected site through keitai services(method name is findAllPollsForUserAndSitesAndPermission).
When we request one site polls it's returning polls of another sites also.
Steps to reproduce:
1. Login as user
2. User should have more sites(min 8) as this issue can be reproduced when user has more sites
3. Add polls tool to each site
4. Create at least one poll in each site
5. Get list of polls of each site using keitai service by passing site Id
webservice url: http://localhost:2016/direct/polls/site/siteID.json
6. Check the poll collection information in returned json format
Always polls of specific site should be displayed.
You can observe that polls of a site is appearing when accessing another site's polls.
I found that this issue occurring due to code in findAllPollsForUserAndSitesAndPermission(
,,-) method of PollListManagerImpl.java class
Root cause of this issue is "for loop" condition to filter requested sites is breaking without checking all allowed sites as allowedSites list is getting modified while looping over it.
Please validate the attached patch.