SharePoint "Sites" Web Parts - Selected Sites Needs to be Security Trimmed

Copper Contributor

I have a very real need to show only specific sites in a Sites Web Part. I know this is doable and have been successful. However, the issue is that when I select individual sites, the security trimming goes away. 


When I select "all sites in this hub," the list IS security trimmed.


Is there a way to turn on the security trimming for a selected list from the Modern Sites Web Part?

5 Replies
It should still do security trimming, similar to how news works. Are you sure it's not trimming the sites? Do you get an error on the sites where they show up at all?

When I select "All Sites in Hub" the web part is security trimmed. I am only seeing what I have permission to.


However, when I click on "Select Sites" and manually select the site to list, I see all the sites regardless if I have permission to see them. I get a "You need permission to access this site" when I click on them.


Ideally, I would like to be able to use the "Select Sites" but still have it security trimmed. Meaning of the sites I select, I still only see those I have permission to see.

best response confirmed by Beth Mahoneyadm (Copper Contributor)

This isn't currently a supported capability in the sites web part. In "select" mode you're defining specific sites/links to display. SharePoint displays them. If the user doesn't have access to the site they won't see the tidbits or info about the site (as we do a search query to retrieve that data from the site, as the user), but they'll still see the site as you've specifically chosen to display it. This is similar to modern navigation and quick links. If you choose to display X site, we display it. If the user clicks it, they don't have access to it (of course). Security trimming explicitly added user content would seem to me to be counter-intuitive... not to mention not very performant for page loading (if every link added to every page had to be checked for permissions to simply display the link for every viewer).


Always open to feedback on what we've created, and how we can improve it.

Thanks John. I figured that was the case. I understand about page performance, but this is definitely something that would benefit my company. I appreciate your response.

@John Sanders This absolutely not counter intuitive and the OOTB web part should really support it.  Say for example you have a SharePoint Hub that contains project sites, business unit sites and sites for communities (cross functional working groups or committees etc.). Then you might want 3 pages with would show a selected sub-set of sites that fall into each category but only want each specific user to be shown links to the sites for which they have access.  So each page would show My Teams, My Communities and My Projects.  With the standard Sites web part you can't segregate sites and have then security trimmed.  It's all other nothing.


I get the point about performance so why not have a simple checkbox to allow us to take the hit in scenarios where we need to.  Alternatively, the web could provide a simple filter which might work on the site title or (better still the description) in the way that the highlighted content web part does.