Skip to content

Commit

Permalink
Feat/identity changes (#14)
Browse files Browse the repository at this point in the history
* Initial changes

* Fixed errors for sub

* Removed .github folder
  • Loading branch information
JasonTulp authored Nov 1, 2021
1 parent ac02266 commit ef0dfe4
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 207 deletions.
7 changes: 0 additions & 7 deletions .github/allowed-actions.js

This file was deleted.

7 changes: 0 additions & 7 deletions .github/dependabot.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/auto-label-issues.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/auto-label-prs.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/burnin-label-notification.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/check-labels.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/md-link-check.yml

This file was deleted.

7 changes: 0 additions & 7 deletions .github/workflows/mlc_config.json

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/polkadot-companion-labels.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/release-bot.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/release-tagging.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/trigger-review-pipeline.yml

This file was deleted.

19 changes: 13 additions & 6 deletions frame/identity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ impl<
#[repr(u64)]
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, BitFlags, RuntimeDebug)]
pub enum IdentityField {
Display = 0b0000000000000000000000000000000000000000000000000000000000000001,
// Display = 0b0000000000000000000000000000000000000000000000000000000000000001,
Legal = 0b0000000000000000000000000000000000000000000000000000000000000010,
Web = 0b0000000000000000000000000000000000000000000000000000000000000100,
Riot = 0b0000000000000000000000000000000000000000000000000000000000001000,
Discord = 0b0000000000000000000000000000000000000000000000000000000000001000,
Email = 0b0000000000000000000000000000000000000000000000000000000000010000,
PgpFingerprint = 0b0000000000000000000000000000000000000000000000000000000000100000,
Image = 0b0000000000000000000000000000000000000000000000000000000001000000,
Expand Down Expand Up @@ -307,7 +307,7 @@ pub struct IdentityInfo {
/// reasonable context.
///
/// Stored as UTF-8.
pub display: Data,
// pub display: Data,

/// The full legal name in the local jurisdiction of the entity. This might be a bit
/// long-winded.
Expand All @@ -322,10 +322,10 @@ pub struct IdentityInfo {
/// Stored as UTF-8.
pub web: Data,

/// The Riot/Matrix handle held by the controller of the account.
/// The Discord handle held by the controller of the account.
///
/// Stored as UTF-8.
pub riot: Data,
pub discord: Data,

/// The email address of the controller of the account.
///
Expand Down Expand Up @@ -488,7 +488,9 @@ decl_error! {
/// Sender is not a sub-account.
NotSub,
/// Sub-account isn't owned by sender.
NotOwned
NotOwned,
/// Sub-accounts not enabled
SubNotEnabled
}
}

Expand Down Expand Up @@ -642,6 +644,7 @@ decl_module! {
.saturating_add(T::WeightInfo::set_subs_new(subs.len() as u32)) // S: Assume all subs are new.
]
fn set_subs(origin, subs: Vec<(T::AccountId, Data)>) -> DispatchResultWithPostInfo {
ensure!(false, Error::<T>::SubNotEnabled);
let sender = ensure_signed(origin)?;
ensure!(<IdentityOf<T>>::contains_key(&sender), Error::<T>::NotFound);
ensure!(subs.len() <= T::MaxSubAccounts::get() as usize, Error::<T>::TooManySubAccounts);
Expand Down Expand Up @@ -1041,6 +1044,7 @@ decl_module! {
/// sub identity of `sub`.
#[weight = T::WeightInfo::add_sub(T::MaxSubAccounts::get())]
fn add_sub(origin, sub: <T::Lookup as StaticLookup>::Source, data: Data) -> DispatchResult {
ensure!(false, Error::<T>::SubNotEnabled);
let sender = ensure_signed(origin)?;
let sub = T::Lookup::lookup(sub)?;
ensure!(IdentityOf::<T>::contains_key(&sender), Error::<T>::NoIdentity);
Expand Down Expand Up @@ -1069,6 +1073,7 @@ decl_module! {
/// sub identity of `sub`.
#[weight = T::WeightInfo::rename_sub(T::MaxSubAccounts::get())]
fn rename_sub(origin, sub: <T::Lookup as StaticLookup>::Source, data: Data) {
ensure!(false, Error::<T>::SubNotEnabled);
let sender = ensure_signed(origin)?;
let sub = T::Lookup::lookup(sub)?;
ensure!(IdentityOf::<T>::contains_key(&sender), Error::<T>::NoIdentity);
Expand All @@ -1085,6 +1090,7 @@ decl_module! {
/// sub identity of `sub`.
#[weight = T::WeightInfo::remove_sub(T::MaxSubAccounts::get())]
fn remove_sub(origin, sub: <T::Lookup as StaticLookup>::Source) {
ensure!(false, Error::<T>::SubNotEnabled);
let sender = ensure_signed(origin)?;
ensure!(IdentityOf::<T>::contains_key(&sender), Error::<T>::NoIdentity);
let sub = T::Lookup::lookup(sub)?;
Expand Down Expand Up @@ -1112,6 +1118,7 @@ decl_module! {
/// controller of an account is maliciously registered as a sub-account.
#[weight = T::WeightInfo::quit_sub(T::MaxSubAccounts::get())]
fn quit_sub(origin) {
ensure!(false, Error::<T>::SubNotEnabled);
let sender = ensure_signed(origin)?;
let (sup, _) = SuperOf::<T>::take(&sender).ok_or(Error::<T>::NotSub)?;
SubsOf::<T>::mutate(&sup, |(ref mut subs_deposit, ref mut sub_ids)| {
Expand Down

0 comments on commit ef0dfe4

Please sign in to comment.