You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
974 B
Solidity
29 lines
974 B
Solidity
pragma solidity ^0.8.0;
|
|
|
|
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
|
|
contract RepositoryAccess{
|
|
using EnumerableSet for EnumerableSet.AddressSet;
|
|
mapping(bytes => EnumerableSet.AddressSet) BranchOperators;
|
|
|
|
modifier onlyBranchOperator(bytes memory branch) {
|
|
require(BranchOperators[branch].contains(msg.sender),"only branch Operator");
|
|
_;
|
|
}
|
|
|
|
function _getBranchOwner(bytes memory branch) internal view returns(address){
|
|
return BranchOperators[branch].at(0) ;
|
|
}
|
|
|
|
function addBranchOperator(bytes memory branch, address member) external virtual{
|
|
require(_getBranchOwner(branch) == msg.sender,"only branch owner");
|
|
BranchOperators[branch].add(member);
|
|
}
|
|
|
|
function removeBranchOperator(bytes memory branch , address member) external virtual{
|
|
require(_getBranchOwner(branch) == msg.sender,"only branch owner");
|
|
BranchOperators[branch].remove(member);
|
|
}
|
|
|
|
}
|