cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

how to set RUNTIMEPERMISSION for specific service?

sabharees
13-Aquamarine

how to set RUNTIMEPERMISSION for specific service?

Hi, I need to set run time permission for specific service(eg. ChangePassword() ) to particular users.

I tried using AddRunTimePermission() but I am getting invalid service name error.

 

Users[testUser].AddRunTimePermission({
allow: true /* BOOLEAN */ ,
principal: testUser/* STRING */ ,
resource: "ChangePassword" /* STRING */ ,
type: "ServiceExecute" /* STRING */ ,
principalType: "User" /* STRING */
});

 

err : 36JavaException: java.lang.Exception: Invalid Permission Type : [ServiceExecute]

1 ACCEPTED SOLUTION

Accepted Solutions
sabharees
13-Aquamarine
(To:sabharees)

Hi All,

the correct code for enabling permission to particular code : 

 

 

Users[username].AddRunTimePermission({
allow: true /* BOOLEAN */ ,
principal: username /* STRING */ ,
resource: "your service name 1, your service name 2" /* STRING */ ,
type: "permission type" /* STRING */ ,
principalType: "User" /* STRING */
});

 

Got answers by myself, hope this will be helpful for others too... 

View solution in original post

1 REPLY 1
sabharees
13-Aquamarine
(To:sabharees)

Hi All,

the correct code for enabling permission to particular code : 

 

 

Users[username].AddRunTimePermission({
allow: true /* BOOLEAN */ ,
principal: username /* STRING */ ,
resource: "your service name 1, your service name 2" /* STRING */ ,
type: "permission type" /* STRING */ ,
principalType: "User" /* STRING */
});

 

Got answers by myself, hope this will be helpful for others too... 

Top Tags