diff --git a/src/pdi_nomad_plugin/general/schema.py b/src/pdi_nomad_plugin/general/schema.py index 8db2618..de704c7 100644 --- a/src/pdi_nomad_plugin/general/schema.py +++ b/src/pdi_nomad_plugin/general/schema.py @@ -152,7 +152,6 @@ def normalize(self, archive, logger: 'BoundLogger') -> None: for sample in self.samples: set_sample_status( sample.reference, - archive.m_context, logger, as_delivered=False, fresh=False, @@ -218,7 +217,6 @@ def normalize(self, archive, logger: 'BoundLogger') -> None: for sample in self.samples: set_sample_status( sample.reference, - archive.m_context, logger, as_delivered=False, fresh=False, @@ -247,7 +245,6 @@ def normalize(self, archive, logger: 'BoundLogger') -> None: for sample in self.samples: set_sample_status( sample.reference, - archive.m_context, logger, as_delivered=False, fresh=False, @@ -303,7 +300,6 @@ def normalize(self, archive, logger: 'BoundLogger') -> None: for sample in self.samples: set_sample_status( sample.reference, - archive.m_context, logger, as_delivered=False, fresh=False, @@ -449,7 +445,6 @@ def normalize(self, archive, logger: 'BoundLogger') -> None: for sample in self.children_samples: set_sample_status( sample.reference, - archive.m_context, logger, as_delivered=False, fresh=False, @@ -459,7 +454,6 @@ def normalize(self, archive, logger: 'BoundLogger') -> None: set_sample_status( self.parent_sample.reference, - archive.m_context, logger, as_delivered=False, fresh=False, diff --git a/src/pdi_nomad_plugin/mbe/processes.py b/src/pdi_nomad_plugin/mbe/processes.py index dcfa009..5206f19 100644 --- a/src/pdi_nomad_plugin/mbe/processes.py +++ b/src/pdi_nomad_plugin/mbe/processes.py @@ -894,7 +894,6 @@ def normalize(self, archive, logger): if sample_holder_position.substrate: set_sample_status( sample_holder_position.substrate.reference, - archive.m_context, logger, as_delivered=False, fresh=False, diff --git a/src/pdi_nomad_plugin/utils.py b/src/pdi_nomad_plugin/utils.py index c126c25..2f6ff2c 100644 --- a/src/pdi_nomad_plugin/utils.py +++ b/src/pdi_nomad_plugin/utils.py @@ -303,7 +303,6 @@ def fetch_substrate(archive, sample_id, substrate_id, logger): def set_sample_status( sample_reference, - context, logger, *, as_delivered=False, @@ -316,6 +315,22 @@ def set_sample_status( in the sample reference file. The Sample archive file is then overwritten. """ + + from nomad.app.v1.routers.uploads import get_upload_with_read_access + from nomad.datamodel.context import ServerContext + from nomad.datamodel.data import User + + context = ServerContext( + get_upload_with_read_access( + sample_reference.m_parent.metadata.m_context.upload_id, + User( + # is_admin=True, + user_id=sample_reference.m_parent.metadata.main_author.user_id, + ), + include_others=True, + ) + ) + if sample_reference: if ( hasattr(sample_reference, 'fresh') diff --git a/tests/data/mbe/2023_06_12/MBE8_config.xlsx b/tests/data/mbe/2023_06_12/MBE8_config.xlsx index 6213ebb..49ee736 100644 Binary files a/tests/data/mbe/2023_06_12/MBE8_config.xlsx and b/tests/data/mbe/2023_06_12/MBE8_config.xlsx differ