I'm making a block chain application using Hyperledger Fabric Node SDK, and in it I have to implement the functionality of deleting a user's account. Below is my code for this:
// Revoke the user, then delete the user from wallet.
await ca.revoke({ enrollmentID: email }, adminUser);
const identityService = ca.newIdentityService();
identityService.delete(email, adminUser, true).then( async function(response) {
await wallet.remove(email);
logger.debug("Successfully removed user from wallet!");
}).catch((error) => {
logger.error(`Getting error: ${error}`);
return error.message;
});
I've tried debugging and separately running each line in the code and I've got to know that this whole code works but only the identityService.delete
function does not work.
This function gives the error that Identity removal is disabled.
Looking more into this issue, I've got to know that I have to add:
cfg:
identities:
passwordattempts: 10
allowremove: true
in the standard configuration file.
Here is the Fabric CA Server's Configuration File. In this file the cfg is at the end just above the Operations Section. As I have multiple configuration files in my project, I looked into them and found the same Operations Section in one file. I added the cfg lines above it. But then again the same Identity removal is disabled error shows.
What I want to know is that after adding these lines to the configuration file, why is the error still showing. I again created the channel after adding the lines. How do I know that my block chain network is using the updated configuration file. Or is there a way to update a configuration file and I have not done it properly.
Below is the screenshot of the error that I'm getting:
This has solved the issue. I had to add the 2 flags of --cfg.identities.allowremove and --cfg.affiliations.allowremove and then restart docker and it worked.