Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Provide access to dataset logbook #699

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 58 additions & 48 deletions common/models/dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const logger = require("../logger");
// TODO Feature Add delete functionality for dataset, which removes Dataset and all linked data:
// OrigDatablock and Datablock and DatasetAttachments

module.exports = function(Dataset) {
module.exports = function (Dataset) {
var app = require("../../server/server");

Dataset.appendToArrayField = function(id, fieldName, data, ctx, next) {
Dataset.appendToArrayField = function (id, fieldName, data, ctx, next) {
const where = { pid: id };
var $addToSet = {};
// $each is necessary as data is an array of values
Expand All @@ -24,9 +24,9 @@ module.exports = function(Dataset) {
};


Dataset.prototype.updateSize = function(id, sizeField, size, numFilesField, numFiles, next) {
Dataset.prototype.updateSize = function (id, sizeField, size, numFilesField, numFiles, next) {
// console.log("Updating size field:", id, sizeField, size)
Dataset.findById(id, function(err, instance) {
Dataset.findById(id, function (err, instance) {
if (err) {
return next(err);
} else {
Expand All @@ -38,7 +38,7 @@ module.exports = function(Dataset) {
}
instance[sizeField] = size + oldsize;
// console.log("new size:",instance[sizeField])
var oldNumFiles=0;
var oldNumFiles = 0;
if (instance[numFilesField]) {
oldNumFiles = instance[numFilesField];
}
Expand All @@ -54,27 +54,27 @@ module.exports = function(Dataset) {
Dataset.validatesUniquenessOf("pid");

// put
Dataset.beforeRemote("replaceOrCreate", function(ctx, instance, next) {
Dataset.beforeRemote("replaceOrCreate", function (ctx, instance, next) {
// console.log("++++++++++++ PUT")
utils.updateTimesToUTC(["creationTime"], ctx.args.data);
utils.dropAutoGeneratedFields(ctx.args.data, next);
});

// patch
Dataset.beforeRemote("patchOrCreate", function(ctx, instance, next) {
Dataset.beforeRemote("patchOrCreate", function (ctx, instance, next) {
// console.log("+++++++++++++++ PATCH")
utils.updateTimesToUTC(["creationTime"], ctx.args.data);
utils.dropAutoGeneratedFields(ctx.args.data, next);
});

// post
Dataset.beforeRemote("create", function(ctx, unused, next) {
Dataset.beforeRemote("create", function (ctx, unused, next) {
// console.log("+++++++++++++++ POST")
utils.updateTimesToUTC(["creationTime"], ctx.args.data);
utils.dropAutoGeneratedFields(ctx.args.data, next);
});

Dataset.beforeRemote("find", function(ctx, unused, next) {
Dataset.beforeRemote("find", function (ctx, unused, next) {
const accessToken = ctx.args.options.accessToken;
if (!accessToken) {
if (!ctx.args.filter) {
Expand All @@ -90,7 +90,7 @@ module.exports = function(Dataset) {
next();
});

Dataset.afterRemote("findById", function(ctx, unused, next) {
Dataset.afterRemote("findById", function (ctx, unused, next) {
const accessToken = ctx.args.options.accessToken;
let error;
if (!accessToken) {
Expand All @@ -101,15 +101,15 @@ module.exports = function(Dataset) {
}
next(error);
});
Dataset.beforeRemote("prototype.__get__attachments", function(ctx, unused, next){
Dataset.beforeRemote("prototype.__get__attachments", function (ctx, unused, next) {
checkACLtoRelatedModel(ctx, next);
});

Dataset.beforeRemote("prototype.__get__origdatablocks", function(ctx, unused, next){
Dataset.beforeRemote("prototype.__get__origdatablocks", function (ctx, unused, next) {
checkACLtoRelatedModel(ctx, next);
});

Dataset.beforeRemote("prototype.__get__datablocks", function(ctx, unused, next){
Dataset.beforeRemote("prototype.__get__datablocks", function (ctx, unused, next) {
checkACLtoRelatedModel(ctx, next);
});

Expand All @@ -122,18 +122,18 @@ module.exports = function(Dataset) {
const groups = ctx.args.options.currentGroups;
// Allow access to related model if dataset is published or user is owner or user is in a group having read access to the dataset
if (ctx.instance.isPublished
|| (accessToken
&& (groups.indexOf(ctx.instance.ownerGroup) !== -1
|| groups.indexOf("globalaccess") !== -1
|| ctx.instance.accessGroups && groups.some(g => ctx.instance.accessGroups.indexOf(g) !== -1)
|| ctx.instance.sharedWith && groups.some(g => ctx.instance.sharedWith.indexOf(g) !== -1)
|| groups.indexOf(ctx.instance.instrumentGroup) !== -1))) {
|| (accessToken
&& (groups.indexOf(ctx.instance.ownerGroup) !== -1
|| groups.indexOf("globalaccess") !== -1
|| ctx.instance.accessGroups && groups.some(g => ctx.instance.accessGroups.indexOf(g) !== -1)
|| ctx.instance.sharedWith && groups.some(g => ctx.instance.sharedWith.indexOf(g) !== -1)
|| groups.indexOf(ctx.instance.instrumentGroup) !== -1))) {
return next();
}
return next(error);
};

Dataset.beforeRemote("findOne", function(ctx, unused, next) {
Dataset.beforeRemote("findOne", function (ctx, unused, next) {
const accessToken = ctx.args.options.accessToken;
if (!accessToken) {
if (!ctx.args.filter) {
Expand All @@ -149,23 +149,23 @@ module.exports = function(Dataset) {
next();
});

Dataset.beforeRemote("metadataKeys", function(ctx, unused, next) {
Dataset.beforeRemote("metadataKeys", function (ctx, unused, next) {
const accessToken = ctx.args.options.accessToken;
if (!accessToken) {
ctx.args.fields.isPublished = true;
}
next();
});

Dataset.beforeRemote("fullfacet", function(ctx, unused, next) {
Dataset.beforeRemote("fullfacet", function (ctx, unused, next) {
const accessToken = ctx.args.options.accessToken;
if (!accessToken) {
ctx.args.fields.isPublished = true;
}
next();
});

Dataset.beforeRemote("fullquery", function(ctx, unused, next) {
Dataset.beforeRemote("fullquery", function (ctx, unused, next) {
const accessToken = ctx.args.options.accessToken;
if (!accessToken) {
ctx.args.fields.isPublished = true;
Expand Down Expand Up @@ -196,8 +196,8 @@ module.exports = function(Dataset) {
currentUnit,
unit
);
lodash.update(scientificMetadata, `${lhs}.unit`, () => {return unitRequested;});
lodash.update(scientificMetadata, `${lhs}.value`, () => {return valueRequested;});
lodash.update(scientificMetadata, `${lhs}.unit`, () => { return unitRequested; });
lodash.update(scientificMetadata, `${lhs}.value`, () => { return valueRequested; });
}
});
});
Expand All @@ -223,7 +223,7 @@ module.exports = function(Dataset) {
ownerGroup: ownerGroup
}
},
function(err, policyInstance) {
function (err, policyInstance) {
if (err) {
return next(err);
}
Expand Down Expand Up @@ -254,7 +254,7 @@ module.exports = function(Dataset) {
defaultPolicy.archiveEmailsToBeNotified = [];
defaultPolicy.retrieveEmailsToBeNotified = [];
defaultPolicy.embargoPeriod = 3;
Policy.create(defaultPolicy, ctx.options, function(
Policy.create(defaultPolicy, ctx.options, function (
err,
_instance
) {
Expand Down Expand Up @@ -314,7 +314,7 @@ module.exports = function(Dataset) {
ctx.instance.datasetlifecycle.isOnCentralDisk = true;
if (!("archiveStatusMessage" in subblock))
ctx.instance.datasetlifecycle.archiveStatusMessage =
"datasetCreated";
"datasetCreated";
if (!("retrieveStatusMessage" in subblock))
ctx.instance.datasetlifecycle.retrieveStatusMessage = "";
if (!("retrieveIntegrityCheck" in subblock))
Expand All @@ -325,7 +325,7 @@ module.exports = function(Dataset) {
var retention = new Date(
now.setFullYear(
now.getFullYear() +
config.policyRetentionShiftInYears
config.policyRetentionShiftInYears
)
);
ctx.instance.datasetlifecycle.archiveRetentionTime = retention
Expand All @@ -337,7 +337,7 @@ module.exports = function(Dataset) {
var pubDate = new Date(
now.setFullYear(
now.getFullYear() +
config.policyPublicationShiftInYears
config.policyPublicationShiftInYears
)
);
ctx.instance.datasetlifecycle.dateOfPublishing = pubDate
Expand All @@ -353,7 +353,7 @@ module.exports = function(Dataset) {
if (ctx.instance.sourceFolder) {
// remove trailing slashes
if (ctx.instance.sourceFolder !== "/") {
ctx.instance.sourceFolder = ctx.instance.sourceFolder.replace(/\/$/,"");
ctx.instance.sourceFolder = ctx.instance.sourceFolder.replace(/\/$/, "");
}
// autofill datasetName
if (!ctx.instance.datasetName) {
Expand All @@ -362,7 +362,7 @@ module.exports = function(Dataset) {
ctx.instance.datasetName = arr[0];
} else {
ctx.instance.datasetName =
arr[arr.length - 2] + "/" + arr[arr.length - 1];
arr[arr.length - 2] + "/" + arr[arr.length - 1];
}
}
}
Expand All @@ -375,13 +375,13 @@ module.exports = function(Dataset) {
ownerGroup: ctx.instance.ownerGroup
}
};
Policy.findOne(filter, ctx.options, function(err, policyInstance) {
Policy.findOne(filter, ctx.options, function (err, policyInstance) {
if (err) {
var msg =
"Error when looking for Policy of pgroup " +
ctx.instance.ownerGroup +
" " +
err;
"Error when looking for Policy of pgroup " +
ctx.instance.ownerGroup +
" " +
err;
console.log(msg);
next(msg);
} else if (policyInstance) {
Expand Down Expand Up @@ -446,9 +446,9 @@ module.exports = function(Dataset) {
// clean up data connected to a dataset, e.g. if archiving failed
// TODO can the additional findbyId calls be avoided ?

Dataset.reset = function(id, options, next) {
Dataset.reset = function (id, options, next) {
var Datablock = app.models.Datablock;
Dataset.findById(id, options, function(err, l) {
Dataset.findById(id, options, function (err, l) {
if (err) {
next(err);
} else {
Expand All @@ -465,7 +465,7 @@ module.exports = function(Dataset) {
packedSize: 0
},
options,
function(err, _dsInstance) {
function (err, _dsInstance) {
if (err) {
next(err);
}
Expand All @@ -474,7 +474,7 @@ module.exports = function(Dataset) {
datasetId: id
},
options,
function(err, _b) {
function (err, _b) {
if (err) {
next(err);
} else {
Expand All @@ -488,9 +488,9 @@ module.exports = function(Dataset) {
});
};

Dataset.isValid = function(dataset, next) {
Dataset.isValid = function (dataset, next) {
var ds = new Dataset(dataset);
ds.isValid(function(valid) {
ds.isValid(function (valid) {
if (!valid) {
next(null, {
errors: ds.errors,
Expand All @@ -504,7 +504,7 @@ module.exports = function(Dataset) {
});
};

Dataset.thumbnail = async function(id) {
Dataset.thumbnail = async function (id) {
const Attachment = app.models.Attachment;
const filter = {
where: {
Expand All @@ -513,7 +513,7 @@ module.exports = function(Dataset) {
};
return Attachment.findOne(filter).then(instance => {
const base64stringExample =
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAABoVBMVEX////9/f0AAAD9AAD8+/vn6Ojb29v09PRmZmZQUFDi4uLU1NSdnZ10dHTw8PC1tbXW1tagoKDy8vLY2NheXV1TU1NKSkr9///IyMhra2tfX1/9GxsB+/zt7e3p6enk5OSzs7OxsbFMTU3d3d3Nzc28v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5i5WeuHqa6cuX1yReGMPWl7CfTrkv7de3aT72VMx93X96t6zl8cDuADGO1qjs+Bp9Nd/eb7qEr7i5dovT6masHUSd3X7kPhSVuqDMr10Nj8Nh0F8m+LlFvx/yZ95d3I/wAAp1pdugrINlWNGTP7dqqu+dMjyD77Sqiu1+OwUQ4Y9DZZWcAnpi2C+Hy17cY+hX29Ua1ZdBfqjgH7LUbewe6cePLk3eQ9ipvnj54BtAweyWjgWIrODF3yn86PENb61Rn0TJieh132S1Situq1HJCDHKSdCSUKB5PU9aQlkX3Rs3pdPqonFQbN82nHGbxRNE9H9NGL0fWMZW3o2Rd+GelmQ0AF2vGYxYN/vAiGHmWjGSHvtQI0X8o+K++fgJVsMdEaov+5gAAAABJRU5ErkJggg==";
let base64string2 = "";
if (instance && instance.__data && instance.__data.thumbnail !== undefined) {
base64string2 = instance.__data.thumbnail;
Expand All @@ -530,7 +530,7 @@ module.exports = function(Dataset) {
* @returns {Object} The response from the OpenWhisk reduce action
*/

Dataset.reduceDataset = function(dataset) {
Dataset.reduceDataset = function (dataset) {
if (config.datasetReductionEnabled) {
const Producer = kafka.Producer;
const Consumer = kafka.Consumer;
Expand Down Expand Up @@ -588,7 +588,7 @@ module.exports = function(Dataset) {
}
};

Dataset.metadataKeys = async function(fields, limits, options) {
Dataset.metadataKeys = async function (fields, limits, options) {
try {
const blacklist = [
new RegExp(".*_date"),
Expand All @@ -605,7 +605,7 @@ module.exports = function(Dataset) {

// ensure that no more than MAXLIMIT someCollections are read for metadata key extraction
let MAXLIMIT;
if(config.metadataParentInstancesReturnLimit) {
if (config.metadataParentInstancesReturnLimit) {
MAXLIMIT = config.metadataParentInstancesReturnLimit;

let lm;
Expand Down Expand Up @@ -678,4 +678,14 @@ module.exports = function(Dataset) {
logger.logError(err.message, { location: "Dataset.metadatakeys" });
}
};

Dataset.logbook = async function (id, filters = "{}") {
const Logbook = app.models.Logbook;

// returns logbook associated with dataset
const ds = await Dataset.findById(id);

// the logbook chat has the same name as the proposal id
return Logbook.findDatasetLogbook(ds.proposalId, filters);
minottic marked this conversation as resolved.
Show resolved Hide resolved
};
};
39 changes: 38 additions & 1 deletion common/models/dataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,44 @@
"type": "string",
"root": true
}
},
"logbook": {
"accepts": [
{
"arg": "id",
"type": "string",
"required": true,
"description": "Dataset pid",
"http": {
"source": "path"
}
},
{
"arg": "filters",
"type": "string",
"required": false,
"description": "Filter json object, keys: textSearch, showBotMessages, showUserMessages, showImages, skip, limit, sortField",
"http": {
"source": "query"
}
}
],
"returns": [
{
"arg": "logbook",
"type": "object",
"root": true,
"description": "Logbook model instance associated with dataset"
}
],
"description": "Find Logbook model instance associated with dataset",
"http": [
{
"path": "/:id/logbook",
"verb": "get"
}
]
}

}
}
Loading