validate owners against amended metadata when removing channels

pull/1/head
ansuz 5 years ago
parent 31f7c4b90a
commit 7e13f7e3ca

@ -888,19 +888,12 @@ var removeOwnedChannel = function (Env, channelId, unsafeKey, cb) {
return void removeOwnedBlob(Env, channelId, unsafeKey, cb); return void removeOwnedBlob(Env, channelId, unsafeKey, cb);
} }
// FIXME METADATA getMetadata(Env, channelId, function (err, metadata) {
if (!(Env.msgStore && Env.msgStore.removeChannel && Env.msgStore.getChannelMetadata)) { if (err) { return void cb(err); }
return cb("E_NOT_IMPLEMENTED");
}
// FIXME METADATA
Env.msgStore.getChannelMetadata(channelId, function (e, metadata) {
if (e) { return cb(e); }
if (!(metadata && Array.isArray(metadata.owners))) { return void cb('E_NO_OWNERS'); } if (!(metadata && Array.isArray(metadata.owners))) { return void cb('E_NO_OWNERS'); }
if (metadata.owners.indexOf(unsafeKey) === -1) { if (metadata.owners.indexOf(unsafeKey) === -1) {
return void cb('INSUFFICIENT_PERMISSIONS'); return void cb('INSUFFICIENT_PERMISSIONS');
} }
// if the admin has configured data retention... // if the admin has configured data retention...
// temporarily archive the file instead of removing it // temporarily archive the file instead of removing it
if (Env.retainData) { if (Env.retainData) {

Loading…
Cancel
Save