rs_server_catalog/user_handler.md
This library contains all functions needed for the fastAPI middleware.
adapt_links(content, object_name, current_user='', current_collection_id='')
Adapt all the links that are outside from the collection section with the given user and collection name, then the ones inside with the user and collection names they already contain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
dict
|
The response content from the middleware |
required |
current_user
|
str
|
The user id that is currently connected. |
''
|
current_collection
|
str
|
The current collection name. |
required |
object_name
|
str
|
Type of object we want to also update. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
The content passed in parameter with adapted links |
Source code in docs/rs-server/services/catalog/rs_server_catalog/user_handler.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
adapt_object_links(object_content, current_user='')
Adapt all the links from a collection using the user and collection name they already contain, so the user can access them correctly
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object
|
dict
|
The collection |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
The collection passed in parameter with adapted links |
Source code in docs/rs-server/services/catalog/rs_server_catalog/user_handler.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
add_user_prefix(path, user, collection_id, feature_id='')
Modify the RS server backend catalog endpoint to get the RS server frontend endpoint
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
RS server backend endpoint. |
required |
user
|
str
|
The user ID. |
required |
collection_id
|
str
|
The collection id. |
required |
feature_id
|
str
|
The feature id. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The RS server frontend endpoint. |
Source code in docs/rs-server/services/catalog/rs_server_catalog/user_handler.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
collection_id_without_owner_id(collection_id, owner_id)
Returns collection_id without owner_id prefix
Source code in docs/rs-server/services/catalog/rs_server_catalog/user_handler.py
69 70 71 | |
get_user(endpoint_user, apikey_user)
Retrieve the user identifier based on provided parameters. Default is the current running user (used for local mode in general)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
endpoint_user
|
str
|
User identifier from the endpoint. |
required |
apikey_user
|
str
|
User identifier from the API key. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
The user identifier. |
Source code in docs/rs-server/services/catalog/rs_server_catalog/user_handler.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
owner_id_and_collection_id(owner_id, collection_id)
Returns collection_id with owner_id prefix
Source code in docs/rs-server/services/catalog/rs_server_catalog/user_handler.py
64 65 66 | |
remove_owner_from_collection_name_in_collection(collection, current_user='')
Remove the owner name from the given collection name. The owner name used is the "owner" field of the collection if there is any, or by default the currently connected user. Returns the updated collection and the owner name actually removed. If nothing was removed, returns the original collection and an empty owner name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
dict
|
A dictionary that contains metadata about the collection content like the id of the collection. |
required |
current_user
|
str
|
current user connected (optional) |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
The collection without the owner name in the id section. |
str |
str
|
the name removed, if any. |
Source code in docs/rs-server/services/catalog/rs_server_catalog/user_handler.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
remove_owner_from_collection_name_in_feature(feature, current_user='')
Remove the owner name from the collection name in the feature. The owner name used is the "owner" field of the properties if there is any, or by default the currently connected user. Returns the updated feature and the owner name actually removed. If nothing was removed, returns the original feature and an empty owner name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature
|
dict
|
a geojson that contains georeferenced data and metadata like the collection name. |
required |
current_user
|
str
|
current user connected (optional) |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
the feature with a new collection name without the owner name. |
str |
str
|
the name removed, if any. |
Source code in docs/rs-server/services/catalog/rs_server_catalog/user_handler.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
reroute_url(request, ids_dict)
Get the RS Server backend catalog endpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
The client request |
required |
ids_dict
|
str
|
Dictionary to easily access important data of our request |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the path is not valid. |
Source code in docs/rs-server/services/catalog/rs_server_catalog/user_handler.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |