Skip to content

Commit 5cc43e4

Browse files
authored
add delete Roles on kill storage (#28)
* 🔥 refactor(functions.rs): remove unused pallet storage for improved code cleanliness and efficiency * 🔧 chore(lib.rs): refactor remove_pallet_permissions function to improve code readability and maintainability
1 parent f85407c commit 5cc43e4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pallets/afloat/src/functions.rs

+1
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,7 @@ impl<T: Config> Pallet<T> {
957957
}
958958
Ok::<(), DispatchError>(())
959959
})?;
960+
<T as pallet::Config>::Rbac::remove_pallet_storage(Self::pallet_id())?;
960961
Ok(())
961962
}
962963

pallets/rbac/src/lib.rs

+11
Original file line numberDiff line numberDiff line change
@@ -315,5 +315,16 @@ pub mod pallet {
315315
Self::do_remove_permission_from_pallet(pallet, permission_id)?;
316316
Ok(())
317317
}
318+
319+
#[pallet::call_index(6)]
320+
#[pallet::weight(Weight::from_parts(10_000,0) + T::DbWeight::get().writes(1))]
321+
pub fn remove_pallet_permissions(origin: OriginFor<T>, pallet: IdOrVec) -> DispatchResult {
322+
ensure!(
323+
T::RemoveOrigin::ensure_origin(origin.clone()).is_ok(),
324+
Error::<T>::NotAuthorized
325+
);
326+
Self::remove_pallet_storage(pallet)?;
327+
Ok(())
328+
}
318329
}
319330
}

0 commit comments

Comments
 (0)