| Crates.io | pallet-rbac |
| lib.rs | pallet-rbac |
| version | 0.0.2 |
| created_at | 2023-04-19 06:17:28.012714+00 |
| updated_at | 2023-04-19 06:17:28.012714+00 |
| description | This repository is the updated version for [substrate-rbac](https://github.com/gautamdhameja/substrate-rbac) |
| homepage | |
| repository | https://github.com/tranhuyducseven/pallet-rbac |
| max_upload_size | |
| id | 843216 |
| size | 15,009 |
substrate-rbac pallet| Dependencies | Version |
|---|---|
| polkadot | 0.9.40 |
| rustc stable | 1.68.2 |
| rustc nightly | 1.70.0 |
A Substrate pallet implementing role-based access control and permissions for Substrate extrinsic calls.
The filtering of incoming extrinsics and their sender accounts is done at the transaction queue validation layer, using the SignedExtension trait.
Cargo.toml of your runtime directory. Make sure to enter the correct path or git url of the pallet as per your setup.[dependencies.substrate_rbac]
package = 'substrate-rbac'
git = 'https://github.com/gautamdhameja/substrate-rbac.git'
default-features = false
runtime/src/lib.rs.pub use substrate_rbac;
impl substrate_rbac::Config for Runtime {
type Event = Event;
type RbacAdminOrigin = EnsureRoot<AccountId>;
}
construct_runtime!(
pub enum Runtime where
Block = Block,
NodeBlock = opaque::Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
...
...
...
RBAC: substrate_rbac::{Pallet, Call, Storage, Event<T>, Config<T>},
}
);
Authorize type in the SignedExtra checklist.pub type SignedExtra = (
...
...
balances::TakeFees<Runtime>,
substrate_rbac::Authorize<Runtime>
src/chain_spec.rs file.rbac: Some(RBACConfig {
super_admins: vec![get_account_id_from_seed::<sr25519::Public>("Alice")]
})
cargo build --release and then cargo run --release -- --devThe usage of this pallet are demonstrated in the Substrate permissioning sample.
This code not audited and reviewed for production use cases. You can expect bugs and security vulnerabilities. Do not use it as-is in real applications.