/** * Ensures the `msg.sender` has permission for the given kind/type of account. */ modifier isAllowed(uint8 kind) { require(kind > 0, "Invalid, or missing permission"); if (msg.sender != owner) { require(permissions[kind].exists(msg.sender), "Missing permission"); } _; } /** * Adds an account to storage * THROWS when `msg.sender` doesn't have permission * THROWS when the account already exists * @param addr The address of the account * @param kind The kind of account * @param isFrozen The frozen status of the account * @param parent The account parent/owner */ function addAccount(address addr, uint8 kind, bool isFrozen, address parent) isUnlocked isAllowed(kind) external { require(accounts.append(addr, kind, isFrozen, parent), "Account already exists"); } /** * Grants the address permission for the given kind * @param kind The kind of address * @param addr The address */ function grantPermission(uint8 kind, address addr) isUnlocked isAllowed(kind) external { permissions[kind].append(addr); }
0.4.18