Last active
May 5, 2019 16:35
-
-
Save jonathanjacob/cc4c3512fafe331a5d379d27606d4102 to your computer and use it in GitHub Desktop.
Service Portal Impersonation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Be sure and include spModal in the function | |
function ($rootScope, $scope, snRecordWatcher, spUtil, spModal, $location, $uibModal, cabrillo, $timeout) { | |
//Impersonation | |
$scope.openImpersonationDialog = function(){ | |
spModal.open({ | |
title: "Impersonate User", | |
widget: "service-catalyst-impersonate", | |
buttons: [ | |
{label:'Close', cancel: true} | |
], | |
widgetInput: {} | |
}).then(function(){ | |
console.log('closed impersonation'); | |
}) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class="dropdown-menu"> | |
<!-- Insert the line below approx (line 33) in Stock header --> | |
<li><a ng-if="data.canImpersonate" ng-click="openImpersonationDialog()">${Impersonate User}</a></li> | |
<!-- Insert the line above --> | |
<li><a ng-if="data.isImpersonating" ng-click="impersonate(data.realUser)">${Stop Impersonating}</a></li> | |
<li><a ng-href="?id=user_profile&sys_id={{::user.sys_id}}">${Profile}</a></li> | |
<li><a href="{{::portal.logoutUrl}}">${Logout}</a></li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Impersonation | |
data.canImpersonate = new GlideImpersonate().canImpersonate(gs.getUserID()); | |
data.isImpersonating = new GlideImpersonate().isImpersonating(); | |
data.realUser = gs.getImpersonatingUserName(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment