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 2 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
Loading