Can determine the rights of the token over the group
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
2024-11-30 15:07:12 +01:00
parent a8a75328a9
commit 26fee59c5d
2 changed files with 90 additions and 9 deletions

View File

@@ -66,16 +66,16 @@ pub async fn rights() -> HttpResult {
let group_vms = virtweb_client::group_vm_info(&g).await?;
res.groups.push(GroupInfo {
id: g,
id: g.clone(),
vms: group_vms,
can_get_state: false, //TODO
can_start: false,
can_shutdown: false,
can_kill: false,
can_reset: false,
can_suspend: false,
can_resume: false,
can_screenshot: false,
can_get_state: rights.is_route_allowed("GET", &g.route_vm_state(None)),
can_start: rights.is_route_allowed("GET", &g.route_vm_start(None)),
can_shutdown: rights.is_route_allowed("GET", &g.route_vm_shutdown(None)),
can_kill: rights.is_route_allowed("GET", &g.route_vm_kill(None)),
can_reset: rights.is_route_allowed("GET", &g.route_vm_reset(None)),
can_suspend: rights.is_route_allowed("GET", &g.route_vm_suspend(None)),
can_resume: rights.is_route_allowed("GET", &g.route_vm_resume(None)),
can_screenshot: rights.is_route_allowed("GET", &g.route_vm_screenshot(None)),
})
}