6 Replies Latest reply on Oct 27, 2015 8:24 AM by paic RSS
    ngarner-2 Explorer

    Templates as a method of filtering?

    Hello,

    I'm a new Thingworx user, scheduled for training in a month but getting my hands dirty in the meantime.  The following question is a bit on the newbie side of things.

     

    Consider a situation where a solution provider is going to sell hardware that logs data to a Thingworx installation.  Customers who buy the hardware will log into Thingworx with their own account tied to an organization an be presented with a generic mashup that (hopefully) only shows them the devices they purchased.

     

    - The hardware has a Thing Shape with properties defined.

    - A Thing Template is created that uses that shape.

    - A Thing is created based on that template.

     

    If I sell 10 of these things to one customer and 10 to another customer, I don't want them to see each other's things.

     

    In the mashup, if I use getImplementingThingsWithData on the Template then each user would see 20 devices provided I enable Service permission for both/all Users on the template.

     

    If I modify permissions on the Things themselves then I can keep the users from seeing the properties of the things but the things would still show up in a grid widget that uses the template's getImplementingThingsWithData as the data source.

     

    What is best practice in situations like this?

    Create two templates, one per customer and just enable permissions on that template for the particular customer?

    Or, is there a way to, say, get all things with tag "customer1" that use template "XYZ" and use the resulting All Data as input to the grid widget?

     

    Thank you for any pointers,

    Nick

     

    P.S. Everyone keeps mentioning a wiki.  Is this the 6.5 Wiki?

    http://support.ptc.com/cs/help/thingworx_hc/thingworx_6.5_hc/

      • Re: Templates as a method of filtering?
        ngarner-2 Explorer

        I think I might have answered my own question using tags/terms and taking the current session tags and using it as input to queryImplementingThingsWithData.

         

        Nick

        • Re: Templates as a method of filtering?
          carlesc Ninja

          Hi Nick,

           

          For this mater ( Multi-Tenancy ) you have Organizations, that's all what you need, you "cut" visibility to each tenancy assigning a Organization to each one, that's all.

           

          Wiki, there's no wiki anymore, existed before ThingWorx becoming a PTC company, now what you have it's:

          Best Regards,

          Carles.

          • Re: Templates as a method of filtering?
            paic Collaborator

            This is something we call multi-tenancy.

            Use 1 template for all Things, but use an Organization and the Visibility Security.

            When that is in place and you do let's say GetImplementingThings it will only return the Things that the User has Visibility permissions to.

              • Re: Templates as a method of filtering?
                ngarner-2 Explorer

                EDIT:

                I was able to get this working by using a single organization with subunits representing the customer accounts and by completely blowing away the Thingworx installation and starting from scratch.  I'll leave the text below for posterity.

                 

                Thank you,

                Nick

                 

                _______________________Original Below_______________________

                 

                Hi Pai and Carles,

                I've been playing quite a bit with organizations and multi-tenancy today, thank you for the pointers.  I watched the video and read the docs and implementing it does restrict visibility to everything.  I did the visibility modification to PlatformSubsystem to fix the Mashup Widget Style issues.

                 

                However, I still have a problem with getting only devices assigned to an organization.  getImplementingThingsWithData doesn't seem to care about the visibility of the things that are derived from the template.  In order for getImplementingThingsWithData to return things the Organization has to have visibility to the template and then Run Time permission for service execute (non-instance).  As soon as you add visibility to a Thing Template to be able to do service execution (to getImplementingThingsWithData) all items get returned, even items the users doesn't have visibility to.  This is same template, same mashup, two users in different orgs, two different devices with visibility set to one org.  As soon as I add Visibility to the template to both orgs, the getImplentingThingsWithData returns both devices for both users, not just the devices visible to the user.  Do I need to manually do any visibility permission checks in the mashup?

                 

                Are you aware of any documents that walk through implementing multi-tenancy with mashups, not just looking at /Thingworx/Server/Things to verify the visibility is working?

                 

                Thank you and sorry for being that new guy that asks a bunch of questions.

                 

                Nick