Only users with Admin or Resource Manager role should be able to log in into instance
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 06:14 PM
Only users with Admin or Resource Manager role should be able to log in into instance In Particular domain scope and
Users with any other roles can only access through ESC portal
My client instance was domain seperated. So here I need to control the users who login only on particular domain which is xyz-domain in that I need to check for users when they login they having admin or itil role. if the have I need to redirect them to /now/nav/ui/home
else I need to redirect them to esc home
var SPEntryPage = Class.create();
SPEntryPage.prototype = {
initialize: function() {
this.logVariables = true; // for debugging
this.portal = "/esc"; // The URL suffix specified in the sp_portal record
},
getFirstPageURL: function() {
var session = gs.getSession();
this.logProperties('before', session);
// has roles and is not a Service Portal page - go to UI16
var nt = session.getProperty("nav_to");
var isServicePortalURL = new GlideSPScriptable().isServicePortalURL(nt);
var redirectURL = session.getProperty("login_redirect");
// var grUser = new GlideRecord('sys_user');
// grUser.get(userID);
// var domain = grUser.sys_domain;
// If the user's domain is 'Domain Scope Name'
if (gs.getSession().getCurrentDomainID() == 'xyz domain name') {
if (!user.hasRole('itil') && !user.hasRole('admin')) {
gs.log("ESC Test Redirection");
return '/esc';
}
}
type: 'SPEntryPage'
};
Here I tried multiple way to get this working but no use please can any one help me on this?
Thanks & Regards
A. Nataraj
0 REPLIES 0