MCPcopy Create free account
hub / github.com/PolymathNetwork/polymath-core / checkPermissions

Function checkPermissions

CLI/commands/common/common_functions.js:50–64  ·  view source on GitHub ↗
(action)

Source from the content-addressed store, hash-verified

48}
49
50async function checkPermissions(action) {
51 let contractRegistry = await connect(action._parent.options.jsonInterface, action._parent._address);
52 //NOTE this is a condition to verify if the transaction comes from a module or not.
53 if (contractRegistry.methods.hasOwnProperty('factory')) {
54 let moduleAddress = await contractRegistry.methods.factory().call();
55 let moduleRegistry = await connect(abis.moduleFactory(), moduleAddress);
56 let parentModule = await moduleRegistry.methods.getName().call();
57 let result = await checkPermission(web3.utils.hexToUtf8(parentModule), action._method.name, contractRegistry);
58 if (!result) {
59 console.log("You haven't the right permissions to execute this method.");
60 process.exit(0);
61 }
62 }
63 return
64}
65
66module.exports = {
67 convertToDaysRemaining: function (timeRemaining) {

Callers 1

Calls 2

connectFunction · 0.85
checkPermissionFunction · 0.85

Tested by

no test coverage detected