Skip to content

Commit 78788e3

Browse files
committed
Merge stage for release 1.2.0
2 parents 122a3e1 + 97e149d commit 78788e3

File tree

10 files changed

+129
-49
lines changed

10 files changed

+129
-49
lines changed

source/external-interface-design/external-interface-design.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,21 @@ exponential back-off. Or an API exposing all messages which have not
443443
been acknowledged by the receiver, for a short period of time (for
444444
instance 3 days like SigFox).
445445

446+
FIWARE
447+
^^^^^^
448+
449+
FIWARE data target allows users to integrate OS2IoT with any "Powered by FIWARE" platform by enabling the connection to the Context Broker Generic Enabler.
450+
451+
Data are send to the context broker via the :code:`/ngsi-ld/v1/entityOperations/upsert/` operation.
452+
453+
The output of the payload decoder function needs to comply with the NGSI-LD format as it is sent as a body of the request without any alteration. It should represent an array of objects to be updated.
454+
455+
The context (part of the NGSI-LD standard) can be provided in the request body or can be defined in the data target configuration. In the latter case, it will be included within the headers of the request.
456+
457+
The Fiware data target supports the multitenancy of the Context Broker (but not every context broker supports multitenancy). The name of the tenant can be specified in the configuration. If no value is provided, the default tenant will be used. To specify the tenant OS2IoT is using :code:`NGSILD-Tenant` header.
458+
459+
460+
446461
Opendata.dk
447462
^^^^^^^^^^^
448463

source/installation-guide/installation-guide.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,18 @@ OS2IoT-backend takes several environment variables as configuration, if these ar
219219
+-------------------------------+------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
220220
| BACKEND_BASEURL | URL for external services to connect to the backend (THIS SHOULD BE CHANGED!) | :code:`https://test-os2iot-backend.os2iot.dk` |
221221
+-------------------------------+------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
222+
| FRONTEND_BASEURL | URL for the frontend, used when building email links (THIS SHOULD BE CHANGED!) | :code:`http://localhost:8081` |
223+
+-------------------------------+------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
224+
| EMAIL_HOST | URL for the SMTP server, used when sending emails (THIS SHOULD BE CHANGED!) | :code:`"smtp.ethereal.email"` |
225+
+-------------------------------+------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
226+
| EMAIL_PORT | Port for the email server, used when sending emails (THIS SHOULD BE CHANGED!) | :code:`587` |
227+
+-------------------------------+------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
228+
| EMAIL_USER | Username for email server authentification, used when sending emails (THIS SHOULD BE CHANGED!) | :code:`"[email protected]"` |
229+
+-------------------------------+------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
230+
| EMAIL_PASS | Password for email server authentification, used when sending emails (THIS SHOULD BE CHANGED!) | :code:`"KzRSyYReEygpFPPZdd"` |
231+
+-------------------------------+------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
232+
| EMAIL_FROM | Email sender address. Either a plain address or a display name and the address (CHANGE IT!) | :code:`"OS2iot [email protected]"` |
233+
+-------------------------------+------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
222234
| KOMBIT_ENTRYPOINT | The context broker URL for KOMBIT adgangsstyring | :code:`https://adgangsstyring.eksterntest-stoettesystemerne.dk/runtime/saml2/issue.idp` |
223235
+-------------------------------+------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
224236
| KOMBIT_CERTIFICATEPRIVATEKEY | The certificate private key for KOMBIT adgangsstyring | :code:`null` |
@@ -231,6 +243,8 @@ OS2IoT-backend takes several environment variables as configuration, if these ar
231243
+-------------------------------+------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
232244
| METADATA_SAVED_COUNT | Maximum number of message metadata to store from an IoT device | :code:`20` |
233245
+-------------------------------+------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
246+
| DEVICE_STATS_INTERVAL_IN_DAYS | How many days back to fetch IoT device statistics | :code:`29` |
247+
+-------------------------------+------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
234248
235249
Logs levels
236250
"""""""""""""""
@@ -250,5 +264,5 @@ Defaults are set in :code:`OS2IoT-frontend/src/environments/environment.ts`
250264
+-------------------------------+--------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
251265
| BASE_URL | The Url which users will connect to the backend from. This must be changed for the system to work externally | :code:`http://localhost:3000/api/v1/` |
252266
+-------------------------------+--------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
253-
| TABLE_PAGE_SIZE | Default page size of tables | :code:`20` |
267+
| TABLE_PAGE_SIZE | Default page size of tables | :code:`25` |
254268
+-------------------------------+--------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+

source/internal-interface-design/api-key-access.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ While most of the system is accessible using API key authentication, there are s
3838
- You cannot manage users nor user groups
3939
- You cannot manage organizations
4040

41+
You can use an API key to request information necessary for using OS2IoT by using endpoints starting with :code:`/api-key-info`. They require API key authentication.
42+
For instance, to fetch the organization tied to your API key, you can make a :code:`GET` request to the route which ends with :code:`/api-key-info/organization`.
43+
4144
Currently, there's no expiration date on an API key. It will not expire unless an administrator revokes it on the key management page.
4245

4346
.. |api-key-usage| image:: ./media/api-key-usage.jpg

source/internal-interface-design/internal-interface-design.rst

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,38 @@ which is explained below.
5050

5151
Authorization (Permissions)
5252
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
53+
Permissions are given on specific applications to users and API keys through UserGroups. A UserGroup can have multiple permissions.
5354

54-
There is four levels of permissions in OS2IoT:
55-
55+
There are five levels of permissions in OS2IoT:
5656

5757
- Global Admin
5858

59-
- Can do anything
59+
- Can do everything for all organizations and applications
60+
61+
- Application Admin
62+
63+
- Is scoped to a single organization and zero or more applications
64+
- Can access and modify applications and Sigfox devices within the user group in that organization
6065

61-
- Organization Admin
66+
- Gateway Admin
6267

6368
- Is scoped to a single organization
64-
- Can do anything to that organization
65-
- Can add new users
69+
- Can access and modify gateways within that organization
6670

67-
- Write
71+
- User Admin
6872

69-
- Is scoped to a single organization and zero or more applications
70-
- Can write/create/delete entities within an organization on certain applications
73+
- Is scoped to a single organization
74+
- Can access and modify users and permissions within that organization
7175

7276
- Read
7377

7478
- Is scoped to a single organization and zero or more applications
7579
- Can read (view) entities within certain applications within an organization
7680

77-
The permissions are hieratical, meaning that you implicitly have all lesser permissions than the ones you have explicitly.
78-
For instance, if a user is an Organization Admin for an Organization, then that user also have the Write and Read permissions.
81+
Each of the admin permissions is part of a hierarchy with the read permission. If you have an Admin permission within an organization, with zero or more applications, you have an
82+
implicit read permission within that scope.
83+
For instance, if a user has Application Admin within an Organization, then that user also has Read permission within it.
84+
85+
Global Admin is at the top of the hierarchy and can thus do what any of the other permissions provide access to.
7986

8087
.. include:: api-key-access.rst

source/iot-data-handling/iot-data-handling.rst

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,37 @@ Sending to data-targets
7070
-----------------------
7171

7272
Once the data is transformed/decoded, it can be sent to the intended data-targets.
73-
OS2iot currently only supports HTTP push as a data-target. But is built to be extended for other kinds of data-targets, e.g. MQTT, PostgreSQL, etc.
73+
OS2iot currently supports HTTP push, FIWARE and MQTT as data-targets. It can be extended with other kinds of data-targets, e.g. PostgreSQL, etc.
7474

7575
The data-targets are configured as part of an application, and therefore can only include data from the IoT-Devices in said application.
7676
For each IoT-Device, it is up to the user to select an appropriate payload decoder, to translate the raw payload to JSON.
7777

78-
At the time of writing there is no retry mechanism in OS2iot, rather it uses "fire-and-forget" / "at most once delivery", over HTTP(S).
78+
At the time of writing, there is no retry mechanism in OS2iot over HTTP(s). It uses a "fire-and-forget" / "at most once delivery" pattern.
79+
80+
MQTT data-target
81+
^^^^^^^^^^^^^^^^
82+
83+
OS2iot supports publishing data to a broker when it's received using MQTT. MQTT is a standard, lightweight messaging protocol based on the publish/subscribe pattern.
84+
85+
When configuring such a data-target, there's a few terms and keywords to be aware of:
86+
87+
- **QoS**: The QoS (Quality of Service) level determines the guarantee of delivery for a specific message. Different network environments may require different QoS levels.
88+
Ideally, the level should be set to match the network reliability and application logic. This is the main point of MQTT.
89+
90+
There are 3 QoS levels:
91+
92+
- 0 (at most once)
93+
- 1 (at least once)
94+
- 2 (exactly once)
95+
96+
There are a number of well written articles regarding QoS. One such example is
97+
`this blog entry <https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels/>`_.
98+
- **Topic**: The MQTT data-target must be provided a topic with which it can label the data. This is used by the MQTT broker to filter messages from
99+
MQTT clients. Here, OS2iot is a client.
100+
- **Connection authentication**: The most common methods of authentication are username and password and/or client certificates. At the time of writing, username and password
101+
authentication is supported, but it can be extended to implement other methods.
102+
103+
You can read more on MQTT `here <https://mqtt.org/>`_
79104

80105
.. |image2| image:: ./media/image8.png
106+

source/logical-data-model/logical-datamodel.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ PermissionLevel
6060
~~~~~~~~~~~~~~~
6161

6262
1. Read
63-
2. Write
64-
3. OrgAdmin
65-
4. GlobalAdministrator
63+
2. OrganizationUserAdmin
64+
3. OrganizationGatewayAdmin
65+
4. OrganizationApplicationAdmin
66+
5. GlobalAdmin
6667

6768
ActionType
6869
~~~~~~~~~~~~~~~
@@ -156,11 +157,10 @@ PermissionType
156157
~~~~~~~~~~~~~~~~~
157158

158159
1. GlobalAdmin
159-
2. OrganizationAdmin
160-
3. Write
161-
4. Read
162-
5. OrganizationPermission
163-
6. OrganizationApplicationPermissions
160+
2. OrganizationApplicationAdmin
161+
3. OrganizationGatewayAdmin
162+
4. OrganizationUserAdmin
163+
5. Read
164164

165165
SendStatus
166166
~~~~~~~~~~~~~~~~~
-55.9 KB
Loading
-19.7 KB
Loading

source/software-architecture/software-architecture.rst

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -200,24 +200,31 @@ Security perspective
200200
--------------------
201201

202202
This figure shows the classes which make up the permission model for OS2IoT.
203-
A User has zero or more permission, these permissions are each one of four concrete types:
203+
A user is part of zero or more permissions (user groups). Each permission has one or more permission types
204+
which determine what's accessible within the organization. The concrete types are as follows:
204205

205206
1. GlobalAdmin
207+
a. Each domain instance of OS2IoT has at least 1 user with this type, which is created on the first startup of the backend.
208+
b. Users with the GlobalAdmin role can assign other users to also have the GlobalAdmin role
206209

207-
2. OrganizationAdmin
210+
2. OrganizationApplicationAdmin
208211

209212
a. This relates to a single organization
213+
b. This relates to a list of users within that organization. Access is granted to parts of the system requiring this type
210214

211-
3. Write
215+
3. OrganizationGatewayAdmin
212216

213217
a. This relates to a single organization
218+
b. This relates to a list of users within that organization. Access is granted to parts of the system requiring this type
219+
220+
4. OrganizationUserAdmin
214221

215-
b. This relates to a list of applications within that organization
222+
a. This relates to a single organization
223+
b. This relates to a list of users within that organization. Access is granted to parts of the system requiring this type
216224

217-
4. Read
225+
5. Read
218226

219227
a. This relates to a single organization
220-
221228
b. This relates to a list of applications within that organization
222229

223230

@@ -254,20 +261,21 @@ Authorization
254261
^^^^^^^^^^^^^
255262

256263
By default, a user does not have access to data in OS2iot. A global
257-
admin or Organization admin must manually give the user permissions to
264+
admin or User admin must manually give the user permissions to
258265
organizations or applications.
259266

260267
User permissions
261268
^^^^^^^^^^^^^^^^
262269

263-
================== ==================== =======================================================
264-
User role System name Permissions
265-
================== ==================== =======================================================
266-
Global admin Globaladmin Super user, CRUD everything within the domain
267-
Organization admin Orgadmin Manage permissions for an organization and its applications
268-
Write access Write Create, modify and delete objects within an application
269-
Read access Read Read all data within an application.
270-
================== ==================== =======================================================
270+
=================== ============================= ========================================================================
271+
User role System name Permissions
272+
=================== ============================= ========================================================================
273+
Global admin GlobalAdmin Super user, CRUD everything within the domain
274+
Application admin OrganizationApplicationAdmin Access and modify applications, DeviceModels and IoT devices within an organization
275+
Gateway admin OrganizationGatewayAdmin CRUD gateways within an organization
276+
User admin OrganizationUserAdmin CRUD users and permissions within an organization
277+
Read access Read Read all data within an application.
278+
=================== ============================= ========================================================================
271279

272280
Web application security
273281
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -344,6 +352,10 @@ Data target security
344352

345353
It is the responsibility of the users of OS2iot and administrators of the data targets to ensure data is encrypted during transmission using e.g. TLS. This section describes the available authentication options in OS2iot.
346354

347-
HTTP PUSH
355+
HTTP PUSH
356+
^^^^^^^^^^^^
357+
OS2iot supports using a HTTP "Authorization" header or HTTP basic authentication
358+
359+
FIWARE
348360
^^^^^^^^^^^^
349361
OS2iot supports using a HTTP "Authorization" header or HTTP basic authentication

0 commit comments

Comments
 (0)