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 can a user check whether he has permission for a service (in a Mashup)

dr1
6-Contributor
6-Contributor

How can a user check whether he has permission for a service (in a Mashup)

Hello IoT Community!


I would like to build my mashups in a way, that some buttons (or other widgets) are Enabled/Disabled depending on whether the user has the permission for the underlying service (e.g the service executed when clicking that button).

 

For that I thought I could write an expression that checks whether the current user has permission for a specific service. Do you have any Ideas how to write a simple expression for that?

As far as I know, an error is thrown when a user tries to execute a service he has no permission for. So maybe I could somehow "catch" the error in the expression?

Maybe something like
try(functionToExecute())

{

return true;

} catch(error){

return false;

}

 

Unfortunately I have no idea how to implement this behavior...

Any advices are appreciated very much!

Best Regards,
Dominik

1 ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:dr1)

What you mentioned is possible, but I think the better approach would be the use of User Groups and checking if a user is in a particular group.

So you can set up User Groups that define certain roles or permissions sets

'Manager' 'Operator' etc.

or 'xyz Read' 'xyz Update'

Then at whatever moment you can use 'GetCurrentGroups' to retrieve the user groups the user is part off and then verify that against your set of permissions groups and then apply enable/disable/visible/invisible

View solution in original post

2 REPLIES 2
PaiChung
22-Sapphire I
(To:dr1)

What you mentioned is possible, but I think the better approach would be the use of User Groups and checking if a user is in a particular group.

So you can set up User Groups that define certain roles or permissions sets

'Manager' 'Operator' etc.

or 'xyz Read' 'xyz Update'

Then at whatever moment you can use 'GetCurrentGroups' to retrieve the user groups the user is part off and then verify that against your set of permissions groups and then apply enable/disable/visible/invisible

dr1
6-Contributor
6-Contributor
(To:PaiChung)

Works like a charm, thanks a lot!

Top Tags