Implement categories support

This commit is contained in:
Nadja Reitzenstein 2022-01-05 21:15:05 +01:00
parent 17005c0536
commit f524079914
4 changed files with 8 additions and 0 deletions

View File

@ -43,6 +43,7 @@
},
Another =
{ wiki = "test_another"
, category = "test"
, disclose = "lab.test.read"
, manage = "lab.test.admin"
, name = "Another"

View File

@ -194,6 +194,9 @@ async fn fill_machine_builder(
if let Some(ref wiki) = machine.desc.wiki {
builder.set_wiki(wiki);
}
if let Some(ref category) = machine.desc.category {
builder.set_category(category);
}
builder.set_urn(&format!("urn:fabaccess:resource:{}", id.as_ref()));
let machineapi = Machine::new(user.clone(), perms, machine.clone());

View File

@ -97,6 +97,7 @@ impl Default for Config {
name: "Testmachine".to_string(),
description: Some("A test machine".to_string()),
wiki: None,
category: None,
privs: PrivilegesBuf {
disclose: PermissionBuf::from_string("lab.test.read".to_string()),
read: PermissionBuf::from_string("lab.test.read".to_string()),

View File

@ -368,6 +368,9 @@ pub struct MachineDescription {
#[serde(default, skip_serializing_if = "Option::is_none", deserialize_with = "deser_option")]
pub wiki: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none", deserialize_with = "deser_option")]
pub category: Option<String>,
/// The permission required
#[serde(flatten)]
pub privs: access::PrivilegesBuf,