SOLVED

Show content based on user permission (group)

Iron Contributor

I have SP modern site.

How can i hide or show content on a site if the user is part of a specific group or not?

 

I want to hide some content if the user is not member of a specific group.

 

15 Replies
Hello Oskar, is it a Team or communication site ?

@ArefHalmstrand 

i woud say both... i am looking to do this on communication sites and team sites.

 

idea i have is that i want to build a site on different locations and show content based on who the viewer is. maybe this is not possible?

@Oskar Kuus 

Okay! There are many ways to solve permission challenges. However, because MS Teams is so frequently used, I strongly recommend using team sites for the content, while communication sites can be used as landing page that fetches that content. The content can be easily shown with the beautiful "highlighted content" web part. 

So, for each area with unique content and permissions:
Create a team site, connect it to MS Teams. Have a communication site as a landing page for all these people who will have access to this information. Make the communication site dynamic by connecting it to hub sites and use highlighted content web part (there are more good web parts to use).

@ArefHalmstrandok you lost me :)

 

i dont know what you mean by half of what you are writing. connecting to a hub-site etc....

 

I have a SP site/page

On this have a  webpart containing a bunch of links

I want that webpart to show if the user is part of group A

if user is not part of group A, then i want to show another webpart for the user.

 

or another solution could be.

if user is part of group A. then redirect user to xxx adress.

if user is not part of group B, then redirect user to yyy adress.

 

i want to point all users to one site. but show them personalized content based on the group they are member of.

 

@Oskar Kuus 

Haha I am sorry! Let me ask, what version of SharePoint are you using? Is it on-premises or SharePoint Online?

@ArefHalmstrandno clue on how to check sharepoint version.

we are using sharepoint online.

 

 

@Oskar Kuus 

Okay good! :)  SharePoint Online is updated regularly and you as a consumer does not need to think about version number.

@Oskar Kuus 

Give me 10-20 minutes to finish something and I will come back to this chat to explain how you can solve your current challenge :)

@ArefHalmstrandthank you very much! No rush tho, time is midnight here so ill be falling asleep soon :)

@Oskar Kuus 

No worries, I will write it all down and you can check on it whenever it suits you :) 

So what I will do is to first explain the major differences between communication sites and team sites, use of hub sites and why its important. The architecture I will present to you is one solution that I personally believe to be strongest on the long run. However, with that said, there are many other ways to solve your current challenge. 

Finally, If you would like a demo or more help to setup the architecture, I could gladly help through MS Teams.

best response confirmed by Oskar Kuus (Iron Contributor)
Solution

@Oskar Kuus  , If this answer below was what you were looking for, could you please mark as best answer? 

The new modern sites consist of Communication sites, Team sites and ultimately Hub sites.

Communication Site
The communication site is way better when it comes to design, you have the possibility to use full-width web parts and the default templates that exists are perfect examples for why communication sites are meant to be landing pages. Communication sites alone are not so useful, they have no connection to Microsoft 365 groups and can not be connected to MS Teams. However, using a communication site as a landing page, it can be upgraded to a Hub site. To update the communication site into a Hub site, please visit the SharePoint Admin center and you will find the configuration button in the menu. I will explain more about Hub sites later.

Team site
The name really says it all. The site is created with a purpose to help a team work together. Microsoft 365 group is created and with these groups, you can add people that should have access to specific content. The Team site can be connected to MS Teams and that gives you the possibility to allow your users to communicate and work with files both in SharePoint and Teams. The strength of Team site connected to MS Teams is the flexibility to work everywhere. Co-authoring, chatting inside of documents and all secured while the conversations are saved in MS Teams. Team sites are powerful to handle teams and their content in a secure way. However, this does not solve your issue because you need one site that all users access, and see their own content, in a secure way. This will be solved by using a Hub site.

 

Hub site

The Hub site is created by activating the Hub site feature on a communication site through the SharePoint admin center. The Hub site by itself is not really anything special. However, in the SharePoint admin center, select your team sites and connect them to your new Hub site. By connecting sites to the Hub, you allow the sites to communicate with each other (something truly underestimated, hats of to the developers!). Connecting sites together, allows you to fetch data from any of the connected sources, simply by selecting the site while editing a web part. By default the SharePoint Search bar will be searching through your entire hub. The content shown and searchable is always content that you have access to. So when the access is handled by Microsoft 365 groups, you do not need to be worry about anything (as long as you do not have shadow admins).

 

Highlighted content web part

This is one of my favorite out-of-the-box web parts. It is included in SharePoint Online and you simply need to add it in your communication site while editing the page. When the web part is on place, you will most likely see content immediately. Click on the pen to the left of the web part (edit-icon), and there you will have the possibility to add or remove sites that should show data. Everything connected through the Hub site configuration that you made before. 

I hope this gave you some inspiration and idea on how to solve your challenge. For further assistance, please contact me and we will see what we can do. :) 
 

@ArefHalmstrand Thanks so much for this excellent and concise explanation.  I am considering something similar so the timing on this is perfect! 

I do, however, have two questions that I just want to confirm or get more clarification: 

 

1. I'm not sure what you mean by this phrase under the Hub section: "Connecting sites together, allows you to fetch data from any of the connected sources, simply by selecting the site while editing a web part. "  I suspect here that you mean to select the source site when setting up the highlighted web part. 

2. Will the Team to which you are referring have multiple groups in it or is there a Team for each group?  It sounds like 1 team. 

Have not yet used the Highlighted Content Web part.  Based on your recommended, I'm looking forward to checking it out!  


@Cindy Zalme 

I am glad that I can help! :) 

1. You are correct! If you have five different sites connected to the Hub site, in the web part, you can decide to fetch content from all five, or only three, set unique filters and rules to how and what content should be shown.

 

2. Each team will have its own group. 1 MS365 group (also known as Office 365 group) per team. 

 

I hope it works out as you hoped! Good luck :) 

@ArefHalmstrand Got it!  Thank you ever so much! 

You are so welcome! If this helped you, could you please like my messages? I am trying to build some statistics on my posts in relation to best answers and likes. :)
1 best response

Accepted Solutions
best response confirmed by Oskar Kuus (Iron Contributor)
Solution

@Oskar Kuus  , If this answer below was what you were looking for, could you please mark as best answer? 

The new modern sites consist of Communication sites, Team sites and ultimately Hub sites.

Communication Site
The communication site is way better when it comes to design, you have the possibility to use full-width web parts and the default templates that exists are perfect examples for why communication sites are meant to be landing pages. Communication sites alone are not so useful, they have no connection to Microsoft 365 groups and can not be connected to MS Teams. However, using a communication site as a landing page, it can be upgraded to a Hub site. To update the communication site into a Hub site, please visit the SharePoint Admin center and you will find the configuration button in the menu. I will explain more about Hub sites later.

Team site
The name really says it all. The site is created with a purpose to help a team work together. Microsoft 365 group is created and with these groups, you can add people that should have access to specific content. The Team site can be connected to MS Teams and that gives you the possibility to allow your users to communicate and work with files both in SharePoint and Teams. The strength of Team site connected to MS Teams is the flexibility to work everywhere. Co-authoring, chatting inside of documents and all secured while the conversations are saved in MS Teams. Team sites are powerful to handle teams and their content in a secure way. However, this does not solve your issue because you need one site that all users access, and see their own content, in a secure way. This will be solved by using a Hub site.

 

Hub site

The Hub site is created by activating the Hub site feature on a communication site through the SharePoint admin center. The Hub site by itself is not really anything special. However, in the SharePoint admin center, select your team sites and connect them to your new Hub site. By connecting sites to the Hub, you allow the sites to communicate with each other (something truly underestimated, hats of to the developers!). Connecting sites together, allows you to fetch data from any of the connected sources, simply by selecting the site while editing a web part. By default the SharePoint Search bar will be searching through your entire hub. The content shown and searchable is always content that you have access to. So when the access is handled by Microsoft 365 groups, you do not need to be worry about anything (as long as you do not have shadow admins).

 

Highlighted content web part

This is one of my favorite out-of-the-box web parts. It is included in SharePoint Online and you simply need to add it in your communication site while editing the page. When the web part is on place, you will most likely see content immediately. Click on the pen to the left of the web part (edit-icon), and there you will have the possibility to add or remove sites that should show data. Everything connected through the Hub site configuration that you made before. 

I hope this gave you some inspiration and idea on how to solve your challenge. For further assistance, please contact me and we will see what we can do. :) 
 

View solution in original post