Skip to main content
1-Visitor
May 24, 2016
Solved

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

  • May 24, 2016
  • 2 replies
  • 3989 views

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.

Best answer by nmiller1

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?

2 replies

5-Regular Member
May 24, 2016

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

nmiller11-VisitorAuthorAnswer
1-Visitor
May 25, 2016

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?

5-Regular Member
May 26, 2016

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.

5-Regular Member
May 26, 2016

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

nmiller11-VisitorAuthor
1-Visitor
May 26, 2016

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.