This question is about Solidity code that reads the state of a deployed contract on a Geth node using web3.js. When I call claimsProcessed() with a different account than admin, I expected it to throw my "Security Violation".
Instead it returns a fancy value ...
3963877391197344453575983046348115674221700746820753546331534351508065746944
I have ...
uint256 private claimCount; // == 1
address admin = 0x123..ce;
and ...
function claimsProcessed() public adminOnly view returns (uint256)
{
return claimCount;
}
modifier adminOnly() {
require (
msg.sender == admin, "Security Violation - You are not an admin"
);
_;
}
What can I do to get a "Security Violation" when the read operation is performed by another account than the admins.