Implement wiki and URN links

This commit is contained in:
Nadja Reitzenstein 2021-10-20 09:43:39 +02:00
parent 4d2b0ea29c
commit 7bcb0712ae
4 changed files with 11 additions and 2 deletions

2
Cargo.lock generated
View File

@ -515,7 +515,7 @@ dependencies = [
[[package]] [[package]]
name = "diflouroborane" name = "diflouroborane"
version = "0.2.0" version = "0.3.0"
dependencies = [ dependencies = [
"async-channel", "async-channel",
"async-trait", "async-trait",

View File

@ -148,6 +148,10 @@ impl machines::Server for Machines {
if let Some(ref desc) = machine.desc.description { if let Some(ref desc) = machine.desc.description {
builder.set_description(desc); builder.set_description(desc);
} }
if let Some(ref wiki) = machine.desc.wiki {
builder.set_wiki(wiki);
}
builder.set_urn(&format!("urn:fabaccess:resource:{}", &name));
let machineapi = Machine::new(user.clone(), perms, machine.clone()); let machineapi = Machine::new(user.clone(), perms, machine.clone());
let state = machine.get_status().await; let state = machine.get_status().await;

View File

@ -80,6 +80,7 @@ impl Default for Config {
machines.insert("Testmachine".to_string(), MachineDescription { machines.insert("Testmachine".to_string(), MachineDescription {
name: "Testmachine".to_string(), name: "Testmachine".to_string(),
description: Some("A test machine".to_string()), description: Some("A test machine".to_string()),
wiki: 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

@ -65,7 +65,7 @@ pub struct Machine {
} }
impl Machine { impl Machine {
pub fn new(inner: Inner, desc: MachineDescription, ) -> Self { pub fn new(inner: Inner, desc: MachineDescription) -> Self {
Self { Self {
id: uuid::Uuid::default(), id: uuid::Uuid::default(),
inner: Arc::new(Mutex::new(inner)), inner: Arc::new(Mutex::new(inner)),
@ -226,6 +226,10 @@ pub struct MachineDescription {
/// An optional description of the Machine. /// An optional description of the Machine.
pub description: Option<String>, pub description: Option<String>,
#[serde(default)]
#[serde(flatten)]
pub wiki: Option<String>,
/// The permission required /// The permission required
#[serde(flatten)] #[serde(flatten)]
pub privs: access::PrivilegesBuf, pub privs: access::PrivilegesBuf,