Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add delete Roles on kill storage #28

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pallets/afloat/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,7 @@ impl<T: Config> Pallet<T> {
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 6a0c05 - fc976d:

  • Added a call to Rbac::remove_pallet_storage at the end of the Pallet::uninstall function.

Ok::<(), DispatchError>(())
})?;
<T as pallet::Config>::Rbac::remove_pallet_storage(Self::pallet_id())?;
Ok(())
}

Expand Down
11 changes: 11 additions & 0 deletions pallets/rbac/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,5 +315,16 @@ pub mod pallet {
Self::do_remove_permission_from_pallet(pallet, permission_id)?;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of d8dcfd - 04c864:

  • Added a new call index 6 for the remove_pallet_permissions function
  • Added weight to the remove_pallet_permissions function
  • Added a check to ensure that the origin is authorized for the remove_pallet_permissions function
  • Added functionality to the remove_pallet_permissions function to remove pallet storage

Ok(())
}

#[pallet::call_index(6)]
#[pallet::weight(Weight::from_parts(10_000,0) + T::DbWeight::get().writes(1))]
pub fn remove_pallet_permissions(origin: OriginFor<T>, pallet: IdOrVec) -> DispatchResult {
ensure!(
T::RemoveOrigin::ensure_origin(origin.clone()).is_ok(),
Error::<T>::NotAuthorized
);
Self::remove_pallet_storage(pallet)?;
Ok(())
}
}
}
Loading