/** * Ensures the `msg.sender` has permission for the given kind/type of account. * * - The `owner` account is always allowed * - Addresses/Contracts must have a corresponding entry, for the given kind */ 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"); }
0.4.18