conversions6

This commit is contained in:
Filipriec
2026-08-23 18:36:51 +02:00
parent 0c33d1fa5c
commit 6666f7a5b1
24 changed files with 45 additions and 51 deletions

View File

@@ -97,8 +97,8 @@ impl TableDraft {
/// thing that knows it.
pub(crate) fn new() -> Self {
Self {
accounting_currency: "EUR".to_string(),
rate_source_id: "ecb".to_string(),
accounting_currency: String::new(),
rate_source_id: String::new(),
columns: ColumnDraft::new(ColumnCatalog::default()),
..Self::default()
}

View File

@@ -182,7 +182,7 @@ pub(crate) async fn load_admin_page(
can_manage_validations: crate::authz::can_manage(&authorization, crate::authz::STRUCT_VALIDATION),
can_import: crate::authz::can_transfer_anything(&authorization, crate::authz::IMPORT),
can_export: crate::authz::can_transfer_anything(&authorization, crate::authz::EXPORT),
can_ecb: crate::authz::can_read_ecb(&authorization),
can_exchange_rates: crate::authz::can_read_exchange_rates(&authorization),
})
}

View File

@@ -28,7 +28,7 @@ pub(crate) struct AdminPageState {
/// Whether the exchange-rate pipeline is visible to this caller. Not a
/// structural area: it is granted through the ECB object, like the
/// conversions it reports on.
pub can_ecb: bool,
pub can_exchange_rates: bool,
}
impl AdminPageState {

View File

@@ -64,7 +64,7 @@ mod tests {
can_permissions: true,
can_import: false,
can_export: false,
can_ecb: false,
can_exchange_rates: false,
active: "admin",
};
let page = AdminPageState {
@@ -80,7 +80,7 @@ mod tests {
can_manage_validations: true,
can_import: true,
can_export: true,
can_ecb: true,
can_exchange_rates: true,
};
let html = render_page(&page);
for route in [
@@ -126,7 +126,7 @@ mod tests {
can_manage_validations: true,
can_import: true,
can_export: true,
can_ecb: true,
can_exchange_rates: true,
};
let html = render_workspace(&page);
@@ -163,7 +163,7 @@ mod tests {
can_manage_validations: true,
can_import: true,
can_export: true,
can_ecb: true,
can_exchange_rates: true,
};
let html = render_workspace(&page);
@@ -203,7 +203,7 @@ mod tests {
can_manage_validations: true,
can_import: true,
can_export: true,
can_ecb: true,
can_exchange_rates: true,
};
let html = render_workspace(&page);
@@ -242,7 +242,7 @@ mod tests {
can_manage_validations: true,
can_import: true,
can_export: true,
can_ecb: true,
can_exchange_rates: true,
};
let html = render_workspace(&page);

View File

@@ -37,7 +37,7 @@ pub(crate) async fn load_ecb_page(
})?
.into_inner();
if !crate::authz::can_read_ecb(&authorization) {
if !crate::authz::can_read_exchange_rates(&authorization) {
return Err(LoadError::Forbidden);
}

View File

@@ -59,7 +59,7 @@ pub(crate) struct RoleOption {
/// The objects of one profile, or the wildcards that cover every profile.
pub(crate) struct ObjectGroup {
pub title: String,
/// The `data:*` / `journal:*` / `ecb:*` group, which is the one whose
/// The `data:*` / `journal:*` / `exchange-rates:*` group, which is the one whose
/// shortcuts mean "everything, including what is created later".
pub global: bool,
pub rows: Vec<ObjectRow>,
@@ -228,7 +228,7 @@ mod tests {
cells: cells(&ACTIONS, &["read"]),
},
ObjectRow {
object: "ecb:acme".to_string(),
object: "exchange-rates:acme".to_string(),
label: "ECB rates".to_string(),
note: String::new(),
wildcard: true,
@@ -259,12 +259,12 @@ mod tests {
"data:acme/*|delete",
"data:acme/*|export",
"data:acme/*|import",
"ecb:acme|read",
"exchange-rates:acme|read",
]
);
assert_eq!(
group.read_pairs(),
vec!["data:acme/*|read", "ecb:acme|read"]
vec!["data:acme/*|read", "exchange-rates:acme|read"]
);
}

View File

@@ -49,7 +49,7 @@ mod tests {
can_permissions: true,
can_import: false,
can_export: false,
can_ecb: true,
can_exchange_rates: true,
active: "permissions",
},
tabs: Tabs {

View File

@@ -82,10 +82,10 @@ pub(crate) fn starter_grants(
"read" => Ok(vec![
("data:*", "read"),
("journal:*", "read"),
("ecb:*", "read"),
("exchange-rates:*", "read"),
]),
"full" => {
let mut grants = vec![("ecb:*", "read")];
let mut grants = vec![("exchange-rates:*", "read")];
for object in ["data:*", "journal:*"] {
for action in ["read", "insert", "update", "delete"] {
grants.push((object, action));
@@ -120,7 +120,7 @@ mod tests {
assert!(
grants
.iter()
.all(|(object, action)| *object != "ecb:*" || *action == "read"),
.all(|(object, action)| *object != "exchange-rates:*" || *action == "read"),
"{level} granted a write on ECB rates"
);
}

View File

@@ -38,7 +38,7 @@ mod tests {
can_permissions: true,
can_import: false,
can_export: false,
can_ecb: true,
can_exchange_rates: true,
active: "permissions",
},
tabs: Tabs {

View File

@@ -38,7 +38,7 @@ mod tests {
can_permissions: true,
can_import: false,
can_export: false,
can_ecb: true,
can_exchange_rates: true,
active: "permissions",
},
tabs: Tabs {