From 14402d627cfd937cd74e51af88101156c665dcb8 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Tue, 21 Sep 2021 22:55:18 +0200 Subject: [PATCH] Be consistent in the api --- src/api/machines.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/api/machines.rs b/src/api/machines.rs index 9633d82..82edf71 100644 --- a/src/api/machines.rs +++ b/src/api/machines.rs @@ -104,8 +104,8 @@ impl machines::Server for Machines { builder.set_use(capnp_rpc::new_client(machineapi.clone())); } if perms.manage { - builder.set_transfer(capnp_rpc::new_client(machineapi.clone())); - builder.set_check(capnp_rpc::new_client(machineapi.clone())); + //builder.set_transfer(capnp_rpc::new_client(machineapi.clone())); + //builder.set_check(capnp_rpc::new_client(machineapi.clone())); builder.set_manage(capnp_rpc::new_client(machineapi.clone())); } if permissions.iter().any(|r| r.match_perm(&admin_perm())) { @@ -150,12 +150,13 @@ impl machines::Server for Machines { } let machineapi = Machine::new(user.clone(), perms, machine.clone()); - if perms.write { + let state = machine.get_status().await; + if perms.write && state == Status::Free { builder.set_use(capnp_rpc::new_client(machineapi.clone())); } if perms.manage { - builder.set_transfer(capnp_rpc::new_client(machineapi.clone())); - builder.set_check(capnp_rpc::new_client(machineapi.clone())); + //builder.set_transfer(capnp_rpc::new_client(machineapi.clone())); + //builder.set_check(capnp_rpc::new_client(machineapi.clone())); builder.set_manage(capnp_rpc::new_client(machineapi.clone())); } if permissions.iter().any(|r| r.match_perm(&admin_perm())) {