Skip to main content
12-Amethyst
March 2, 2023
Solved

Find user license type programmatically

  • March 2, 2023
  • 1 reply
  • 1125 views

I'm working on a custom action which opens up a jsp when clicked. When the jsp opens, I want to check the users license type and allow only if the user has got a certain license type, for example - PTC View and Print Only. Please share me the snippet if anybody has done this earlier.

 

Best answer by HelesicPetr

Hi @MV_10441462 

 

It is simple, you need to get a PTC License group and check if the user is in. 

 

or in my example there is opposite way.

 

get all groups that user is in and check if the collection contains your interest the PTC Lincence group 

 

example>

WTPrincipal realUser = SessionHelper.manager.getPrincipal();
Vector<String> groupsList = UtilTeam.GetUserGroup((WTUser) realUser, realUser.getOrganization().getContainer());

boolean isUserInSAPgroup = groupsList.contains("SAP_Group");
boolean isUserAdmin = groupsList.contains("Administrators");

// use the booleans in conditions. 

 

PetrH

1 reply

HelesicPetr
22-Sapphire II
22-Sapphire II
March 2, 2023

Hi @MV_10441462 

 

It is simple, you need to get a PTC License group and check if the user is in. 

 

or in my example there is opposite way.

 

get all groups that user is in and check if the collection contains your interest the PTC Lincence group 

 

example>

WTPrincipal realUser = SessionHelper.manager.getPrincipal();
Vector<String> groupsList = UtilTeam.GetUserGroup((WTUser) realUser, realUser.getOrganization().getContainer());

boolean isUserInSAPgroup = groupsList.contains("SAP_Group");
boolean isUserAdmin = groupsList.contains("Administrators");

// use the booleans in conditions. 

 

PetrH

12-Amethyst
March 2, 2023

Thankyou so much.