Setup user interfaces and ways to track events
Being able to view your logs is an important part of knowing what is happening in your system. You can't keep things secure if you don't know who is doing what.
These concepts and steps will allow you to focus on development of your application while still allowing the ability to utilize the power of ThingWorx!
We will teach you how to access the system in a way you might not have done much of before.
If you’d like to skip ahead, download the completed example of the Aerospace and Defense learning path attached: AerospaceEntitiesGuide1.zip. Import the .twx files included.
In an ever-changing world, you are going to need to protect everything that is considered private. In order to do this, you need to be able to track every bit of what is happening in your system.
ThingWorx does not provide an out of the box method to log when users open a Mashup window. What if this Mashup contains secure documents? Well, we can work with you on getting that logged and tracked.
Let us start working on securing our system by adding some Mashups that are simple, but we will add complexity around them. Before designing our Mashups, we will set permissions and go from there.
We will create a Mashup, but the focus will be the security of the Mashup, not the Design and UI itself. Follow the steps below to get started.
3, Select Responsive for the layout option.
4. Click Ok.
5. Enter a name for the Mashup Template, such as SecureMashupExample.
6. Click Save then click the Permissions tab.
7. On the Visibility tab, in the Search Organization text box, begin typing and select PTCDefenseDepartment. This allows anyone in the organization to be able to access this Mashup.
8. On the Runtime tab, in the Search Users and User Groups text box, begin typing and select Agency.IT.
9. Set all permissions to Allow (check). This allows a User Group to run services during Runtime of your application. Keep in mind, this gives permissions to all parts of the Mashup (Events, Subscriptions, Services, Parameters).
10. If you would like to be more specific, in the Search Properties, Services, or Events text box, select a service, ie GetHomeMashup. In the text box that appears below for Users and User Groups, select Agency.HumanResources.
11. On the Design Time tab, the Search Users and User Groups text box, begin typing and select Agency.IT.
12. In the Search Users and User Groups text box, begin typing and select Agency.HumanResource.
13. For Agency.IT, set the permissions to allow Read, Update, and Delete. For the Agency.HumanResource User Groups allow Read and deny Update and Delete.
You have just begun the process to securing the application from users looking to view specific secure pages. Next, let's create a simple page and show how we can log who accesses specific pages.
We will be creating a simple Mashup with the focus of showing how to add logging to a Mashup. Let's start by opening up the Mashup we just created.
When accessing this Mashup, nothing is logged. We'll be changing that in the next steps with a service that will be called and log who is using the Mashup.
We'll now need to call this logging service to see whenever a user has logged into our secure page. Of course, this is a simplified example and much more could be done here.
9. Click Save.
You now have a Mashup that will log the UI being opened and the user accessing that UI whenever it is opened. Click View Mashup and go to the ScriptLog in order to test. You filter will need to be set to All or at least Trace to see the log statement.
In the next section we'll see how we can test this and do a bit more.
Data logging and filtering is one of your most powerful tools not only in the ThingWorx environment, but in developing solutions. The next section of this learning path will go in depth about what each of these items in a Monitoring screen does. It will also cover tricks to help your search. For now, let's look at how we can view logs and filter them to find what we need.
|Search the log for key words and phrases.
|Provides a list of options to fine tune your search. This menu is very powerful.
|Select what level of logging you'd like to see.
|A date range filter to help limit or set your specific date options.
|Max Row Count
|The max number of rows to search for and return. The search will continue until this number is met or your other search filters have been met (ie, date range).
|Apply the changes for your date range and max account or reset these values to their defaults.
|Refresh/Auto Refresh Buttons
|Allow the log to continue based on your filters (if any) without you having to refresh. You can also refresh it on your own.
|Log Header and List
|The logs that were found based on your filters or settings.
|Selected Log View
|After selecting a log item in the list, it will be shown here.
The are some tricks to finding what you want and need faster. We dive into that in the next guide in this learning path.
Congratulations! You've successfully completed the Tracking Activities and Stats guide, and learned how to use the ThingWorx Platform to help track what is happening in your application.
If you wish to return to the learning path, click Utilizing ThingWorx to Secure Your Aerospace and Defense Systems
We recommend the following resources to continue your learning experience:
|Design Your Data Model
|Data Model Implementation Guide
If you have questions, issues, or need additional information, refer to:
|Developer Community Forum
|REST API Help Center