Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wfdm 910 create script to delete security classification b c and green reports #105

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Minor updates
  • Loading branch information
CEBergin-Vivid committed Oct 25, 2023
commit 23ea315f214956a9f99ea76df9f6dcda3073a0b2
Original file line number Diff line number Diff line change
@@ -74,24 +74,27 @@ def delete_restricted_file(document_id, page, row_count):
isGreenReport = False
doc_json = wfdm_doc_response.json()
del wfdm_doc_response
# First, update the metadata records


# Delete any GreenReport from the file index, they may not have security classification set
if "GreenReport-" in doc_json["filePath"]:
deleteFile = True
isGreenReport = True


# delete from the index any file with a security classification of Protected B or Protected C
for positionInMetaArr, meta in enumerate(doc_json['metadata']):
value = meta['metadataValue']
name = meta['metadataName']
# avoid checking the default field, they're fine

if name == "SecurityClassification" and (value == "Protected B" or value == "Protected C"):
deleteFile = True
break
# Green Reports should have a Security Classification of Protected B or Protected C, if they don't update it for them
if isGreenReport and name == "SecurityClassification" and value != "Protected B" and value != "Protected C":
doc_json['metadata'][positionInMetaArr]['metadataValue'] = "Protected B"
changedMetadata = True
break

# update the metadata for green reports
if (changedMetadata):
# Now that they type is updated, we can push in an update
wfdm_put_response = requests.put(docs_endpoint + '/' + document['fileId'], data=json.dumps(
@@ -106,7 +109,7 @@ def delete_restricted_file(document_id, page, row_count):
# Now that they type is updated, we can push in an update
wfdm_put_response = requests.delete(docs_endpoint + '/' + document['fileId'] + "?openSearchIndexDeleteOnlyInd=true", headers={'Authorization': 'Bearer ' + token, 'content-type': 'application/json'})
# verify 200
if wfdm_put_response.status_code != 200:
if wfdm_put_response.status_code != 204:
print(wfdm_put_response)
# Don't fail out here, just cary on
del wfdm_put_response