-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOriginalMyAccessControl.sol
70 lines (52 loc) · 1.65 KB
/
OriginalMyAccessControl.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
contract OriginalMyAccessControl {
address public owner;
mapping(address => bool) superUser;
mapping(address => bool) manager;
mapping(address => bool) user;
event SuperUser(address userAddress, bool enabled);
event Manager(address userAddress, bool enabled);
event User(address userAddress, bool enabled);
function OriginalMyAccessControl() {
owner = msg.sender;
superUser[msg.sender] = true;
}
modifier Owner {
if (msg.sender != owner) throw;
}
function transferOwnership(address newOwner) Owner{
owner = newOwner;
}
/* Enable superuser mapping */
function enableSuperUser(address target, bool enable) {
if (!superUser[msg.sender] && msg.sender != owner) throw;
superUser[target] = enable;
SuperUser(target, enable);
}
/* Enable manager mapping */
function enableManager(address target, bool enable) {
if (!superUser[msg.sender] && !manager[msg.sender] && msg.sender != owner) throw;
manager[target] = enable;
Manager(target, enable);
}
/* Enable user mapping */
function enableUser(address target, bool enable) {
if (!superUser[msg.sender] && !manager[msg.sender] && msg.sender != owner) throw;
user[target] = enable;
User(target, enable);
}
/* Check Super User Access */
function isSuperUser(address target) {
if (!superUser[target] && target != owner) throw;
}
/* Check Manager Access */
function isManager(address target) {
if (!superUser[target] && !manager[target] && target != owner) throw;
}
/* Check User Access */
function isUser(address target) {
if (!superUser[target] && !manager[target] && !user[target] && target != owner) throw;
}
function(){
throw;
}
}