Commit 5776d98a authored by Diego Molteni's avatar Diego Molteni Committed by Sacha Brants
Browse files

fix: check dataset existence on Idempotency evaluation

parent 9401f8e9
This diff is collapsed.
...@@ -131,9 +131,11 @@ export class DatasetHandler { ...@@ -131,9 +131,11 @@ export class DatasetHandler {
const alreadyRegisteredDataset = subproject.enforce_key ? const alreadyRegisteredDataset = subproject.enforce_key ?
await DatasetDAO.getByKey(journalClient, dataset) : await DatasetDAO.getByKey(journalClient, dataset) :
(await DatasetDAO.get(journalClient, dataset))[0]; (await DatasetDAO.get(journalClient, dataset))[0];
if (alreadyRegisteredDataset) {
await Locker.removeWriteLock(writeLockSession, true); // Keep the lock session await Locker.removeWriteLock(writeLockSession, true); // Keep the lock session
return alreadyRegisteredDataset; return alreadyRegisteredDataset;
} }
}
// set gcs URL and LegalTag with the subproject information // set gcs URL and LegalTag with the subproject information
dataset.gcsurl = subproject.gcs_bucket + '/' + uuidv4(); dataset.gcsurl = subproject.gcs_bucket + '/' + uuidv4();
...@@ -434,7 +436,7 @@ export class DatasetHandler { ...@@ -434,7 +436,7 @@ export class DatasetHandler {
// Check authorizations // Check authorizations
if (FeatureFlags.isEnabled(Feature.AUTHORIZATION)) { if (FeatureFlags.isEnabled(Feature.AUTHORIZATION)) {
if(wid.startsWith('W')) { if (wid.startsWith('W')) {
await Auth.isWriteAuthorized(req.headers.authorization, await Auth.isWriteAuthorized(req.headers.authorization,
subproject.acls.admins, subproject.acls.admins,
tenant, subproject.name, req[Config.DE_FORWARD_APPKEY]); tenant, subproject.name, req[Config.DE_FORWARD_APPKEY]);
...@@ -527,7 +529,7 @@ export class DatasetHandler { ...@@ -527,7 +529,7 @@ export class DatasetHandler {
} }
await Auth.isWriteAuthorized(req.headers.authorization, await Auth.isWriteAuthorized(req.headers.authorization,
authGroups,tenant, subproject.name, req[Config.DE_FORWARD_APPKEY]); authGroups, tenant, subproject.name, req[Config.DE_FORWARD_APPKEY]);
} }
// patch datasetOUT with datasetIN // patch datasetOUT with datasetIN
......
Markdown is supported
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