v0.14.0
This commit is contained in:
@@ -47,7 +47,7 @@ async fn internal_directory() {
|
||||
TestPrincipal {
|
||||
name: "john".into(),
|
||||
description: Some("John Doe".into()),
|
||||
secrets: vec!["secret".into(), "secret2".into()],
|
||||
secrets: vec!["secret".into(), "$app$secret2".into()],
|
||||
..Default::default()
|
||||
}
|
||||
.into(),
|
||||
@@ -148,7 +148,7 @@ async fn internal_directory() {
|
||||
TestPrincipal {
|
||||
name: "jane".into(),
|
||||
description: Some("Jane Doe".into()),
|
||||
secrets: vec!["my_secret".into(), "my_secret2".into()],
|
||||
secrets: vec!["my_secret".into(), "$app$my_secret2".into()],
|
||||
emails: vec!["jane@example.org".into()],
|
||||
quota: 123,
|
||||
..Default::default()
|
||||
@@ -188,7 +188,7 @@ async fn internal_directory() {
|
||||
name: "jane".into(),
|
||||
description: Some("Jane Doe".into()),
|
||||
emails: vec!["jane@example.org".into()],
|
||||
secrets: vec!["my_secret".into(), "my_secret2".into()],
|
||||
secrets: vec!["my_secret".into(), "$app$my_secret2".into()],
|
||||
quota: 123,
|
||||
..Default::default()
|
||||
})
|
||||
@@ -366,7 +366,7 @@ async fn internal_directory() {
|
||||
id: john_id,
|
||||
name: "john".into(),
|
||||
description: Some("John Doe".into()),
|
||||
secrets: vec!["secret".into(), "secret2".into()],
|
||||
secrets: vec!["secret".into(), "$app$secret2".into()],
|
||||
emails: vec!["john@example.org".into()],
|
||||
member_of: vec!["sales".into(), "support".into()],
|
||||
lists: vec!["list".into()],
|
||||
@@ -411,7 +411,7 @@ async fn internal_directory() {
|
||||
id: john_id,
|
||||
name: "john".into(),
|
||||
description: Some("John Doe".into()),
|
||||
secrets: vec!["secret".into(), "secret2".into()],
|
||||
secrets: vec!["secret".into(), "$app$secret2".into()],
|
||||
emails: vec!["john@example.org".into()],
|
||||
member_of: vec!["sales".into()],
|
||||
lists: vec!["list".into()],
|
||||
|
||||
@@ -13,7 +13,7 @@ pub mod sql;
|
||||
|
||||
use common::{Core, Server, config::smtp::session::AddressMapping};
|
||||
use directory::{
|
||||
Directories, Principal, Type,
|
||||
Directories, Principal, PrincipalData, Type,
|
||||
backend::internal::{PrincipalField, PrincipalSet, manage::ManageDirectory},
|
||||
};
|
||||
use mail_send::Credentials;
|
||||
@@ -594,7 +594,16 @@ impl From<Principal> for TestPrincipal {
|
||||
member_of: value.member_of().map(|v| v.to_string()).collect(),
|
||||
roles: value.roles().map(|v| v.to_string()).collect(),
|
||||
lists: value.lists().map(|v| v.to_string()).collect(),
|
||||
secrets: value.secrets().map(|v| v.to_string()).collect(),
|
||||
secrets: value
|
||||
.data
|
||||
.iter()
|
||||
.filter_map(|v| match v {
|
||||
PrincipalData::Password(s)
|
||||
| PrincipalData::AppPassword(s)
|
||||
| PrincipalData::OtpAuth(s) => Some(s.to_string()),
|
||||
_ => None,
|
||||
})
|
||||
.collect(),
|
||||
emails: value.email_addresses().map(|v| v.to_string()).collect(),
|
||||
description: value.description().map(|v| v.to_string()),
|
||||
name: value.name,
|
||||
|
||||
@@ -131,10 +131,7 @@ async fn oidc_directory() {
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
assert_eq!(principal.name(), "jdoe");
|
||||
assert_eq!(
|
||||
principal.email_addresses().next().map(|s| s.as_str()),
|
||||
Some("john@example.org")
|
||||
);
|
||||
assert_eq!(principal.email_addresses().next(), Some("john@example.org"));
|
||||
assert_eq!(principal.description(), Some("John Doe"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
use directory::{
|
||||
QueryParams, ROLE_USER, Type,
|
||||
QueryParams, ROLE_ADMIN, ROLE_USER, Type,
|
||||
backend::{RcptType, internal::manage::ManageDirectory},
|
||||
};
|
||||
use mail_send::Credentials;
|
||||
@@ -189,7 +189,7 @@ async fn sql_directory() {
|
||||
description: Some("Administrator".into()),
|
||||
secrets: vec!["very_secret".into()],
|
||||
typ: Type::Individual,
|
||||
roles: vec![ROLE_USER.to_string()],
|
||||
roles: vec![ROLE_ADMIN.to_string()],
|
||||
..Default::default()
|
||||
}
|
||||
);
|
||||
@@ -208,13 +208,15 @@ async fn sql_directory() {
|
||||
);
|
||||
|
||||
// Get user by name
|
||||
let mut p = handle
|
||||
.query(QueryParams::name("jane").with_return_member_of(true))
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.into_test();
|
||||
p.member_of.sort();
|
||||
assert_eq!(
|
||||
handle
|
||||
.query(QueryParams::name("jane").with_return_member_of(true))
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.into_test(),
|
||||
p,
|
||||
TestPrincipal {
|
||||
id: base_store.get_principal_id("jane").await.unwrap().unwrap(),
|
||||
name: "jane".into(),
|
||||
|
||||
Reference in New Issue
Block a user