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 missing permissions in afloat #18

Merged
merged 3 commits into from
Sep 29, 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
2 changes: 2 additions & 0 deletions pallets/afloat/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,8 @@ 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 ee955a - 4c39a1:

  • Added a give_role_to_user() function to give a user an AfloatRole of Admin
  • Added a do_add_account_to_afloat_frunique() function to add an account to AfloatFrunique with a FruniqueRole of Admin
  • Added an event to deposit an AdminAdded event with the authority and user address

Self::give_role_to_user(user_address.clone(), AfloatRole::Admin)?;

Self::do_add_account_to_afloat_frunique(user_address.clone(), FruniqueRole::Admin)?;

Self::deposit_event(Event::AdminAdded(authority, user_address));
Ok(())
}
Expand Down
8 changes: 8 additions & 0 deletions pallets/afloat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ pub mod pallet {
Self::do_setup_roles(creator, admin)?;

Choose a reason for hiding this comment

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

GPT summary of 6a74f5 - 23cf5d:

  • Added functionality for adding a user to an Afloat role
  • Added functionality for adding a user to a Frunique role
  • Added functionality for setting up roles for a creator and admin

Ok(())
},
InitialSetupArgs::AddAfloatRole { who, role } => {
Self::give_role_to_user(who, role)?;
Ok(())
},
InitialSetupArgs::AddFruniqueRole { who, role } => {
Self::do_add_account_to_afloat_frunique(who, role)?;
Ok(())
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions pallets/afloat/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::*;

Choose a reason for hiding this comment

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

GPT summary of d96b85 - 8eb5d8:

  • Added use pallet_fruniques::types::FruniqueRole
  • Added AddAfloatRole and AddFruniqueRole to InitialSetupArgs enum

use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256};
use pallet_fruniques::types::FruniqueRole;
use sp_runtime::sp_std::vec::Vec;

pub type ShortString = BoundedVec<u8, ConstU32<55>>;
Expand Down Expand Up @@ -197,6 +198,8 @@ pub enum CreateAsset<T: Config> {
pub enum InitialSetupArgs<T: Config> {
All { creator: T::AccountId, admin: T::AccountId, asset: CreateAsset<T> },
Roles { creator: T::AccountId, admin: T::AccountId },
AddAfloatRole { who: T::AccountId, role: AfloatRole },
AddFruniqueRole { who: T::AccountId, role: FruniqueRole },
}

// ! Transaction structures
Expand Down
14 changes: 0 additions & 14 deletions pallets/fruniques/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,19 +509,5 @@ pub mod pallet {
T::Rbac::remove_pallet_storage(Self::pallet_id())?;

Choose a reason for hiding this comment

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

GPT summary of 8444d0 - b862cf:

  • Removed the spam_spawning call index
  • Removed associated weight calculation for spam_spawning call index

Ok(())
}

#[pallet::call_index(10)]
#[pallet::weight(Weight::from_parts(10_000,0) + T::DbWeight::get().writes(1))]
pub fn spam_spawning(
origin: OriginFor<T>,
class_id: T::CollectionId,
instances: u32,
) -> DispatchResult {
let _ = ensure_signed(origin)?;
// for instance in instances {
// let _ = Self::mint(instance, class_id, None, None, None, None, None, None, None)?;
// }
Ok(())
}
}
}
Loading