add has_identity (#11197)

* add has_identity

* Update frame/identity/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* update

* update

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Xiliang Chen
2022-04-12 17:26:34 +12:00
committed by GitHub
parent 8351ada6a3
commit f84fc59892
4 changed files with 61 additions and 1 deletions
+6
View File
@@ -978,4 +978,10 @@ impl<T: Config> Pallet<T> {
.filter_map(|a| SuperOf::<T>::get(&a).map(|x| (a, x.1)))
.collect()
}
/// Check if the account has corresponding identity information by the identity field.
pub fn has_identity(who: &T::AccountId, fields: u64) -> bool {
IdentityOf::<T>::get(who)
.map_or(false, |registration| (registration.info.fields().0.bits() & fields) == fields)
}
}