This project provides a Role-Based Access Control (RBAC) implementation for canisters running on the Internet Computer, written in Rust.
This RBAC implementation features a role-based authorization system, with different roles having different levels of access and permissions.
There are three predefined roles:
- Admin: The highest authority, this role has all permissions including managing roles for all canisters.
- Manager: Has broad control but cannot manage other Admin roles.
- Viewer: Can only call functions that do not modify the canister's state.
- The RBAC system is designed to apply uniform roles across all canisters it controls. This means that the permissions of a particular role are consistent across all canisters, which ensures uniformity of access rights.
- The permission mapping provided by the RBAC canister is universal, and is applicable to all canisters that have the RBAC canister set as their controller. This design choice simplifies code and management, and offers a broad level of control over multiple canisters. However, this comes with the trade-off of reduced granularity in permission control on a per-canister basis, which might be less ideal for complex use-cases requiring fine-tuned permissions.
To run this project, you will need dfx
, the command-line tool for developing dapps on the Internet Computer.
- Install
dfx
by runningsh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
- Install Rust via rustup
- Run
dfx start --background
to start the local network. - Run
dfx deploy
to compile and deploy the canister.
Refer to the provided Rust code in src/
for usage.
- The
install_code
anduninstall_code
functions are under development. Upon completion, they will provide additional control over the canisters. - A significant enhancement will be support for asset canisters, allowing this RBAC system to manage access to various kinds of digital assets.
- The RBAC canister is designed with CI/CD integrations in mind. A future update will include a demonstration of a GitHub Action deployment using the RBAC canister.
We appreciate your contributions! Please submit a pull request with your improvements.
This project is licensed under the MIT License - see the LICENSE file for details.
- Roman Kashitsyn for writing great documentation on his blog mmapped.blog.
- Developer documentation on internetcomputer.org