rs_server_catalog/data_management/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 |
object_name
|
str
|
Type of object we want to also update. |
required |
current_user
|
str
|
The user id that is currently connected. |
''
|
current_collection_id
|
str
|
The collection ID used to rewrite links outside the object list. |
''
|
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/data_management/user_handler.py
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_content
|
dict
|
The STAC object (item or collection) whose links need to be adapted. |
required |
current_user
|
str
|
The currently connected user identifier (used as fallback owner). |
''
|
Returns: dict: The collection passed in parameter with adapted links
Source code in docs/rs-server/services/catalog/rs_server_catalog/data_management/user_handler.py
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/data_management/user_handler.py
collection_id_without_owner_id(collection_id, owner_id)
¶
Returns collection_id without owner_id prefix
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/data_management/user_handler.py
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/data_management/user_handler.py
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/data_management/user_handler.py
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/data_management/user_handler.py
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/data_management/user_handler.py
73 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 | |