// SPDX-License-Identifier: UNLICENSED pragma solidity =0.8.18; import "@openzeppelin/contracts/access/AccessControl.sol"; import "../utils/SomaContract.sol"; import "./ISomaAccessControl.sol"; /** * @notice Implementation of the {ISomaAccessControl} interface. */ contract SomaAccessControl is ISomaAccessControl, SomaContract, AccessControl { /** * @notice Checks if SomaAccessControl inherits a given contract interface. * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControl, SomaContract) returns (bool) { return interfaceId == type(ISomaAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @notice Returns `true` if `account` has been granted `role`. * @param role The role to check if the account has. * @param account The account to check the role against. * @return True if `account` has `role`, False if `account` does not have `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { // allow the subMaster to take control of the access control return super.hasRole(role, account) || SOMA.subMaster() == account; } /** * @inheritdoc ISomaAccessControl */ function setRoleAdmin(bytes32 role, bytes32 adminRole) external override onlyRole(DEFAULT_ADMIN_ROLE) { _setRoleAdmin(role, adminRole); } }