git.delta.rocks / unique-network / refs/commits / fd95478c9ddc

difftreelog

CORE-386 Fix access rights

Trubnikov Sergey2022-06-09parent: #46330dd.patch.diff
in: master

2 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
97 .confirm_sponsorship(caller.as_sub())97 .confirm_sponsorship(caller.as_sub())
98 .map_err(dispatch_to_evm::<T>)?98 .map_err(dispatch_to_evm::<T>)?
99 {99 {
100 return Err(Error::Revert("Caller is not set as sponsor".into()));100 return Err("Caller is not set as sponsor".into());
101 }101 }
102 save(self)102 save(self)
103 }103 }
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
491 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);491 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
492492
493 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;493 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
494 target_collection.check_is_owner(&sender)?;494 target_collection.check_is_owner_or_admin(&sender)?;
495 target_collection.check_is_internal()?;495 target_collection.check_is_internal()?;
496496
497 target_collection.set_sponsor(new_sponsor.clone())?;497 target_collection.set_sponsor(new_sponsor.clone())?;
867 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);867 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
868 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;868 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
869 target_collection.check_is_internal()?;869 target_collection.check_is_internal()?;
870 target_collection.check_is_owner(&sender)?;870 target_collection.check_is_owner_or_admin(&sender)?;
871 let old_limit = &target_collection.limits;871 let old_limit = &target_collection.limits;
872872
873 target_collection.limits = <PalletCommon<T>>::clamp_limits(target_collection.mode.clone(), &old_limit, new_limit)?;873 target_collection.limits = <PalletCommon<T>>::clamp_limits(target_collection.mode.clone(), &old_limit, new_limit)?;
889 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);889 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
890 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;890 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
891 target_collection.check_is_internal()?;891 target_collection.check_is_internal()?;
892 target_collection.check_is_owner(&sender)?;892 target_collection.check_is_owner_or_admin(&sender)?;
893 let old_limit = &target_collection.permissions;893 let old_limit = &target_collection.permissions;
894894
895 target_collection.permissions = <PalletCommon<T>>::clamp_permissions(target_collection.mode.clone(), &old_limit, new_limit)?;895 target_collection.permissions = <PalletCommon<T>>::clamp_permissions(target_collection.mode.clone(), &old_limit, new_limit)?;