mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-10 17:43:23 +01:00
Move around Ownership until it compiles
This commit is contained in:
parent
e678e67d32
commit
27791ed19b
@ -47,13 +47,13 @@ impl machines::Server for Machines {
|
|||||||
mut results: machines::GetMachineListResults)
|
mut results: machines::GetMachineListResults)
|
||||||
-> Promise<(), Error>
|
-> Promise<(), Error>
|
||||||
{
|
{
|
||||||
let session = Rc::clone(&self.session);
|
let rc = Rc::clone(&self.session);
|
||||||
let session = session.borrow();
|
let session = self.session.borrow();
|
||||||
if let Some(session) = session.deref() {
|
if session.deref().is_some() {
|
||||||
let v: Vec<(String, crate::machine::Machine)> = self.network.machines.iter()
|
let v: Vec<(String, crate::machine::Machine)> = self.network.machines.iter()
|
||||||
.filter(|(_name, machine)| {
|
.filter(|(_name, machine)| {
|
||||||
let required_disclose = &machine.desc.privs.disclose;
|
let required_disclose = &machine.desc.privs.disclose;
|
||||||
for perm_rule in session.perms.iter() {
|
for perm_rule in session.as_ref().unwrap().perms.iter() {
|
||||||
if perm_rule.match_perm(required_disclose) {
|
if perm_rule.match_perm(required_disclose) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -64,10 +64,11 @@ impl machines::Server for Machines {
|
|||||||
.map(|(n,m)| (n.clone(), m.clone()))
|
.map(|(n,m)| (n.clone(), m.clone()))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let permissions = &session.perms;
|
|
||||||
let user = &session.authzid;
|
|
||||||
|
|
||||||
let f = async move {
|
let f = async move {
|
||||||
|
let session = rc.borrow();
|
||||||
|
let user = &session.as_ref().unwrap().authzid;
|
||||||
|
let permissions = &session.as_ref().unwrap().perms;
|
||||||
|
|
||||||
let mut machines = results.get().init_machine_list(v.len() as u32);
|
let mut machines = results.get().init_machine_list(v.len() as u32);
|
||||||
for (i, (name, machine)) in v.into_iter().enumerate() {
|
for (i, (name, machine)) in v.into_iter().enumerate() {
|
||||||
let perms = Perms::get_for(&machine.desc.privs, permissions.iter());
|
let perms = Perms::get_for(&machine.desc.privs, permissions.iter());
|
||||||
@ -118,17 +119,19 @@ impl machines::Server for Machines {
|
|||||||
params: machines::GetMachineParams,
|
params: machines::GetMachineParams,
|
||||||
mut results: machines::GetMachineResults
|
mut results: machines::GetMachineResults
|
||||||
) -> Promise<(), capnp::Error> {
|
) -> Promise<(), capnp::Error> {
|
||||||
if let Some(session) = self.session.borrow().deref() {
|
let rc = Rc::clone(&self.session);
|
||||||
|
if self.session.borrow().is_some() {
|
||||||
let name = {
|
let name = {
|
||||||
let params = pry!(params.get());
|
let params = pry!(params.get());
|
||||||
pry!(params.get_name()).to_string()
|
pry!(params.get_name()).to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
let network = self.network.clone();
|
let network = self.network.clone();
|
||||||
let user = session.authzid;
|
|
||||||
let permissions = session.perms;
|
|
||||||
|
|
||||||
let f = async move {
|
let f = async move {
|
||||||
|
let session = rc.borrow();
|
||||||
|
let user = &session.as_ref().unwrap().authzid;
|
||||||
|
let permissions = &session.as_ref().unwrap().perms;
|
||||||
|
|
||||||
if let Some(machine) = network.machines.get(&name) {
|
if let Some(machine) = network.machines.get(&name) {
|
||||||
let mut builder = results.get().init_machine();
|
let mut builder = results.get().init_machine();
|
||||||
let perms = Perms::get_for(&machine.desc.privs, permissions.iter());
|
let perms = Perms::get_for(&machine.desc.privs, permissions.iter());
|
||||||
|
@ -75,7 +75,7 @@ impl manage::Server for Users {
|
|||||||
let result: Result<(), error::Error> =
|
let result: Result<(), error::Error> =
|
||||||
self.userdb.list_users()
|
self.userdb.list_users()
|
||||||
.and_then(|users| {
|
.and_then(|users| {
|
||||||
let builder = results.get().init_user_list(users.len() as u32);
|
let mut builder = results.get().init_user_list(users.len() as u32);
|
||||||
let u = User::new(Rc::clone(&self.session));
|
let u = User::new(Rc::clone(&self.session));
|
||||||
for (i, user) in users.into_iter().enumerate() {
|
for (i, user) in users.into_iter().enumerate() {
|
||||||
let mut b = builder.reborrow().get(i as u32);
|
let mut b = builder.reborrow().get(i as u32);
|
||||||
|
Loading…
Reference in New Issue
Block a user