- Add customers
- Sharing dashboard
- Changing owner of devices
- Access to assets
- Adding a customer user
- Reviewing the dashboard from the perspective of customer users
- Conclusion
One of the most important ThingsBoard features is the ability to create end-user dashboards. Each end user will only see their own devices and data, enjoying all the benefits of working with their personalized dashboard. They will not see devices or any other data belonging to other customers. As an administrator, you will always retain the access to edit and modify your dashboard.
There are two ways a Tenant Administrator can grant a Customer access to a specific entity (such as a Device, Dashboard, Asset, etc.):
- Assign ownership: This option makes the customer the sole user able to access the specific entity and its data;
- Share the entity: Useful for allowing multiple customers to access the same entity.
In the previous lesson, we added separate states for each device and configured them to display telemetry data.
Lesson 3. Adding and configuring individual states for each device
In this lesson, we will add two customers and configure shared access for them to the dashboard created in previous lessons. In our case, a Customer is an individual or organization that rents an office in your building and uses the devices available there. Each customer will have access solely to their respective rented office and the devices within it.
As part of our lesson, imagine two customers: Customer A rents Office A in Building A. Customer B rents Office B in the same building.
Let’s create these customers and grant them the necessary access.
Add customers
Let’s start by adding two customers.
- Navigate to the "Customers" page. By default, you navigate to the customer group "All". Click the "plus" sign to open the new customer form;
- Enter the customer's name and additional personal details if necessary. Click "Add" to finalize adding the new customer;
- Customer A is added.
Similarly, create another customer named “Customer B” and add them to the “Office renters” group.
Sharing dashboard
Since both of our clients will be using the dashboard, we cannot make them both owners, but we can provide them with shared access to the dashboard. You also cannot share an individual dashboard; only the group that includes the dashboard can be shared.
- Go to the "Dashboard" page and navigate to the "Groups" tab. Our dashboard is located in the "Buildings" group. Click the "Share" icon next to this group;
- Select Customer A, set the permission to "Read," and click "Share";
- Repeat the process for Customer B.
Changing owner of devices
Now, let’s change the owners of the devices. Assign Customer A as the owner of all devices in Office A, specifically: “Indoor Air Quality Sensor”, “Energy Meter”, and “Water Flow Meter”. Assign Customer B as the owner of the “IQA Sensor” in Office B.
- Open "Devices" page. Click on "SD-001" (Indoor Air Quality Sensor) device to open its details. Now, click "Manage owner and groups" button;
- In the "Owner" row, select "Customer A" from the drop-down list. Now, create a new device group. In the "Groups" row, input the desired group name, for example "Office A sensors". Then, click "Create a new one!";
- Click "Add" button to confirm creation the device group creation;
- Click "Update" to confirm the change of the device owner. You can always change the owner back to the tenant;
- On the device page, in the "Customer name" column, you can see which customer device belongs to;
Similarly, assign Customer A as the owner of “EM-002” (electricity meter) and “WM-003” (water consumption meter) devices, and Customer B as the owner of “AM-307” (indoor air quality sensor).
Make sure that the devices are assigned to Customer A.
- Navigate to the "Customers" page and find Customer A in the list of customers. Click on the "Manage customer devices" icon next to Customer A;
- Your devices are owned by the customer and are located in the customer's device group "Office A devices".
Make sure that the devices are assigned to Customer B.
- Click on the "Manage customer devices" icon next to Customer B;
- Your device is owned by the customer and is located in the customer's device group "Office B devices".
Access to assets
Since both Office A and Office B are located in Building A, your customers should have shared access to the building, but their access to offices should be restricted so they can only see their respective offices. Here’s what we’ll do:
Change the owners of Office A and Office B:
- Assign Customer A as the owner of Office A;
- Assign Customer B as the owner of Office B.
Share access to Building A:
- Share the asset Building A with both Customer A and Customer B;
- Set the permission level to “Read” for both customers, so they can access shared data about the building without seeing each other’s offices.
Changing owner of assets
- Navigate to the "Assets" page. Open assets details by clicking on the "Office A" asset. Then click "Manage owner and groups" button;
- Specify Customer A as the asset owner. Then, add "Office A" asset to the group. Input the desired device group name, for example "Customer A offices", and click "Create a new one!";
- Confirm the creation of a new device group by clicking the "Add" button;
- Click "Update" to confirm the ownership change of your device;
- Similarly, set Customer B as the owner of Office B.
Make sure that the office assets are assigned to the correct customers.
- Navigate to the "Customers" page and click on the "Manage customer assets" icon next to Customer A;
- Your Office A is now owned by the customer and is located in the customer's asset group "Customer A offices".
- Find Customer B and click on the "Manage customer assets" icon next to Customer B;
- Your Office B is now owned by the customer and is located in the customer's asset group "Customer B offices".
Sharing assets
Now we will add Building A to a group and share access to it for both customers.
- Go to the "Assets" page and click the "Manage owner and groups" button in the details of the "Building A" asset;
- Create a new group for "Building A" asset. Input "Building A" as group name, and click "Create a new one!";
- Confirm creation of the new device group by clicking the "Add" button;
- Click the "Update" button;
- We have added Building A to the group. Now we can share it with our customers. Navigate to the "Groups" tab;
- Click "Share" icon next to the "Building A" group;
- Select Customer A, set the permission to "Read," and click "Share";
- Similarly, grant Customer B access to our dashboard with the "Read" permission level.
We've granted access to all the necessary customers. Time to move on to adding customer users.
Adding a customer user
Finally, let's create one customer user for each customer. They will have access to our dashboards and the data to which we have granted them access.
First, let's add user Emma Johnson to Customer A:
- Go to the “Customers” page. Find your customer in the list of customers and then click on the “Manage customer users” icon;
- Navigate to the “Groups” tab and select the “Customer Users” group. This is an automatically created group of customer users with read-only permissions already granted. To learn more about permissions and Role-Based Access Control (RBAC), read this article;
- Click “plus” icon in the top-right corner. Enter the user's email. Additionally, specify the first and last name. Then click “Add”;
- Copy the user activation link and save it to a safe place. Then click “OK”;
- We added new customer user. Click on the created user to open their details, then click the big orange “pencil” icon to enter editing mode;
- Set our “Building” dashboard as default, and check “Always fullscreen” option. Finally, apply changes.
We have finished adding the user of Customer A. Similarly, add the customer user Jack Smith to Customer B.
Reviewing the dashboard from the perspective of customer users
Next up, we'll activate the customer users and check how our dashboard looks from each user's perspective
Let's start with Client A's user - Emma Johnson.
- Paste the previously copied user activation link into your browser's address bar and press Enter. Come up with and enter a password for the account, then click "Create Password";
- After this, your account will be activated and you will be logged in as a customer user.
The dashboard will open, displaying only the building where your office is located — Building A. Navigate through the dashboard to ensure that your user has access only to the data you have granted them access to.
Similarly, activate the user of Customer B. They should have access to Office B in Building A and the data from the IAQ Sensor located inside the Office B.
Conclusion
In the next lesson, which will be released very soon, we will learn how to create and manage alarms to respond to different conditions and events effectively. See you soon.