forked from thonymg/passort-blockchain
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBaseAccesControl.sol
51 lines (47 loc) · 1.46 KB
/
BaseAccesControl.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
contract BaseAccesControl {
address public creatorAddress;
address public commandantAddress;
address public captainAddress;
address public lieutnantAddress;
constructor() {
creatorAddress = msg.sender;
}
modifier onlyCreator() {
require(msg.sender == creatorAddress);
_;
}
modifier onlyCommandant() {
require(msg.sender == commandantAddress
|| msg.sender == creatorAddress );
_;
}
modifier onlyCaptain() {
require(msg.sender == captainAddress
|| msg.sender == commandantAddress
|| msg.sender == creatorAddress );
_;
}
modifier onlyLieutnant() {
require(msg.sender == lieutnantAddress
|| msg.sender == captainAddress
|| msg.sender == commandantAddress
|| msg.sender == creatorAddress );
_;
}
function setCreator(address _newCreator) external onlyCreator() {
require(_newCreator != address(0));
creatorAddress = _newCreator;
}
function setCommandant(address _newComm) external onlyCommandant() {
require(_newComm != address(0));
commandantAddress = _newComm;
}
function setCaptain(address _newCap) external onlyCaptain() {
require(_newCap != address(0));
captainAddress = _newCap;
}
function setLieutnant(address _newLieut) external onlyLieutnant() {
require(_newLieut != address(0));
lieutnantAddress = _newLieut;
}
}