First, change this code in oauth.service.ts
else { // complianceLevel.includes('gov')
return 'library_read';
}
to this:
else { // complianceLevel.includes('gov')
return 'library_read library_write';
}
Then, copy-paste this code and put it in-between the code blocks commented by /* Initalize documentIds. */
and /* Set up the FormArray that will be used to display the list of documents to the user. */
in migration-console.component.ts
:
for (const doc of oldThis.documentIds) {
const requestConfig2 =
{
'method': 'put',
'url': `${baseUrl}/libraryDocuments/${doc}/state`,
'headers': {'Authorization': `Bearer ${this.sourceBearerToken}`},
'data': { 'state': 'REMOVED' }
};
console.log(requestConfig2);
await httpRequest(requestConfig2);
}
You may want to delete documents that satisfy certain criteria. To hackily do this as well...
In migration-console.component.ts
, change this line of code
libraryDocuments = libraryDocuments.concat(response.libraryDocumentList);
to this:
const filteredNewDocs = response.libraryDocumentList.filter(condition);
libraryDocuments = libraryDocuments.concat(filteredNewDocs);
Where condition
is a callback function such as
function condition(doc: any) {
return doc.ownerEmail === '[email protected]';
}