The CreatorCon Call for Content is officially open! Get started here.

Can we restrict a role to navigate to Portal URL?

gazalagrawa
Mega Contributor

Hi All,

 

I have an agent role where the requirement is to restrict this role to stop navigating to Customer Service Portal through URL. In the app navigator the module is not available. The ask is this agent can only access workspace but not portal. Is this possible?

7 REPLIES 7

RaghavSh
Kilo Patron

So only single page of portal like homepage or any other portal page as well?


Raghav
MVP 2023
LinkedIn

Restriction is on entire Portal. Even if user is trying to navigate to url instanceurl/sp it should show 404 not found or not authorised kind of message.

@gazalagrawa There are multiple ways to do this:

 

1. If you want to to show 404, deactivate the portal from (sp_portal) table but it will not be accessible to anyone then.

2. If you want to just restrict it for /sp homepge only, the create a new widget and add that to homepage and do the redirection using below code.

 

// Server script of widget:

if(gs.getUser().hasRole('add your role name')){
data.redirect=true;
}

// Client script of widget:

if(c.data.redirect)
window.location.href = 'URL'; // add your url here

 

3. If you want to restrict all pages of portal and redirect it to some workspace, @Ankur Bawiskar has already mentioned a UI script in his answer.

4. I dn't think adding user criteria to individual portal pages is a good option as that will be a lot of work for you.


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023
LinkedIn

kaushal_snow
Mega Sage

@gazalagrawa , 

 

You can do it by configuring user criteria and applying them to the portal pages...

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

 

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/