Impersonation from server-side script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I am trying to create a custom server-side step config to add groups/roles to an existing user created part of previous steps or reusable tests, and it seems the executing user should have admin or test designer permissions to do groups/roles to users.
So, I did like below, and it is not working or group/roles getting added. Is there any additional points to consider here or missing anything? Appreciate any inputs.
//Get current user
var current_user = gs.getUserID();
//Impersonate user with permissions to alter user record
gs.getSession().impersonate(inputs.admin_or_test_designer_user);
//My Groups addition code
//Impersonate back to original condition
gs.getSession().impersonate(current_user);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Tanushree Maiti Thanks. And, Yes I agree and using the Create User step for all the scenarios. But my ask is different as ATF still has lot of limitations when it comes to testing, modularizing the code, reusability, etc., and using different ways to solve is by creating custom step configs, reusable tests, etc.
Create User has Impersonation option which is recommended by ServiceNow, and just trying to use the same but in different need as I have user created already using the Create a User step.