|
@@ -11,7 +11,6 @@ use frame_support::{ensure, Parameter};
|
|
pub use serde::{Deserialize, Serialize};
|
|
pub use serde::{Deserialize, Serialize};
|
|
use sp_arithmetic::traits::BaseArithmetic;
|
|
use sp_arithmetic::traits::BaseArithmetic;
|
|
use sp_runtime::traits::{MaybeSerializeDeserialize, Member};
|
|
use sp_runtime::traits::{MaybeSerializeDeserialize, Member};
|
|
-// use frame_system::ensure_root;
|
|
|
|
|
|
|
|
/// Model of authentication manager.
|
|
/// Model of authentication manager.
|
|
pub trait ContentActorAuthenticator: frame_system::Trait + membership::Trait {
|
|
pub trait ContentActorAuthenticator: frame_system::Trait + membership::Trait {
|
|
@@ -168,8 +167,6 @@ pub fn ensure_actor_authorized_to_update_channel<T: Trait>(
|
|
|
|
|
|
Ok(())
|
|
Ok(())
|
|
}
|
|
}
|
|
- // TODO:
|
|
|
|
- // ContentActor::Dao(_daoId) => ...,
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -198,7 +195,7 @@ pub fn ensure_actor_authorized_to_censor<T: Trait>(
|
|
ContentActor::Lead => {
|
|
ContentActor::Lead => {
|
|
let sender = ensure_signed(origin)?;
|
|
let sender = ensure_signed(origin)?;
|
|
ensure_lead_auth_success::<T>(&sender)
|
|
ensure_lead_auth_success::<T>(&sender)
|
|
- },
|
|
|
|
|
|
+ }
|
|
ContentActor::Curator(curator_group_id, curator_id) => {
|
|
ContentActor::Curator(curator_group_id, curator_id) => {
|
|
let sender = ensure_signed(origin)?;
|
|
let sender = ensure_signed(origin)?;
|
|
|
|
|
|
@@ -215,13 +212,11 @@ pub fn ensure_actor_authorized_to_censor<T: Trait>(
|
|
} else {
|
|
} else {
|
|
Ok(())
|
|
Ok(())
|
|
}
|
|
}
|
|
- },
|
|
|
|
|
|
+ }
|
|
ContentActor::Member(_) => {
|
|
ContentActor::Member(_) => {
|
|
// Members cannot censore channels!
|
|
// Members cannot censore channels!
|
|
Err(Error::<T>::ActorNotAuthorized.into())
|
|
Err(Error::<T>::ActorNotAuthorized.into())
|
|
}
|
|
}
|
|
- // TODO:
|
|
|
|
- // ContentActor::Dao(_daoId) => ...,
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -234,40 +229,20 @@ pub fn ensure_actor_authorized_to_manage_categories<T: Trait>(
|
|
ContentActor::Lead => {
|
|
ContentActor::Lead => {
|
|
let sender = ensure_signed(origin)?;
|
|
let sender = ensure_signed(origin)?;
|
|
ensure_lead_auth_success::<T>(&sender)
|
|
ensure_lead_auth_success::<T>(&sender)
|
|
- },
|
|
|
|
|
|
+ }
|
|
ContentActor::Curator(curator_group_id, curator_id) => {
|
|
ContentActor::Curator(curator_group_id, curator_id) => {
|
|
let sender = ensure_signed(origin)?;
|
|
let sender = ensure_signed(origin)?;
|
|
|
|
|
|
// Authorize curator, performing all checks to ensure curator can act
|
|
// Authorize curator, performing all checks to ensure curator can act
|
|
- CuratorGroup::<T>::perform_curator_in_group_auth(
|
|
|
|
- curator_id,
|
|
|
|
- curator_group_id,
|
|
|
|
- &sender,
|
|
|
|
- )
|
|
|
|
- },
|
|
|
|
|
|
+ CuratorGroup::<T>::perform_curator_in_group_auth(curator_id, curator_group_id, &sender)
|
|
|
|
+ }
|
|
ContentActor::Member(_) => {
|
|
ContentActor::Member(_) => {
|
|
// Members cannot censore channels!
|
|
// Members cannot censore channels!
|
|
Err(Error::<T>::ActorNotAuthorized.into())
|
|
Err(Error::<T>::ActorNotAuthorized.into())
|
|
}
|
|
}
|
|
- // TODO:
|
|
|
|
- // ContentActor::Dao(_daoId) => ...,
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// pub fn ensure_actor_authorized_to_delete_stale_assets<T: Trait>(
|
|
|
|
-// origin: T::Origin,
|
|
|
|
-// actor: &ContentActor<T::CuratorGroupId, T::CuratorId, T::MemberId>,
|
|
|
|
-// ) -> DispatchResult {
|
|
|
|
-// // Only Lead and (sudo) can delete assets no longer associated with a channel or person.
|
|
|
|
-// if let ContentActor::Lead = actor {
|
|
|
|
-// let sender = ensure_signed(origin)?;
|
|
|
|
-// ensure_lead_auth_success::<T>(&sender)
|
|
|
|
-// } else {
|
|
|
|
-// ensure_root(origin)?;
|
|
|
|
-// Ok(())
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
/// Enum, representing all possible `Actor`s
|
|
/// Enum, representing all possible `Actor`s
|
|
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
#[derive(Encode, Decode, Eq, PartialEq, Clone, Copy, Debug)]
|
|
#[derive(Encode, Decode, Eq, PartialEq, Clone, Copy, Debug)]
|
|
@@ -279,7 +254,6 @@ pub enum ContentActor<
|
|
Curator(CuratorGroupId, CuratorId),
|
|
Curator(CuratorGroupId, CuratorId),
|
|
Member(MemberId),
|
|
Member(MemberId),
|
|
Lead,
|
|
Lead,
|
|
- // Dao,
|
|
|
|
}
|
|
}
|
|
|
|
|
|
impl<
|
|
impl<
|