cancel
Showing results for 
Search instead for 
Did you mean: 

Limit people finder results to Site Colleagues ?

volkerlux
Champ in-the-making
Champ in-the-making
Hello,

i'm trying to manage the access-rights in Share and i stumbled upon a problem within the people finder. A user can search for every person within Share, be it a site colleague or not. This is a bit problematic since there may be users which shouldnt be visible to each other (e.g. competitors).
How can i solve this issue to limit the search results to display ONLY the people within the users Site(s)?

regards,
Volker
5 REPLIES 5

kevinr
Star Contributor
Star Contributor
The People Finder calls the repository service: /api/people?filter={filterQuery}

This service is implemented by the webscript defined in: people.get.desc.xml. So you would need to change the People Finder component client-side javascript to call a different (or overridden) webscript to perform a different search. I think you will need to implement your own repository side search that constrains the results to users within site groups that are appropriate for the current user.

Hope this helps,

Kev

volkerlux
Champ in-the-making
Champ in-the-making
thanks for your tip, kev. I'm thinking about another approach: Is it possible to hide the complete people search for users with a specific role, for instance "consumer"? Where/How can i handle the Accessibility of GUI elements for different User Roles?

-Volker

kevinr
Star Contributor
Star Contributor
Yes this can be done quite easily. The REST API to retrieve the current user site memberships is used often in our components, for example in members-bar.get.js:

      var json = remote.call("/api/sites/" + page.url.templateArgs.site + "/memberships/" + encodeURIComponent(user.name));
      if (json.status == 200)
      {
         obj = eval('(' + json + ')');
      }

The json object returned contains the site membership details for the given user in the give site.

You could then block out areas of the page with an appropriate #if statement in the freemarker etc.

Kev

volkerlux
Champ in-the-making
Champ in-the-making
Thanks!

rhannink
Champ on-the-rise
Champ on-the-rise
Hello,

Thanks for the post above, but the information is a bit to limited for me.

How do I put together the REST API call and the Freemarker file?

Does anyone have a code example?

With kind regards,

Remco