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 = Another =
{ wiki = "test_another" { wiki = "test_another"
, category = "test"
, disclose = "lab.test.read" , disclose = "lab.test.read"
, manage = "lab.test.admin" , manage = "lab.test.admin"
, name = "Another" , name = "Another"

View File

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

View File

@ -97,6 +97,7 @@ impl Default for Config {
name: "Testmachine".to_string(), name: "Testmachine".to_string(),
description: Some("A test machine".to_string()), description: Some("A test machine".to_string()),
wiki: None, wiki: None,
category: None,
privs: PrivilegesBuf { privs: PrivilegesBuf {
disclose: PermissionBuf::from_string("lab.test.read".to_string()), disclose: PermissionBuf::from_string("lab.test.read".to_string()),
read: 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")] #[serde(default, skip_serializing_if = "Option::is_none", deserialize_with = "deser_option")]
pub wiki: Option<String>, pub wiki: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none", deserialize_with = "deser_option")]
pub category: Option<String>,
/// The permission required /// The permission required
#[serde(flatten)] #[serde(flatten)]
pub privs: access::PrivilegesBuf, pub privs: access::PrivilegesBuf,