Finish invite functionality, and remove virtual organization

This commit is contained in:
Daniel García
2018-12-19 22:51:08 +01:00
parent 6a99849a1e
commit b2fc0499f6
6 changed files with 42 additions and 138 deletions

View File

@ -131,7 +131,7 @@ use rocket::Outcome;
use rocket::request::{self, Request, FromRequest};
use crate::db::DbConn;
use crate::db::models::{User, Organization, UserOrganization, UserOrgType, UserOrgStatus, Device};
use crate::db::models::{User, UserOrganization, UserOrgType, UserOrgStatus, Device};
pub struct Headers {
pub host: String,
@ -245,13 +245,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for OrgHeaders {
err_handler!("The current user isn't confirmed member of the organization")
}
}
None => {
if headers.user.is_server_admin() && org_id == Organization::VIRTUAL_ID {
UserOrganization::new_virtual(headers.user.uuid.clone(), UserOrgType::Owner, UserOrgStatus::Confirmed)
} else {
err_handler!("The current user isn't member of the organization")
}
}
None => err_handler!("The current user isn't member of the organization")
};
Outcome::Success(Self{