ThingsBoard PE Feature
Only Professional Edition supports Advanced RBAC for IoT devices and applications feature.
Below you can find all the information and instructions about this feature, or you can see the video tutorial for step-by-step instructions on how to use it.
ThingsBoard Community Edition (TB CE) supports a straight-forward security model with three main roles: System administrator, Tenant administrator, and Customer user. A system administrator is able to manage tenants, while a tenant administrator manages devices, dashboards, customers, and other entities that belong to a particular tenant. Customer user is able to view dashboards and control devices that are assigned to a specific customer. TB CE functionality is sufficient for a lot of simple use cases, especially building real-time end-user dashboards.
TB PE security model was significantly improved in v2.3 to enable new security features and to support advanced RBAC for IoT applications. For example:
This document covers features that are exclusive to TB PE. We will start with a glossary and will provide step-by-step examples of how to configure the most popular use cases.
A Tenant is a separate business-entity: an individual, or an organization that owns or produces devices and assets. A tenant can have multiple tenant administrator users and millions of customers.
An Entity can be a device, asset, user, dashboard, entity view, etc. Any entity is managed by ThingsBoard. See entities and relations guide for more details.
Entity Group (EG)
Entity Groups are groups of entities of the same type, for example, Device Group or Asset Group. A single entity can simultaneously belong to multiple entity groups. For example, a thermostat device might belong to group “Thermostats”, which contains all devices, and a more specific group like “Thermostats with FW v1.2.3”.
A Customer can be a separate business-entity: an individual, or an organization that purchases or uses tenant devices and/or assets. Customer can also be a division within the Tenant organization. Customer can have multiple users, inner customers, and millions of devices and/or assets.
Customer Group (CG)
The Customer group is also an EG. It has the same features as regular EG, but we have a separate term for CG to be able to easily distinct CGs and all other EGs.
Users are able to login to the ThingsBoard web interface, execute REST API calls, access devices, and assets if it’s allowed. The User is also an Entity in ThingsBoard.
User Group (UG)
A User group is also an EG. It has the same features as regular EG, but we have a separate term for UG to be able to easily distinct UGs and all other EGs.
Each EG belongs to one owner. This can be either Tenant or Customer. Also, each Customer has only one owner. If the Customer Owner is a Tenant, it means that this is a top-level Customer. If the Customer owner is another Customer, it means that this is a sub-customer. There might be multiple levels of Customers in ThingsBoard.
Anything that has a secure APIs or represents a ThingsBoard Entity is a resource. Examples of Entities are listed in the Entity definition above. Groups of entities are also resources, for example, Device Group, Asset Group, Dashboard Group. Additional resources are white-labeling, audit logs, and admin settings.
Operations represent actions that you might perform over Resources. There are generic actions like “create”, “read”, “write”, “delete”, “add to group”, “remove from group”. There are also specific actions like “read/write credentials”.
A Role contains a list of Resources and a list of allowed Operations for each of those resources. There are two Role types: Generic and Group.
There is a special resource “All” which is a shortcut to all available resource types.
There is also a special operation “All” that is a shortcut to all possible operations.
We will explain the differences between them later in this article.
Group Permissions Entity (GPE)
GPE is basically a mapping between UG, Role, and optional EG. See “Generic roles” and “Group roles” for more details.
ThingsBoard supports the “recursive” customer hierarchy with an unlimited number of sub-customers. The root-level Owner is Tenant. Each Owner may have multiple Entity Groups (EGs), User Groups (UGs), and Customer Groups (CGs).
Note: Each Entity has only one owner. However, Entities can belong to multiple EGs that belong to the same owner.
Since CGs can contain multiple Customers, each Customer can also own his EGs, UGs, and CGs (i.e. sub-customer groups). See the diagram below for a visual representation of relations between those entities.
Role maps Resource type to a list of allowed Operations. There are two Role types: Generic and Group.
Each Role is related to one or more User Group. Each User Group has only one Owner. With the Generic Role, you grant UG with the same permissions over all entities that belong to the same Owner and all its’ sub-customers recursively. We use a special “connection” object called Group Permission Entity to make a connection between User Group and Generic Role.
Let’s review the diagram below.
User Bob will be able to perform any operations over any entity that belongs to either his Tenant A or Customer B as long as any other customers and sub-customers are for the same Tenant. However, User Alice will be able to perform any operations over any entity that belongs to only her Customer B and all it’s sub-customers. So, Alice and Bob are able to access Device B1, but only Bob is able to access Device A1.
Group Role allows you to map a set of Permissions for a specific User Group to a particular Entity Group. We use special “connection” object called Group Permission Entity to make a connection between User Group, Entity Group and Group Role.
Let’s review the diagram below.
User Bob belongs to the “Tenant Administrators” group and is able to do any operations with any tenant entities. Basically, Bob has a full control over both Device Groups A and B. User Alice belongs to “Group A Administrators” and has reading/writing access to all devices in device group A. However, Alice will not be able to see or use devices from group B.
Note: Since Entity Group has only one Owner, you can assign Group Role to any User Group that belongs to the same Owner or any parents of the Owner.
See list of configuration examples below for the most popular use cases.
Let’s assume your solution manages commercial buildings.
Your main customer is a Building Manager that wants to monitor HVAC systems, electricity consumption, and other smart devices in the building.
The Building Manager may want to design and share some dashboards with the end-users - office workers. Besides, your engineers responsible for the maintenance are interested in supervising the devices state, for example, receive alerts when the battery level forgoes below certain thresholds.
To summarize those requirements in ThingsBoard terms, we should implement the following roles:
Let’s configure ThingsBoard to support this use case. The instructions below assume that you have logged in as a Tenant Administrator.
We will create a separate User Group named “Supervisors”, and a separate Dashboard Group “Supervisor Dashboards”. Our goal is to allow Supervisors to manage dashboards in the “Supervisor Dashboards” group, but for all other entities in the system, they should have read-only access.
Let’s start by creating a “Supervisor Dashboards” group:
We should create two roles to implement this use case:
Now let’s assign those roles to the “Supervisors” group.
We will create a separate Customer entity for each building or group of buildings. We will add the Facility Manager user account to the default “Customer Administrators” group which is automatically created for each Customer. Now, as Facility Manager, we can log in, design dashboards, provision devices, and end-users.
Let’s log in as Alice (created in a previous guide), Building A administrator, and create several dashboards.
Now, let’s create a Read-only User. Let’s assume we want to assign “End User Dashboard” to him and make sure that this Dashboard will open full screen once the user is logged in. So, our read-only user will not have access to the administration panel to the left, since they are still not allowed to perform any server-side API calls, except read-only browsing the data.
TODO: Stay tuned, this doc will be available upon v2.3 release.
Getting started guides - These guides provide quick overview of main ThingsBoard features. Designed to be completed in 15-30 minutes.
Installation guides - Learn how to setup ThingsBoard on various available operating systems.
Connect your device - Learn how to connect devices based on your connectivity technology or solution.
Data visualization - These guides contain instructions how to configure complex ThingsBoard dashboards.
Data processing & actions - Learn how to use ThingsBoard Rule Engine.
IoT Data analytics - Learn how to use rule engine to perform basic analytics tasks.
Hardware samples - Learn how to connect various hardware platforms to ThingsBoard.
Contribution and Development - Learn about contribution and development in ThingsBoard.