Browse Source

membership: decouple from current roles module

Mokhtar Naamani 5 years ago
parent
commit
a60ad13ad5
3 changed files with 5 additions and 9 deletions
  1. 0 1
      src/lib.rs
  2. 5 7
      src/membership/members.rs
  3. 0 1
      src/membership/mock.rs

+ 0 - 1
src/lib.rs

@@ -474,7 +474,6 @@ impl members::Trait for Runtime {
     type MemberId = u64;
     type PaidTermId = u64;
     type SubscriptionId = u64;
-    type Roles = LookupRoles;
 }
 
 /*

+ 5 - 7
src/membership/members.rs

@@ -1,5 +1,5 @@
 use crate::currency::{BalanceOf, GovernanceCurrency};
-use crate::traits::{Members, Roles};
+use crate::traits::Members;
 use codec::{Codec, Decode, Encode};
 use rstd::prelude::*;
 use runtime_primitives::traits::{MaybeSerializeDebug, Member, SimpleArithmetic};
@@ -39,8 +39,6 @@ pub trait Trait: system::Trait + GovernanceCurrency + timestamp::Trait {
         + Copy
         + MaybeSerializeDebug
         + PartialEq;
-
-    type Roles: Roles<Self>;
 }
 
 const DEFAULT_FIRST_MEMBER_ID: u32 = 1;
@@ -229,8 +227,8 @@ decl_module! {
             // ensure key not associated with an existing membership
             Self::ensure_not_member(&who)?;
 
-            // ensure account is not in a bonded role
-            ensure!(!T::Roles::is_role_account(&who), "role key cannot be used for membership");
+            // TODO: ensure account doesn't have any locks, is not a signing account of another member
+            // what other restrictions should we apply if any at all?
 
             // ensure paid_terms_id is active
             let terms = Self::ensure_active_terms_id(paid_terms_id)?;
@@ -304,8 +302,8 @@ decl_module! {
             // ensure key not associated with an existing membership
             Self::ensure_not_member(&new_member)?;
 
-            // ensure account is not in a bonded role
-            ensure!(!T::Roles::is_role_account(&new_member), "role key cannot be used for membership");
+            // TODO: ensure account doesn't have any locks, is not a signing account of another member
+            // what other restrictions should we apply if any at all?
 
             let user_info = Self::check_user_registration_info(user_info)?;
 

+ 0 - 1
src/membership/mock.rs

@@ -93,7 +93,6 @@ impl members::Trait for Test {
     type MemberId = u32;
     type PaidTermId = u32;
     type SubscriptionId = u32;
-    type Roles = ();
 }
 
 pub struct ExtBuilder {