|
|
|
@ -878,8 +878,6 @@ var removeOwnedChannel = function (Env, channelId, unsafeKey, cb) {
|
|
|
|
|
}));
|
|
|
|
|
}).nThen(function (w) {
|
|
|
|
|
// remove the blob
|
|
|
|
|
|
|
|
|
|
if (Env.retainData) {
|
|
|
|
|
return void Env.blobStore.archive.blob(blobId, w(function (err) {
|
|
|
|
|
Log.info('ARCHIVAL_OWNED_FILE_BY_OWNER_RPC', {
|
|
|
|
|
safeKey: safeKey,
|
|
|
|
@ -891,21 +889,8 @@ var removeOwnedChannel = function (Env, channelId, unsafeKey, cb) {
|
|
|
|
|
return void cb(err);
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
Env.blobStore.remove.blob(blobId, w(function (err) {
|
|
|
|
|
Log.info('DELETION_OWNED_FILE_BY_OWNER_RPC', {
|
|
|
|
|
safeKey: safeKey,
|
|
|
|
|
blobId: blobId,
|
|
|
|
|
status: err? String(err): 'SUCCESS',
|
|
|
|
|
});
|
|
|
|
|
if (err) {
|
|
|
|
|
w.abort();
|
|
|
|
|
return void cb(err);
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}).nThen(function () {
|
|
|
|
|
// remove the proof
|
|
|
|
|
if (Env.retainData) {
|
|
|
|
|
// archive the proof
|
|
|
|
|
return void Env.blobStore.archive.proof(safeKey, blobId, function (err) {
|
|
|
|
|
Log.info("ARCHIVAL_PROOF_REMOVAL_BY_OWNER_RPC", {
|
|
|
|
|
safeKey: safeKey,
|
|
|
|
@ -917,19 +902,6 @@ var removeOwnedChannel = function (Env, channelId, unsafeKey, cb) {
|
|
|
|
|
}
|
|
|
|
|
cb();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Env.blobStore.remove.proof(safeKey, blobId, function (err) {
|
|
|
|
|
Log.info("DELETION_PROOF_REMOVAL_BY_OWNER_RPC", {
|
|
|
|
|
safeKey: safeKey,
|
|
|
|
|
blobId: blobId,
|
|
|
|
|
status: err? String(err): 'SUCCESS',
|
|
|
|
|
});
|
|
|
|
|
if (err) {
|
|
|
|
|
return void cb("E_PROOF_REMOVAL");
|
|
|
|
|
}
|
|
|
|
|
cb();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -939,9 +911,7 @@ var removeOwnedChannel = function (Env, channelId, unsafeKey, cb) {
|
|
|
|
|
if (!isOwner(metadata, unsafeKey)) {
|
|
|
|
|
return void cb('INSUFFICIENT_PERMISSIONS');
|
|
|
|
|
}
|
|
|
|
|
// if the admin has configured data retention...
|
|
|
|
|
// temporarily archive the file instead of removing it
|
|
|
|
|
if (Env.retainData) {
|
|
|
|
|
// temporarily archive the file
|
|
|
|
|
return void Env.msgStore.archiveChannel(channelId, function (e) {
|
|
|
|
|
Log.info('ARCHIVAL_CHANNEL_BY_OWNER_RPC', {
|
|
|
|
|
unsafeKey: unsafeKey,
|
|
|
|
@ -950,16 +920,6 @@ var removeOwnedChannel = function (Env, channelId, unsafeKey, cb) {
|
|
|
|
|
});
|
|
|
|
|
cb(e);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return void Env.msgStore.removeChannel(channelId, function (e) {
|
|
|
|
|
Log.info('DELETION_CHANNEL_BY_OWNER_RPC', {
|
|
|
|
|
unsafeKey: unsafeKey,
|
|
|
|
|
channelId: channelId,
|
|
|
|
|
status: e? String(e): 'SUCCESS',
|
|
|
|
|
});
|
|
|
|
|
cb(e);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -1437,7 +1397,6 @@ RPC.create = function (config, cb) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var Env = {
|
|
|
|
|
retainData: config.retainData || false,
|
|
|
|
|
defaultStorageLimit: config.defaultStorageLimit,
|
|
|
|
|
maxUploadSize: config.maxUploadSize || (20 * 1024 * 1024),
|
|
|
|
|
Sessions: {},
|
|
|
|
|