User does not have an ITIL role, but still able to access servicenow backend.

nehasr1288
Tera Expert

Hi,

 

I have only given access to service portal to my users and have not given them itil role but still users after they click on 'back' twice in the service portal are able to reach the backend servicenow.How to stop this?

 

find_real_file.png

1 ACCEPTED SOLUTION

You need to delete the script.

 

If you want it specific for Roles you can use below.

addLoadEvent(ESSUserRedirectSP);
function ESSUserRedirectSP() {
	if(g_user.userName != "guest"){
		if(!g_user.hasRoles()){ //This works for users with no role
			var topurl = getTopWindow().location.toString();
			
				var url = "https://" + window.location.host + "/portal_name";
					top.window.location = url;
				}
			}
		}
	}
}

 

Thanks,

Jaspal Singh

 

Hit Helpful or Correct on the impact of response.

View solution in original post

5 REPLIES 5

Jaspal Singh
Mega Patron
Mega Patron

Try using below UI script snippet

addLoadEvent(ESSUserRedirectSP);
function ESSUserRedirectSP() {
	if(g_user.userName != "guest"){
			var topurl = getTopWindow().location.toString();					var url = "https://" + window.location.host + "/portal_name"; //replace portal_name
					top.window.location = url;
				}
			}
		

 

Thanks,

Jaspal Singh

 

Hit Helpful or Correct on the impact of response.

Hi,

 

But due to this script I am not able to access the backend now.

Do you know how can I undo the script?

You need to delete the script.

 

If you want it specific for Roles you can use below.

addLoadEvent(ESSUserRedirectSP);
function ESSUserRedirectSP() {
	if(g_user.userName != "guest"){
		if(!g_user.hasRoles()){ //This works for users with no role
			var topurl = getTopWindow().location.toString();
			
				var url = "https://" + window.location.host + "/portal_name";
					top.window.location = url;
				}
			}
		}
	}
}

 

Thanks,

Jaspal Singh

 

Hit Helpful or Correct on the impact of response.