Skip to content

Commit fde6e6a

Browse files
committed
Extended the Projects Plugin documentation
1 parent 9f6d262 commit fde6e6a

2 files changed

Lines changed: 70 additions & 8 deletions

File tree

docs/_data/categories.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
{
1515
"key": "extensions",
16-
"title": "Extensions"
16+
"title": "Extensions & Plugins"
1717
},
1818
{
1919
"key": "STA",

docs/extensions/DataModel-Projects.md

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Password are not visible to anyone, not even to admin users.
2222

2323
Users can change their own password.
2424

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:
2626

2727
- read
2828
- create
@@ -35,9 +35,9 @@ The `Roles` entity type is only visible to admin users.
3535

3636
Users can have global Roles. The global roles are stored in the `USER_ROLES` table that directly links Users to Roles.
3737

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.
4141

4242
**Projects** are administrative entities grouping data (through Things).
4343
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
5151

5252
The `UserProjectRoles` entity type is only visible to admin users.
5353

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.
5556

5657

5758
## Linking entities to Projects
@@ -90,7 +91,8 @@ Project admins can link users to projects.
9091
### KeyCloak Auth
9192

9293
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.
9496

9597

9698
## Data Model
@@ -117,10 +119,70 @@ A new project can be created by posting to v1.1/Projects:
117119
}
118120

119121

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",
132+
"encodingType": "application/geo+json",
133+
"location": {"type": "Point", "coordinates": [ 8, 49 ]},
134+
"Projects": [{"@iot.id": 42}]
135+
}
136+
137+
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+
120182

121183
## Conformance Class
122184

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:
124186

125187
https://fraunhoferiosb.github.io/FROST-Server/extensions/DataModel-Projects.html
126188

0 commit comments

Comments
 (0)