-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed the Request parameters, and removed group_uuid in entity whic…
…h will not exist in some circumstances.
- Loading branch information
1 parent
da1d640
commit 7798bf4
Showing
2 changed files
with
24 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4290,6 +4290,7 @@ def bulk_update_entities( | |
if idx < len(entity_updates) - 1: | ||
time.sleep(throttle) | ||
|
||
logger.info(f"bulk_update_entities() results: {results}") | ||
return results | ||
|
||
|
||
|
@@ -4316,6 +4317,17 @@ def update_datasets_uploads(entity_updates: list, token: str, entity_api_url: st | |
# Shirey: With this use case we're not worried about a lot of concurrent calls to this endpoint (only one user, | ||
# Brendan, will be ever using it). Just start a thread on request and loop through the Datasets/Uploads to change | ||
# with a 5 second delay or so between them to allow some time for reindexing. | ||
# | ||
# Example call | ||
# 1) pick Dataset entities to change by querying Neo4J... | ||
# URL: http://18.205.215.12:7474/browser/ | ||
# query: MATCH (e:Dataset {entity_type: 'Dataset'}) RETURN e.uuid, e.status, e.ingest_task, e.assigned_to_group_name LIMIT 100 | ||
# | ||
# curl --request PUT \ | ||
# --url ${ENTITY_API}/datasets \ | ||
# --header "Content-Type: application/json" \ | ||
# --header "Authorization: Bearer ${TOKEN}" \ | ||
# --data '[{"uuid":"6ce8d4515bc87213e787397c2b4d2f99", "assigned_to_group_name":"TMC - Cal Tech"}, {"uuid":"a44a78bfbe0e702cdc172707b6061a16", "assigned_to_group_name":"TMC - Cal Tech"}]' | ||
@app.route('/datasets', methods=['PUT']) | ||
@app.route('/uploads', methods=['PUT']) | ||
def entity_bulk_update(): | ||
|
@@ -4326,7 +4338,7 @@ def entity_bulk_update(): | |
validate_token_if_auth_header_exists(request) | ||
require_json(request) | ||
|
||
entities = request.get_json().get('entities') | ||
entities = request.get_json() | ||
if entities is None or not isinstance(entities, list) or len(entities) == 0: | ||
bad_request_error("Request object field 'entities' is either missing, " | ||
"does not contain a list, or contains an empty list") | ||
|
@@ -4539,7 +4551,7 @@ def validate_user_update_privilege(entity, user_token): | |
user_group_uuids = [d['uuid'] for d in user_write_groups] | ||
if entity.get('group_uuid') not in user_group_uuids and is_admin is False: | ||
forbidden_error(f"User does not have write privileges for this entity. " | ||
f"Reach out to the help desk ([email protected]) to request access to group: {entity['group_uuid']}.") | ||
"Please reach out to the help desk ([email protected]) to request access.") | ||
|
||
|
||
""" | ||
|