Commit ce0e1319 authored by David Sikter's avatar David Sikter Committed by Markus Scheidgen
Browse files

Cleanup gui code and refined logic

parent 46be7f5b
Pipeline #109139 canceled with stages
in 8 minutes and 30 seconds
......@@ -615,7 +615,6 @@ class Api {
payload: {
operation: 'publish',
metadata: {
with_embargo: embargoLength > 0,
embargo_length: embargoLength
}
}
......
......@@ -359,7 +359,6 @@ function UploadPage() {
const handlePublish = ({embargo_length}) => {
api.post(`/uploads/${uploadId}/action/publish`, {
with_embargo: embargo_length > 0,
embargo_length: embargo_length
})
.then(results => setUpload(results.data))
......
......@@ -1388,10 +1388,9 @@ def _get_upload_with_read_access(upload_id: str, user: User, include_others: boo
if not upload.published:
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=strip('''
You do not have access to the specified upload - not published yet.'''))
for entry in Calc.objects(upload_id=upload_id):
if entry.metadata.get('with_embargo'):
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=strip('''
You do not have access to the specified upload - published with embargo.'''))
if upload.published and upload.embargo_length > 0:
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=strip('''
You do not have access to the specified upload - published with embargo.'''))
return upload
else:
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=strip('''
......
......@@ -1000,6 +1000,7 @@ class Upload(Proc):
'Only published uploads can be published to the central NOMAD.'
assert config.oasis.central_nomad_deployment_id not in self.published_to, \
'Upload is already published to the central NOMAD.'
assert self.embargo_length == 0, 'Upload must not be under embargo'
from nomad.cli.client.client import _create_client as create_client
central_nomad_client = create_client(
......@@ -1018,8 +1019,6 @@ class Upload(Proc):
for key, value in calc.metadata.items()
if key in _editable_metadata or key in _oasis_metadata})
entry_metadata['calc_id'] = calc.calc_id
if entry_metadata.get('with_embargo'):
continue
upload_metadata_entries[calc.mainfile] = entry_metadata
if 'datasets' in entry_metadata:
for dataset_id in entry_metadata['datasets']:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment