You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/extensions/DataModel-Projects.md
+69-7Lines changed: 69 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ Password are not visible to anyone, not even to admin users.
22
22
23
23
Users can change their own password.
24
24
25
-
**Roles** embody sets of permissions that a user can have. Roles are stored in the `ROLES` table. Test roles are:
25
+
**Roles** embody sets of permissions that a user can have. Roles are stored in the `ROLES` table. The default roles are:
26
26
27
27
- read
28
28
- create
@@ -35,9 +35,9 @@ The `Roles` entity type is only visible to admin users.
35
35
36
36
Users can have global Roles. The global roles are stored in the `USER_ROLES` table that directly links Users to Roles.
37
37
38
-
- A global admin user is allowed to do everything.
39
-
- A user with a global "create" role is allowed to create all entity types except for Users and admin-only types (Roles, UserProjectRoles).
40
-
- A user with a global "read" role can read all entities, except for other User entities or admin-only types.
38
+
- A global `admin` user is allowed to do everything.
39
+
- A user with a global `create` role is allowed to create all entity types except for Users and admin-only types (Roles, UserProjectRoles).
40
+
- A user with a global `read` role can read all entities, except for other User entities or admin-only types.
41
41
42
42
**Projects** are administrative entities grouping data (through Things).
43
43
Projects are stored in the `PROJECTS` table.
@@ -51,7 +51,8 @@ Users can have project-roles. Users are linked to a Project with a certain Role
51
51
52
52
The `UserProjectRoles` entity type is only visible to admin users.
53
53
54
-
Users without a global "read" role, but with a project-related role can only read entities associated with a project they are related to.
54
+
Users without a global "read" role, but with a project-related role can only read entities associated with a project they are related to, or entities that are related to a project that is `public`.
55
+
This means they can not read entities that are not related to any projects.
55
56
56
57
57
58
## Linking entities to Projects
@@ -90,7 +91,8 @@ Project admins can link users to projects.
90
91
### KeyCloak Auth
91
92
92
93
When using [KeyCloak Authentication](https://fraunhoferiosb.github.io/FROST-Server/settings/auth.html#settings-for-the-auth-provider-class-keycloakauthprovider) the contents of the user and roles tables are automatically filled from the data supplied by KeyCloak.
93
-
The links between Projects and Users/Roles can also be decoded from the KeyCloak data, by using a userRoleDecoder.
94
+
95
+
The links between Projects and Users/Roles can also be decoded from the KeyCloak data, by using a userRoleDecoder. The ProjectRoleDecoder takes the list of roles (strings) that KeyCloak provides, uses a regular expression to extract a project name and a role name from each string, and creates a UserProjectRole for the user for each of these.
94
96
95
97
96
98
## Data Model
@@ -117,10 +119,70 @@ A new project can be created by posting to v1.1/Projects:
117
119
}
118
120
119
121
122
+
### Location
123
+
124
+
A new location can be created by posting to `v1.1/Locations`, or any other path that represents a list of Locations.
125
+
For users that do not have global `create` rights, the new Location must be linked to a Project that the user has `create` rights on.
126
+
The location can be linked to multiple projects, but the user creating the Location must have `create` rights on all these projects.
127
+
128
+
{
129
+
"name": "Location Station 1",
130
+
"restricted": false,
131
+
"description": "The location of the first station",
To make linking to the correct Project easier, the Location can also be created by posting to `v1.1/Projects(42)/Locations`.
138
+
This will automatically link the new Location to the Project referenced in the URL.
139
+
140
+
141
+
### Thing, Sensor
142
+
143
+
Like Locations, users that do not have global `ceate` rights must directly link created Things or Sensors to a Project they have `create` rights on.
144
+
145
+
{
146
+
"name": "Station 1",
147
+
"description": "The first station",
148
+
"Locations": [{"@iot.id": 1}],
149
+
"Projects": [{"@iot.id": 42}]
150
+
}
151
+
152
+
### FeatureOfInterest
153
+
154
+
When features of interest are created manually, they too must be linked to a project the user has `create` rights on, if the user does not have global `create` rights.
155
+
156
+
When features are created automatically, they inherit the Projects and `restricted` setting from the Location the Feature is created from.
157
+
When the Projects of the Location, or the `restricted` setting of the Location, is changed, the FeatureOfInterest is currently not updated.
158
+
159
+
160
+
### ObservedProperties
161
+
162
+
Since ObservedProperties are inherently shared entities, they are not linked to Projects.
163
+
Only users with global `create` rights and administrators can create or edit ObservedProperties.
164
+
165
+
166
+
### Datastreams
167
+
168
+
Access rights on Datastreams are controlled through the Thing the Datastream is associated with.
169
+
Users that want to create a Datastream must have `create` rights on a Project of the Thing the Datastream is associated with.
170
+
At the same time, when creating a Datastream, it must be linked to a Sensor.
171
+
To be able to create this link, the user creating the Datastream must have `create` rights on (a Project linked to) the Sensor.
172
+
173
+
174
+
### Observations
175
+
176
+
Access rights on Observations are conntrolled through the Datastream the Observation is associated with, and thus through the Thing of the Datastream.
177
+
178
+
There are two user rights that give a user the right to create Observations: `create` and `obscreate`.
179
+
Users with the right `obscreate` can only create observations, not other entities.
180
+
Users can only create Observations in Datastreams in Things in Projects that they have one of these rights on.
181
+
120
182
121
183
## Conformance Class
122
184
123
-
The conformance class this extension must register in the SensorThings (v1.1 and up) index document is:
185
+
The conformance class this extension registers in the SensorThings (v1.1 and up) index document is:
0 commit comments