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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How can I programmatically set Visibility, Runtime, and Designtime Collection level permissions (Things, Thing Templates,Mashups, Logs, etc.)?

nmiller1
1-Newbie

How can I programmatically set Visibility, Runtime, and Designtime Collection level permissions (Things, Thing Templates,Mashups, Logs, etc.)?

In the Thingworx Composer it is possible to set permissions at the entity collection level.

I'm looking through the API docs for a way to get an entity collection (e.g. Things, Mashups, etc.) and then set Visibility permissions for an Organization as well as set Designtime and Runtime permissions for User Groups.

1 ACCEPTED SOLUTION

Accepted Solutions

Thanks for the reply.

I'm trying to use the SDK, but the article may have pointed me in the direction I need to look.

I'm guessing I should look at CollectionsServices inside com.thingworx.resources.collections

and try to do something such as ...

    CollectionsServices collectionsServices = new CollectionsServices();

    try {

      collectionsServices.AddCollectionVisibilityPermission("Mashups", "MyOrg", "Organization");

Does this look correct to you?

View solution in original post

5 REPLIES 5

Does this knowledge base article help at all? Are you trying to do this in Javascript or in an SDK?

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS191141

Thanks for the reply.

I'm trying to use the SDK, but the article may have pointed me in the direction I need to look.

I'm guessing I should look at CollectionsServices inside com.thingworx.resources.collections

and try to do something such as ...

    CollectionsServices collectionsServices = new CollectionsServices();

    try {

      collectionsServices.AddCollectionVisibilityPermission("Mashups", "MyOrg", "Organization");

Does this look correct to you?

Yeah, this looks right to me. Anytime you are using capitalized service calls in the Extension SDK, they will behave the same way that they would within Composer if called on a Thing or from JS.

adrianpet
5-Regular Member
(To:nmiller1)

Hi,

     There is a glitch to this. You can set this permissions using the CollectionServices Resource inside a service in Thingworx only for RunTime Permissions and Visibility Permissions, but they don't work for DesignTime Permissions. In order to set the DesignTime Permissions i suggest you make an Thingworx Extension for this(at least this is the way I did it, in order to set design time permissions on collections).

Thanks,

Adrian

Thanks for the feedback.  I hadn't considered that there would be a difference.  Fortunately this is an enhancement to an existing extension we already have in place so (luckily) setting the designtime permissions worked fine.  But this is still good information to have.

Top Tags