From 86ea714139df968911e9424740013e3f2df3480d Mon Sep 17 00:00:00 2001 From: sairajzero Date: Sun, 16 Feb 2020 02:34:58 +0530 Subject: [PATCH] adding manage subAdmin to floDapps floDapps.manageSubAdmins() allows the user to add and/or remove subadmin list via blockchain *Requires Admin Privatekey of the app --- standard_Operations.html | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/standard_Operations.html b/standard_Operations.html index 07725d5..54c8909 100644 --- a/standard_Operations.html +++ b/standard_Operations.html @@ -8696,6 +8696,26 @@ Bitcoin.Util = { this.util.appObs = appObs }, + manageSubAdmins(adminPrivKey, addList, rmList){ + return new Promise((resolve, reject) => { + if(!Array.isArray(addList)) addList = undefined; + if(!Array.isArray(rmList)) rmList = undefined; + var floData = { + [floGlobals.application] : { + addSubAdmin : addList, + removeSubAdmin: rmList, + } + } + var floID = floCrypto.getFloIDfromPubkeyHex(floCrypto.getPubKeyHex(adminPrivKey)) + if(floID != floGlobals.adminID) + reject('Access Denied for Admin privilege') + else + floBlockchainAPI.writeData(floID, JSON.stringify(floData), adminPrivKey) + .then(result => resolve(['Updated SubAdmin List', result])) + .catch(error => reject(error)) + }) + }, + clearCredentials: function(){ var indexArr = localStorage.getItem(`${floGlobals.application}#privKey`) if(!indexArr)