Access token permissions

This commit is contained in:
mdecimus
2024-09-10 18:44:44 +02:00
parent 08a95ae58b
commit fbcf55d8e1
128 changed files with 2415 additions and 906 deletions

View File

@@ -4,11 +4,11 @@
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/
use directory::{backend::internal::manage::ManageDirectory, Principal, QueryBy, Type};
use directory::{backend::internal::manage::ManageDirectory, QueryBy, Type};
use mail_send::Credentials;
use store::{LookupStore, Store};
use crate::directory::{map_account_ids, DirectoryTest};
use crate::directory::{map_account_ids, DirectoryTest, IntoTestPrincipal, TestPrincipal};
use super::DirectoryStore;
@@ -110,14 +110,19 @@ async fn sql_directory() {
)
.await
.unwrap()
.unwrap(),
Principal {
.unwrap()
.into_test(),
TestPrincipal {
id: base_store.get_account_id("john").await.unwrap().unwrap(),
name: "john".to_string(),
description: "John Doe".to_string().into(),
secrets: vec!["12345".to_string()],
typ: Type::Individual,
member_of: map_account_ids(base_store, vec!["sales"]).await,
member_of: map_account_ids(base_store, vec!["sales"])
.await
.into_iter()
.map(|v| v.to_string())
.collect(),
emails: vec![
"john@example.org".to_string(),
"jdoe@example.org".to_string(),
@@ -137,8 +142,9 @@ async fn sql_directory() {
)
.await
.unwrap()
.unwrap(),
Principal {
.unwrap()
.into_test(),
TestPrincipal {
id: base_store.get_account_id("bill").await.unwrap().unwrap(),
name: "bill".to_string(),
description: "Bill Foobar".to_string().into(),
@@ -169,14 +175,19 @@ async fn sql_directory() {
.query(QueryBy::Name("jane"), true)
.await
.unwrap()
.unwrap(),
Principal {
.unwrap()
.into_test(),
TestPrincipal {
id: base_store.get_account_id("jane").await.unwrap().unwrap(),
name: "jane".to_string(),
description: "Jane Doe".to_string().into(),
typ: Type::Individual,
secrets: vec!["abcde".to_string()],
member_of: map_account_ids(base_store, vec!["sales", "support"]).await,
member_of: map_account_ids(base_store, vec!["sales", "support"])
.await
.into_iter()
.map(|v| v.to_string())
.collect(),
emails: vec!["jane@example.org".to_string(),],
..Default::default()
}
@@ -188,8 +199,9 @@ async fn sql_directory() {
.query(QueryBy::Name("sales"), true)
.await
.unwrap()
.unwrap(),
Principal {
.unwrap()
.into_test(),
TestPrincipal {
id: base_store.get_account_id("sales").await.unwrap().unwrap(),
name: "sales".to_string(),
description: "Sales Team".to_string().into(),