Add modifier and tests for removeAuthorizedAddressAtIndex
This commit is contained in:
committed by
Remco Bloemen
parent
8ddcb6c841
commit
ea8c2b8d69
@@ -69,7 +69,7 @@ contract MixinAuthorizable is
|
||||
);
|
||||
|
||||
delete authorized[target];
|
||||
for (uint i = 0; i < authorities.length; i++) {
|
||||
for (uint256 i = 0; i < authorities.length; i++) {
|
||||
if (authorities[i] == target) {
|
||||
authorities[i] = authorities[authorities.length - 1];
|
||||
authorities.length -= 1;
|
||||
@@ -87,7 +87,12 @@ contract MixinAuthorizable is
|
||||
uint256 index
|
||||
)
|
||||
external
|
||||
onlyOwner
|
||||
{
|
||||
require(
|
||||
authorized[target],
|
||||
TARGET_NOT_AUTHORIZED
|
||||
);
|
||||
require(
|
||||
index < authorities.length,
|
||||
INDEX_OUT_OF_BOUNDS
|
||||
|
@@ -13,6 +13,9 @@ import "./IOwnable.sol";
|
||||
contract Ownable is IOwnable {
|
||||
address public owner;
|
||||
|
||||
// Revert reasons
|
||||
string constant ONLY_CONTRACT_OWNER = "ONLY_CONTRACT_OWNER";
|
||||
|
||||
constructor ()
|
||||
public
|
||||
{
|
||||
@@ -22,7 +25,7 @@ contract Ownable is IOwnable {
|
||||
modifier onlyOwner() {
|
||||
require(
|
||||
msg.sender == owner,
|
||||
"Only contract owner is allowed to call this method."
|
||||
ONLY_CONTRACT_OWNER
|
||||
);
|
||||
_;
|
||||
}
|
||||
|
Reference in New Issue
Block a user