|
15 | 15 | import arrow |
16 | 16 | from cds_rdm.legacy.models import CDSMigrationAffiliationMapping |
17 | 17 | from idutils import normalize_ror |
18 | | -from idutils.validators import is_doi |
| 18 | +from idutils.validators import is_doi, is_ror |
19 | 19 | from invenio_access.permissions import system_identity |
20 | 20 | from invenio_accounts.models import User |
21 | 21 | from invenio_db import db |
@@ -202,6 +202,8 @@ def _owner(self, json_entry): |
202 | 202 |
|
203 | 203 | def _match_affiliation(self, affiliation_name): |
204 | 204 | """Match an affiliation against `CDSMigrationAffiliationMapping` db table.""" |
| 205 | + if is_ror(affiliation_name): |
| 206 | + return {"id": normalize_ror(affiliation_name)} |
205 | 207 | # Step 1: search in the affiliation mapping (ROR organizations) |
206 | 208 | match = self.affiliations_mapping.query.filter_by( |
207 | 209 | legacy_affiliation_input=affiliation_name |
@@ -781,15 +783,27 @@ def compute_files(file_dump, versions_dict): |
781 | 783 | ) |
782 | 784 | return |
783 | 785 |
|
| 786 | + if file["type"] == "Plot": |
| 787 | + # skip figures |
| 788 | + RDMJsonLogger().add_success_state( |
| 789 | + str(file["recid"]), |
| 790 | + { |
| 791 | + "message": f"Plot file dropped.", |
| 792 | + "value": file["full_name"], |
| 793 | + }, |
| 794 | + ) |
| 795 | + return |
784 | 796 | if file["hidden"]: |
785 | | - raise RestrictedFileDetected( |
786 | | - field=file["full_name"], |
787 | | - value=file["status"], |
788 | | - priority="critical", |
789 | | - message="File marked as hidden", |
| 797 | + # skip hidden files |
| 798 | + RDMJsonLogger().add_success_state( |
| 799 | + str(file["recid"]), |
| 800 | + { |
| 801 | + "message": f"Hidden file dropped.", |
| 802 | + "value": file["full_name"], |
| 803 | + }, |
790 | 804 | ) |
791 | | - if file["status"] and file["status"] != "SSO": |
792 | | - # check if any other restrictions |
| 805 | + if file["status"] and file["status"] not in ["SSO", "lhcb-general [CERN]"]: |
| 806 | + # check if any other restrictions, recid 2267334 |
793 | 807 | raise RestrictedFileDetected( |
794 | 808 | field=file["full_name"], value=file["status"], priority="critical" |
795 | 809 | ) |
|
0 commit comments