Protocol Structure
Purpose
Access Levels can be assigned to accounts and addresses by Access Level Administrators through the AppManager. They are predefined as 0,1,2,3,4 and are stored as uint8 in the AccessLevels data contract. This data contract is deployed when the AppManager is deployed. The AccessLevels data contract can be migrated to a new AppManager during an upgrade to maintain access level and address data. Access Level administrators can migrate data contracts to a new AppManager through a two step migration process.
The protocol uses access levels to perform access level related rule checks. The levels may be used as needed to suit the needs of the application and the rules.
The default access level for each account is 0.
Scope
Access Levels are applied to addresses. When an access level related rule is activated, all users will be subject to any limitations set by the rule related to their individual access level.
see Access Level Rules
Data Structure
Access Levels are a uint8 number stored in a mapping inside the AccessLevels data contract.
see AccessLevels
Enabling/Disabling
- Access Levels can only be set in the AppManager by an Access Level Administrator.
Revert Messages
The transaction will revert with the following error when attempting to set access level greater than 4:
The selector for this error is 0xfd12da91
.
The transaction will revert with the following error when attempting to set access level for 0x0000000000000000000000000000000000000000 address:
The selector for this error is 0xd92e233d
.
Add Functions
Adding an access level is done through the function:
Adding a single access level to multiple accounts or addresses is done through the function:
Adding multiple access levels to multiple accounts or addresses is done through the function:
see AccessLevels
Remove Function
To remove an access level simply use the remove function:
Parameters:
- _level (uint8): access level for an account.
- _levels (uint8[]): array of access levels for an account.
- _account (address): address of the account to tag
- _accounts (address[]): array of addresses to tag
Parameter Optionality:
There are no options for the parameters of the add or remove functions.
Parameter Validation:
The following validation will be carried out by the addAccessLevel function in order to ensure that these parameters are valid and make sense:
_level
is not greater than 4._account
is an address and not the zero address.
see AccessLevels
Other Functions:
- In App Manager:
- Function to get the access level of an address:
- Function to propose a new Access Level Provider
- Function to get the Access Level Provider address
- Function to propose data contract migration to new handler:
- Function to confirm migration of data contracts to new handler:
- Function to get the access level of an address:
Events
- AD1467_AccessLevelAdded(address indexed _address, uint8 indexed _level): emitted when:
- An access level has been added.
- AD1467_AccessLevelProviderSet(address indexed _address): emitted when:
- An access level data contract has been migrated to the app manager address