SOLVED

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

%3CLINGO-SUB%20id%3D%22lingo-sub-276334%22%20slang%3D%22en-US%22%3ESharePoint%20%22Sites%22%20Web%20Parts%20-%20Selected%20Sites%20Needs%20to%20be%20Security%20Trimmed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-276334%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20very%20real%20need%20to%20show%20only%20specific%20sites%20in%20a%20Sites%20Web%20Part.%20I%20know%20this%20is%20doable%20and%20have%20been%20successful.%20However%2C%20the%20issue%20is%20that%20when%20I%20select%20individual%20sites%2C%20the%20security%20trimming%20goes%20away.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20select%20%22all%20sites%20in%20this%20hub%2C%22%20the%20list%20IS%20security%20trimmed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20turn%20on%20the%20security%20trimming%20for%20a%20selected%20list%20from%20the%20Modern%20Sites%20Web%20Part%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-276334%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-277062%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20%22Sites%22%20Web%20Parts%20-%20Selected%20Sites%20Needs%20to%20be%20Security%20Trimmed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-277062%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20John.%20I%20figured%20that%20was%20the%20case.%20I%20understand%20about%20page%20performance%2C%20but%20this%20is%20definitely%20something%20that%20would%20benefit%20my%20company.%20I%20appreciate%20your%20response.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-277053%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20%22Sites%22%20Web%20Parts%20-%20Selected%20Sites%20Needs%20to%20be%20Security%20Trimmed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-277053%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20isn't%20currently%20a%20supported%20capability%20in%20the%20sites%20web%20part.%20In%20%22select%22%20mode%20you're%20defining%20specific%20sites%2Flinks%20to%20display.%20SharePoint%20displays%20them.%20If%20the%20user%20doesn't%20have%20access%20to%20the%20site%20they%20won't%20see%20the%20tidbits%20or%20info%20about%20the%20site%20(as%20we%20do%20a%20search%20query%20to%20retrieve%20that%20data%20from%20the%20site%2C%20as%20the%20user)%2C%20but%20they'll%20still%20see%20the%20site%20as%20you've%20specifically%20chosen%20to%20display%20it.%20This%20is%20similar%20to%20modern%20navigation%20and%20quick%20links.%20If%20you%20choose%20to%20display%20X%20site%2C%20we%20display%20it.%20If%20the%20user%20clicks%20it%2C%20they%20don't%20have%20access%20to%20it%20(of%20course).%20Security%20trimming%20explicitly%20added%20user%20content%20would%20seem%20to%20me%20to%20be%20counter-intuitive...%20not%20to%20mention%20not%20very%20performant%20for%20page%20loading%20(if%20every%20link%20added%20to%20every%20page%20had%20to%20be%20checked%20for%20permissions%20to%20simply%20display%20the%20link%20for%20every%20viewer).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAlways%20open%20to%20feedback%20on%20what%20we've%20created%2C%20and%20how%20we%20can%20improve%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-277014%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20%22Sites%22%20Web%20Parts%20-%20Selected%20Sites%20Needs%20to%20be%20Security%20Trimmed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-277014%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20I%20select%20%22All%20Sites%20in%20Hub%22%20the%20web%20part%20is%20security%20trimmed.%20I%20am%20only%20seeing%20what%20I%20have%20permission%20to.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20when%20I%20click%20on%20%22Select%20Sites%22%20and%20manually%20select%20the%20site%20to%20list%2C%20I%20see%20all%20the%20sites%20regardless%20if%20I%20have%20permission%20to%20see%20them.%20I%20get%20a%20%22You%20need%20permission%20to%20access%20this%20site%22%20when%20I%20click%20on%20them.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIdeally%2C%20I%20would%20like%20to%20be%20able%20to%20use%20the%20%22Select%20Sites%22%20but%20still%20have%20it%20security%20trimmed.%20Meaning%20of%20the%20sites%20I%20select%2C%20I%20still%20only%20see%20those%20I%20have%20permission%20to%20see.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-276469%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20%22Sites%22%20Web%20Parts%20-%20Selected%20Sites%20Needs%20to%20be%20Security%20Trimmed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-276469%22%20slang%3D%22en-US%22%3EIt%20should%20still%20do%20security%20trimming%2C%20similar%20to%20how%20news%20works.%20Are%20you%20sure%20it's%20not%20trimming%20the%20sites%3F%20Do%20you%20get%20an%20error%20on%20the%20sites%20where%20they%20show%20up%20at%20all%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1706369%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20%22Sites%22%20Web%20Parts%20-%20Selected%20Sites%20Needs%20to%20be%20Security%20Trimmed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1706369%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F10375%22%20target%3D%22_blank%22%3E%40John%20Sanders%3C%2FA%3E%26nbsp%3BThis%20absolutely%20not%20counter%20intuitive%20and%20the%20OOTB%20web%20part%20should%20really%20support%20it.%26nbsp%3B%20Say%20for%20example%20you%20have%20a%20SharePoint%20Hub%20that%20contains%20project%20sites%2C%20business%20unit%20sites%20and%20sites%20for%20communities%20(cross%20functional%20working%20groups%20or%20committees%20etc.).%20Then%20you%20might%20want%203%20pages%20with%20would%20show%20a%20selected%20sub-set%20of%20sites%20that%20fall%20into%20each%20category%20but%20only%20want%20each%20specific%20user%20to%20be%20shown%20links%20to%20the%20sites%20for%20which%20they%20have%20access.%26nbsp%3B%20So%20each%20page%20would%20show%20My%20Teams%2C%20My%20Communities%20and%20My%20Projects.%26nbsp%3B%26nbsp%3BWith%20the%20standard%20Sites%20web%20part%20you%20can't%20segregate%20sites%20and%20have%20then%20security%20trimmed.%26nbsp%3B%20It's%20all%20other%20nothing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20get%20the%20point%20about%20performance%20so%20why%20not%20have%20a%20simple%20checkbox%20to%20allow%20us%20to%20take%20the%20hit%20in%20scenarios%20where%20we%20need%20to.%26nbsp%3B%20Alternatively%2C%20the%20web%20could%20provide%20a%20simple%20filter%20which%20might%20work%20on%20the%20site%20title%20or%20(better%20still%20the%20description)%20in%20the%20way%20that%20the%20highlighted%20content%20web%20part%20does.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional 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 (Occasional Contributor)
Solution

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.