Created
November 26, 2018 10:15
-
-
Save d-saravanan/8c5683bb3316a2e4367bb2129ba3a611 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.0+commit.1d4f565a.js&optimize=false&gist=
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.0; | |
pragma experimental ABIEncoderV2; | |
contract AccessControlListContract { | |
mapping(address => mapping(uint256 => mapping(address => uint256))) _userAccessGrants; | |
mapping(address => mapping(address => mapping(uint256 => uint256))) _targetAccessGrants; | |
function grantAccess(address userAddress, uint256 documentHash, address targetUserAddress, uint256 permission) public { | |
_userAccessGrants[userAddress][documentHash][targetUserAddress] = permission; | |
_targetAccessGrants[targetUserAddress][userAddress][documentHash] = permission; | |
} | |
function checkAccess(address requestorAddress, address userAddress, uint256 documentHash) public view returns (uint256) { | |
return _targetAccessGrants[requestorAddress][userAddress][documentHash]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment