|
|
|
@ -21,16 +21,49 @@ var isValidOwner = function (owner) {
|
|
|
|
|
|
|
|
|
|
// ["RESTRICT_ACCESS", [true], 1561623438989]
|
|
|
|
|
// ["RESTRICT_ACCESS", [false], 1561623438989]
|
|
|
|
|
// commands.RESTRICT_ACCESS = function (meta, args) {};
|
|
|
|
|
commands.RESTRICT_ACCESS = function (meta, args) {
|
|
|
|
|
if (!Array.isArray(args) || typeof(args[0]) !== 'boolean') {
|
|
|
|
|
throw new Error('INVALID_STATE');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var bool = args[0];
|
|
|
|
|
|
|
|
|
|
// reject the proposed command if there is no change in state
|
|
|
|
|
if (meta.restricted === bool) { return false; }
|
|
|
|
|
|
|
|
|
|
// apply the new state
|
|
|
|
|
meta.restricted = args[0];
|
|
|
|
|
|
|
|
|
|
// if you're disabling access restrictions then you can assume
|
|
|
|
|
// then there is nothing more to do. Leave the existing list as-is
|
|
|
|
|
if (!bool) { return true; }
|
|
|
|
|
|
|
|
|
|
// you're all set if an allow list already exists
|
|
|
|
|
if (Array.isArray(meta.allowed)) { return true; }
|
|
|
|
|
|
|
|
|
|
// otherwise define it
|
|
|
|
|
meta.allowed = [];
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ["ADD_ALLOWED", ["7eEqelGso3EBr5jHlei6av4r9w2B9XZiGGwA1EgZ-5I=", ...], 1561623438989]
|
|
|
|
|
// commands.ADD_ALLOWED = function (meta, args) {};
|
|
|
|
|
commands.ADD_ALLOWED = function (meta, args) {
|
|
|
|
|
args = args;
|
|
|
|
|
throw new Error('NOT_IMPLEMENTED');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ["RM_ALLOWED", ["7eEqelGso3EBr5jHlei6av4r9w2B9XZiGGwA1EgZ-5I=", ...], 1561623438989]
|
|
|
|
|
// commands.RM_ALLOWED = function (meta, args) {};
|
|
|
|
|
commands.RM_ALLOWED = function (meta, args) {
|
|
|
|
|
args = args;
|
|
|
|
|
throw new Error('NOT_IMPLEMENTED');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ["RESET_ALLOWED", ["7eEqelGso3EBr5jHlei6av4r9w2B9XZiGGwA1EgZ-5I=", ...], 1561623438989]
|
|
|
|
|
// commands.RESET_ALLOWED = function (meta, args) {};
|
|
|
|
|
commands.RESET_ALLOWED = function (meta, args) {
|
|
|
|
|
args = args;
|
|
|
|
|
throw new Error('NOT_IMPLEMENTED');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ["ADD_OWNERS", ["7eEqelGso3EBr5jHlei6av4r9w2B9XZiGGwA1EgZ-5I="], 1561623438989]
|
|
|
|
|
commands.ADD_OWNERS = function (meta, args) {
|
|
|
|
|