diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index 3fee628d..621fbfc3 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -1565,7 +1565,7 @@ impl CipherSyncData { user_organizations, user_collections, user_collections_groups, - user_groups + user_groups, } } } diff --git a/src/api/core/organizations.rs b/src/api/core/organizations.rs index ae97bceb..8784ba2a 100644 --- a/src/api/core/organizations.rs +++ b/src/api/core/organizations.rs @@ -301,7 +301,8 @@ async fn post_organization_collections( for group in data.Groups { CollectionGroup::new(collection.uuid.clone(), group.Id, group.ReadOnly, group.HidePasswords) - .save(&conn).await?; + .save(&conn) + .await?; } // If the user doesn't have access to all collections, only in case of a Manger, @@ -355,8 +356,7 @@ async fn post_organization_collection_update( CollectionGroup::delete_all_by_collection(&col_id, &conn).await?; for group in data.Groups { - CollectionGroup::new(col_id.clone(), group.Id, group.ReadOnly, group.HidePasswords) - .save(&conn).await?; + CollectionGroup::new(col_id.clone(), group.Id, group.ReadOnly, group.HidePasswords).save(&conn).await?; } Ok(Json(collection.to_json())) @@ -454,9 +454,12 @@ async fn get_org_collection_detail( err!("Collection is not owned by organization") } - let groups: Vec = CollectionGroup::find_by_collection(&collection.uuid, &conn).await + let groups: Vec = CollectionGroup::find_by_collection(&collection.uuid, &conn) + .await .iter() - .map(|collection_group| SelectionReadOnly::to_collection_group_details_read_only(collection_group).to_json()) + .map(|collection_group| { + SelectionReadOnly::to_collection_group_details_read_only(collection_group).to_json() + }) .collect(); let mut json_object = collection.to_json(); @@ -1531,12 +1534,9 @@ async fn import(org_id: String, data: JsonUpcase, headers: Header } #[get("/organizations//groups")] -async fn get_groups(org_id: String, _headers: AdminHeaders, conn: DbConn) -> JsonResult { - let groups = Group::find_by_organization(&org_id, &conn).await - .iter() - .map(Group::to_json) - .collect::(); - +async fn get_groups(org_id: String, _headers: AdminHeaders, conn: DbConn) -> JsonResult { + let groups = Group::find_by_organization(&org_id, &conn).await.iter().map(Group::to_json).collect::(); + Ok(Json(json!({ "Data": groups, "Object": "list", @@ -1550,28 +1550,23 @@ struct GroupRequest { Name: String, AccessAll: Option, ExternalId: String, - Collections: Vec + Collections: Vec, } impl GroupRequest { pub fn to_group(&self, organizations_uuid: &str) -> Result { let access_all_value = match self.AccessAll { Some(value) => value, - _ => return Err(String::from("Could not convert GroupRequest to Group, because AccessAll has no value!")) + _ => return Err(String::from("Could not convert GroupRequest to Group, because AccessAll has no value!")), }; - Ok(Group::new( - organizations_uuid.to_owned(), - self.Name.clone(), - access_all_value, - self.ExternalId.clone() - )) + Ok(Group::new(organizations_uuid.to_owned(), self.Name.clone(), access_all_value, self.ExternalId.clone())) } pub fn update_group(&self, mut group: Group) -> Result { let access_all_value = match self.AccessAll { Some(value) => value, - _ => return Err(String::from("Could not update group, because AccessAll has no value!")) + _ => return Err(String::from("Could not update group, because AccessAll has no value!")), }; group.name = self.Name.clone(); @@ -1587,67 +1582,79 @@ impl GroupRequest { struct SelectionReadOnly { Id: String, ReadOnly: bool, - HidePasswords: bool + HidePasswords: bool, } impl SelectionReadOnly { - pub fn to_collection_group (&self, groups_uuid: String) -> CollectionGroup { - CollectionGroup::new ( - self.Id.clone(), - groups_uuid, - self.ReadOnly, - self.HidePasswords - ) + pub fn to_collection_group(&self, groups_uuid: String) -> CollectionGroup { + CollectionGroup::new(self.Id.clone(), groups_uuid, self.ReadOnly, self.HidePasswords) } - pub fn to_group_details_read_only (collection_group: &CollectionGroup) -> SelectionReadOnly { + pub fn to_group_details_read_only(collection_group: &CollectionGroup) -> SelectionReadOnly { SelectionReadOnly { Id: collection_group.collections_uuid.clone(), ReadOnly: collection_group.read_only, - HidePasswords: collection_group.hide_passwords + HidePasswords: collection_group.hide_passwords, } } - pub fn to_collection_group_details_read_only (collection_group: &CollectionGroup) -> SelectionReadOnly { + pub fn to_collection_group_details_read_only(collection_group: &CollectionGroup) -> SelectionReadOnly { SelectionReadOnly { Id: collection_group.groups_uuid.clone(), ReadOnly: collection_group.read_only, - HidePasswords: collection_group.hide_passwords + HidePasswords: collection_group.hide_passwords, } } - pub fn to_json (&self) -> Value { + pub fn to_json(&self) -> Value { json!(self) } } #[post("/organizations/<_org_id>/groups/", data = "")] -async fn post_group(_org_id: String, group_id: String, data: JsonUpcase, _headers: AdminHeaders, conn: DbConn) -> JsonResult { +async fn post_group( + _org_id: String, + group_id: String, + data: JsonUpcase, + _headers: AdminHeaders, + conn: DbConn, +) -> JsonResult { put_group(_org_id, group_id, data, _headers, conn).await } #[post("/organizations//groups", data = "")] -async fn post_groups(org_id: String, _headers: AdminHeaders, data: JsonUpcase, conn: DbConn) -> JsonResult { +async fn post_groups( + org_id: String, + _headers: AdminHeaders, + data: JsonUpcase, + conn: DbConn, +) -> JsonResult { let group_request = data.into_inner().data; let group = match group_request.to_group(&org_id) { Ok(group) => group, - Err(err) => err!(&err) + Err(err) => err!(&err), }; add_update_group(group, group_request.Collections, &conn).await } #[put("/organizations/<_org_id>/groups/", data = "")] -async fn put_group(_org_id: String, group_id: String, data: JsonUpcase, _headers: AdminHeaders, conn: DbConn) -> JsonResult { +async fn put_group( + _org_id: String, + group_id: String, + data: JsonUpcase, + _headers: AdminHeaders, + conn: DbConn, +) -> JsonResult { let group = match Group::find_by_uuid(&group_id, &conn).await { Some(group) => group, - None => err!("Group not found") + None => err!("Group not found"), }; let group_request = data.into_inner().data; let updated_group = match group_request.update_group(group) { Ok(group) => group, - Err(err) => err!(&err) + Err(err) => err!(&err), }; CollectionGroup::delete_all_by_group(&group_id, &conn).await?; @@ -1658,9 +1665,9 @@ async fn put_group(_org_id: String, group_id: String, data: JsonUpcase, conn: &DbConn) -> JsonResult { group.save(conn).await?; - for selection_read_only_request in collections { + for selection_read_only_request in collections { let mut collection_group = selection_read_only_request.to_collection_group(group.uuid.clone()); - + collection_group.save(conn).await?; } @@ -1674,17 +1681,18 @@ async fn add_update_group(mut group: Group, collections: Vec, } #[get("/organizations/<_org_id>/groups//details")] -async fn get_group_details(_org_id: String, group_id: String, _headers: AdminHeaders, conn: DbConn) -> JsonResult { +async fn get_group_details(_org_id: String, group_id: String, _headers: AdminHeaders, conn: DbConn) -> JsonResult { let group = match Group::find_by_uuid(&group_id, &conn).await { Some(group) => group, - _ => err!("Group could not be found!") + _ => err!("Group could not be found!"), }; - let collections_groups = CollectionGroup::find_by_group(&group_id, &conn).await + let collections_groups = CollectionGroup::find_by_group(&group_id, &conn) + .await .iter() .map(|entry| SelectionReadOnly::to_group_details_read_only(entry).to_json()) .collect::(); - + Ok(Json(json!({ "Id": group.uuid, "OrganizationId": group.organizations_uuid, @@ -1701,45 +1709,52 @@ async fn post_delete_group(org_id: String, group_id: String, _headers: AdminHead } #[delete("/organizations/<_org_id>/groups/")] -async fn delete_group(_org_id: String, group_id: String, _headers: AdminHeaders, conn: DbConn) -> EmptyResult { +async fn delete_group(_org_id: String, group_id: String, _headers: AdminHeaders, conn: DbConn) -> EmptyResult { let group = match Group::find_by_uuid(&group_id, &conn).await { Some(group) => group, - _ => err!("Group not found") + _ => err!("Group not found"), }; group.delete(&conn).await } #[get("/organizations/<_org_id>/groups/")] -async fn get_group(_org_id: String, group_id: String, _headers: AdminHeaders, conn: DbConn) -> JsonResult { +async fn get_group(_org_id: String, group_id: String, _headers: AdminHeaders, conn: DbConn) -> JsonResult { let group = match Group::find_by_uuid(&group_id, &conn).await { Some(group) => group, - _ => err!("Group not found") + _ => err!("Group not found"), }; Ok(Json(group.to_json())) } #[get("/organizations/<_org_id>/groups//users")] -async fn get_group_users(_org_id: String, group_id: String, _headers: AdminHeaders, conn: DbConn) -> JsonResult { +async fn get_group_users(_org_id: String, group_id: String, _headers: AdminHeaders, conn: DbConn) -> JsonResult { match Group::find_by_uuid(&group_id, &conn).await { - Some(_) => { /* Do nothing */ }, - _ => err!("Group could not be found!") + Some(_) => { /* Do nothing */ } + _ => err!("Group could not be found!"), }; - let group_users: Vec = GroupUser::find_by_group(&group_id, &conn).await + let group_users: Vec = GroupUser::find_by_group(&group_id, &conn) + .await .iter() .map(|entry| entry.users_organizations_uuid.clone()) .collect(); - + Ok(Json(json!(group_users))) } #[put("/organizations/<_org_id>/groups//users", data = "")] -async fn put_group_users(_org_id: String, group_id: String, _headers: AdminHeaders, data: JsonVec, conn: DbConn) -> EmptyResult { +async fn put_group_users( + _org_id: String, + group_id: String, + _headers: AdminHeaders, + data: JsonVec, + conn: DbConn, +) -> EmptyResult { match Group::find_by_uuid(&group_id, &conn).await { - Some(_) => { /* Do nothing */ }, - _ => err!("Group could not be found!") + Some(_) => { /* Do nothing */ } + _ => err!("Group could not be found!"), }; GroupUser::delete_all_by_group(&group_id, &conn).await?; @@ -1754,36 +1769,46 @@ async fn put_group_users(_org_id: String, group_id: String, _headers: AdminHeade } #[get("/organizations/<_org_id>/users//groups")] -async fn get_user_groups(_org_id: String, user_id: String, _headers: AdminHeaders, conn: DbConn) -> JsonResult { +async fn get_user_groups(_org_id: String, user_id: String, _headers: AdminHeaders, conn: DbConn) -> JsonResult { match UserOrganization::find_by_uuid(&user_id, &conn).await { - Some(_) => { /* Do nothing */ }, - _ => err!("User could not be found!") + Some(_) => { /* Do nothing */ } + _ => err!("User could not be found!"), }; - let user_groups: Vec = GroupUser::find_by_user(&user_id, &conn).await - .iter() - .map(|entry| entry.groups_uuid.clone()) - .collect(); - + let user_groups: Vec = + GroupUser::find_by_user(&user_id, &conn).await.iter().map(|entry| entry.groups_uuid.clone()).collect(); + Ok(Json(json!(user_groups))) } #[derive(Deserialize)] #[allow(non_snake_case)] struct OrganizationUserUpdateGroupsRequest { - GroupIds: Vec + GroupIds: Vec, } -#[post("/organizations/<_org_id>/users//groups", data ="")] -async fn post_user_groups(_org_id: String, user_id: String, data: JsonUpcase, _headers: AdminHeaders, conn: DbConn) -> EmptyResult { +#[post("/organizations/<_org_id>/users//groups", data = "")] +async fn post_user_groups( + _org_id: String, + user_id: String, + data: JsonUpcase, + _headers: AdminHeaders, + conn: DbConn, +) -> EmptyResult { put_user_groups(_org_id, user_id, data, _headers, conn).await } -#[put("/organizations/<_org_id>/users//groups", data ="")] -async fn put_user_groups(_org_id: String, user_id: String, data: JsonUpcase, _headers: AdminHeaders, conn: DbConn) -> EmptyResult { +#[put("/organizations/<_org_id>/users//groups", data = "")] +async fn put_user_groups( + _org_id: String, + user_id: String, + data: JsonUpcase, + _headers: AdminHeaders, + conn: DbConn, +) -> EmptyResult { match UserOrganization::find_by_uuid(&user_id, &conn).await { - Some(_) => { /* Do nothing */ }, - _ => err!("User could not be found!") + Some(_) => { /* Do nothing */ } + _ => err!("User could not be found!"), }; GroupUser::delete_all_by_user(&user_id, &conn).await?; @@ -1793,26 +1818,38 @@ async fn put_user_groups(_org_id: String, user_id: String, data: JsonUpcase/groups//delete-user/")] -async fn post_delete_group_user(org_id: String, group_id: String, user_id: String, headers: AdminHeaders, conn: DbConn) -> EmptyResult { +async fn post_delete_group_user( + org_id: String, + group_id: String, + user_id: String, + headers: AdminHeaders, + conn: DbConn, +) -> EmptyResult { delete_group_user(org_id, group_id, user_id, headers, conn).await } #[delete("/organizations/<_org_id>/groups//users/")] -async fn delete_group_user(_org_id: String, group_id: String, user_id: String, _headers: AdminHeaders, conn: DbConn) -> EmptyResult { +async fn delete_group_user( + _org_id: String, + group_id: String, + user_id: String, + _headers: AdminHeaders, + conn: DbConn, +) -> EmptyResult { match UserOrganization::find_by_uuid(&user_id, &conn).await { - Some(_) => { /* Do nothing */ }, - _ => err!("User could not be found!") + Some(_) => { /* Do nothing */ } + _ => err!("User could not be found!"), }; match Group::find_by_uuid(&group_id, &conn).await { - Some(_) => { /* Do nothing */ }, - _ => err!("Group could not be found!") + Some(_) => { /* Do nothing */ } + _ => err!("Group could not be found!"), }; - + GroupUser::delete_by_group_id_and_user_id(&group_id, &user_id, &conn).await -} \ No newline at end of file +} diff --git a/src/db/models/cipher.rs b/src/db/models/cipher.rs index 7f0b93f4..574d6202 100644 --- a/src/db/models/cipher.rs +++ b/src/db/models/cipher.rs @@ -2,7 +2,9 @@ use crate::CONFIG; use chrono::{Duration, NaiveDateTime, Utc}; use serde_json::Value; -use super::{Attachment, CollectionCipher, Favorite, FolderCipher, User, UserOrgStatus, UserOrgType, UserOrganization, Group}; +use super::{ + Attachment, CollectionCipher, Favorite, FolderCipher, Group, User, UserOrgStatus, UserOrgType, UserOrganization, +}; use crate::api::core::CipherSyncData; @@ -362,12 +364,8 @@ impl Cipher { conn: &DbConn, ) -> bool { match cipher_sync_data { - Some(cipher_sync_data) => { - cipher_sync_data.user_groups.iter().any(|group| group.access_all) - }, - None => { - Group::is_in_full_access_group(user_uuid, conn).await - } + Some(cipher_sync_data) => cipher_sync_data.user_groups.iter().any(|group| group.access_all), + None => Group::is_in_full_access_group(user_uuid, conn).await, } } @@ -385,7 +383,10 @@ impl Cipher { // Check whether this cipher is directly owned by the user, or is in // a collection that the user has full access to. If so, there are no // access restrictions. - if self.is_owned_by_user(user_uuid) || self.is_in_full_access_org(user_uuid, cipher_sync_data, conn).await || self.is_in_full_access_group(user_uuid, cipher_sync_data, conn).await { + if self.is_owned_by_user(user_uuid) + || self.is_in_full_access_org(user_uuid, cipher_sync_data, conn).await + || self.is_in_full_access_group(user_uuid, cipher_sync_data, conn).await + { return Some((false, false)); } @@ -393,15 +394,17 @@ impl Cipher { let mut rows: Vec<(bool, bool)> = Vec::new(); if let Some(collections) = cipher_sync_data.cipher_collections.get(&self.uuid) { for collection in collections { - //User permissions + //User permissions if let Some(uc) = cipher_sync_data.user_collections.get(collection) { rows.push((uc.read_only, uc.hide_passwords)); } //Group permissions - if let Some(gc) = cipher_sync_data.user_collections_groups + if let Some(gc) = cipher_sync_data + .user_collections_groups .iter() - .find(|collection_group| collection_group.collections_uuid == collection.clone()) { + .find(|collection_group| collection_group.collections_uuid == collection.clone()) + { rows.push((gc.read_only, gc.hide_passwords)); } } @@ -412,7 +415,7 @@ impl Cipher { let mut group_collections_access_flags = self.get_group_collections_access_flags(user_uuid, conn).await; let mut result = Vec::new(); - + result.append(&mut user_collections_access_flags); result.append(&mut group_collections_access_flags); diff --git a/src/db/models/collection.rs b/src/db/models/collection.rs index 263ce3e3..b7c14434 100644 --- a/src/db/models/collection.rs +++ b/src/db/models/collection.rs @@ -1,6 +1,6 @@ use serde_json::Value; -use super::{User, UserOrgStatus, UserOrgType, UserOrganization, CollectionGroup}; +use super::{CollectionGroup, User, UserOrgStatus, UserOrgType, UserOrganization}; db_object! { #[derive(Identifiable, Queryable, Insertable, AsChangeset)] @@ -186,7 +186,7 @@ impl Collection { .filter( users_organizations::status.eq(UserOrgStatus::Confirmed as i32) ) - .filter( + .filter( users_collections::user_uuid.eq(user_uuid).or( // Directly accessed collection users_organizations::access_all.eq(true) // access_all in Organization ).or( diff --git a/src/db/models/group.rs b/src/db/models/group.rs index 5f68fa5c..721b3f85 100644 --- a/src/db/models/group.rs +++ b/src/db/models/group.rs @@ -1,5 +1,5 @@ -use serde_json::Value; use chrono::{NaiveDateTime, Utc}; +use serde_json::Value; db_object! { #[derive(Identifiable, Queryable, Insertable, AsChangeset)] @@ -46,7 +46,7 @@ impl Group { access_all, external_id, creation_date: now, - revision_date: now + revision_date: now, } } @@ -71,16 +71,16 @@ impl CollectionGroup { collections_uuid, groups_uuid, read_only, - hide_passwords + hide_passwords, } } } impl GroupUser { - pub fn new (groups_uuid: String, users_organizations_uuid: String) -> Self { + pub fn new(groups_uuid: String, users_organizations_uuid: String) -> Self { Self { groups_uuid, - users_organizations_uuid + users_organizations_uuid, } } } @@ -90,7 +90,7 @@ use crate::db::DbConn; use crate::api::EmptyResult; use crate::error::MapResult; -use super::{UserOrganization, User}; +use super::{User, UserOrganization}; /// Database methods impl Group { @@ -128,7 +128,7 @@ impl Group { } } - pub async fn find_by_organization (organizations_uuid: &str, conn: &DbConn) -> Vec { + pub async fn find_by_organization(organizations_uuid: &str, conn: &DbConn) -> Vec { db_run! { conn: { groups::table .filter(groups::organizations_uuid.eq(organizations_uuid)) @@ -138,7 +138,7 @@ impl Group { }} } - pub async fn find_by_uuid (uuid: &str, conn: &DbConn) -> Option { + pub async fn find_by_uuid(uuid: &str, conn: &DbConn) -> Option { db_run! { conn: { groups::table .filter(groups::uuid.eq(uuid)) @@ -185,7 +185,7 @@ impl Group { pub async fn delete(&self, conn: &DbConn) -> EmptyResult { CollectionGroup::delete_all_by_group(&self.uuid, conn).await?; GroupUser::delete_all_by_group(&self.uuid, conn).await?; - + db_run! { conn: { diesel::delete(groups::table.filter(groups::uuid.eq(&self.uuid))) .execute(conn) @@ -217,7 +217,7 @@ impl CollectionGroup { for group_user in group_users { group_user.update_user_revision(conn).await; } - + db_run! { conn: sqlite, mysql { match diesel::replace_into(collections_groups::table) @@ -267,7 +267,7 @@ impl CollectionGroup { } } - pub async fn find_by_group (group_uuid: &str, conn: &DbConn) -> Vec { + pub async fn find_by_group(group_uuid: &str, conn: &DbConn) -> Vec { db_run! { conn: { collections_groups::table .filter(collections_groups::groups_uuid.eq(group_uuid)) @@ -305,12 +305,12 @@ impl CollectionGroup { }} } - pub async fn delete(&self, conn: &DbConn) -> EmptyResult { + pub async fn delete(&self, conn: &DbConn) -> EmptyResult { let group_users = GroupUser::find_by_group(&self.groups_uuid, conn).await; for group_user in group_users { group_user.update_user_revision(conn).await; } - + db_run! { conn: { diesel::delete(collections_groups::table) .filter(collections_groups::collections_uuid.eq(&self.collections_uuid)) @@ -325,7 +325,7 @@ impl CollectionGroup { for group_user in group_users { group_user.update_user_revision(conn).await; } - + db_run! { conn: { diesel::delete(collections_groups::table) .filter(collections_groups::groups_uuid.eq(group_uuid)) @@ -342,7 +342,7 @@ impl CollectionGroup { group_user.update_user_revision(conn).await; } } - + db_run! { conn: { diesel::delete(collections_groups::table) .filter(collections_groups::collections_uuid.eq(collection_uuid)) @@ -353,9 +353,9 @@ impl CollectionGroup { } impl GroupUser { - pub async fn save(&mut self, conn: &DbConn) -> EmptyResult { + pub async fn save(&mut self, conn: &DbConn) -> EmptyResult { self.update_user_revision(conn).await; - + db_run! { conn: sqlite, mysql { match diesel::replace_into(groups_users::table) @@ -422,16 +422,20 @@ impl GroupUser { pub async fn update_user_revision(&self, conn: &DbConn) { match UserOrganization::find_by_uuid(&self.users_organizations_uuid, conn).await { Some(user) => User::update_uuid_revision(&user.user_uuid, conn).await, - None => warn!("User could not be found!") + None => warn!("User could not be found!"), } } - pub async fn delete_by_group_id_and_user_id(group_uuid: &str, users_organizations_uuid: &str, conn: &DbConn) -> EmptyResult { + pub async fn delete_by_group_id_and_user_id( + group_uuid: &str, + users_organizations_uuid: &str, + conn: &DbConn, + ) -> EmptyResult { match UserOrganization::find_by_uuid(users_organizations_uuid, conn).await { Some(user) => User::update_uuid_revision(&user.user_uuid, conn).await, - None => warn!("User could not be found!") + None => warn!("User could not be found!"), }; - + db_run! { conn: { diesel::delete(groups_users::table) .filter(groups_users::groups_uuid.eq(group_uuid)) @@ -446,7 +450,7 @@ impl GroupUser { for group_user in group_users { group_user.update_user_revision(conn).await; } - + db_run! { conn: { diesel::delete(groups_users::table) .filter(groups_users::groups_uuid.eq(group_uuid)) @@ -458,9 +462,9 @@ impl GroupUser { pub async fn delete_all_by_user(users_organizations_uuid: &str, conn: &DbConn) -> EmptyResult { match UserOrganization::find_by_uuid(users_organizations_uuid, conn).await { Some(user) => User::update_uuid_revision(&user.user_uuid, conn).await, - None => warn!("User could not be found!") + None => warn!("User could not be found!"), } - + db_run! { conn: { diesel::delete(groups_users::table) .filter(groups_users::users_organizations_uuid.eq(users_organizations_uuid)) @@ -468,4 +472,4 @@ impl GroupUser { .map_res("Error deleting user groups") }} } -} \ No newline at end of file +} diff --git a/src/db/models/mod.rs b/src/db/models/mod.rs index f64e3c6b..95f8b581 100644 --- a/src/db/models/mod.rs +++ b/src/db/models/mod.rs @@ -5,13 +5,13 @@ mod device; mod emergency_access; mod favorite; mod folder; +mod group; mod org_policy; mod organization; mod send; mod two_factor; mod two_factor_incomplete; mod user; -mod group; pub use self::attachment::Attachment; pub use self::cipher::Cipher; @@ -20,10 +20,10 @@ pub use self::device::Device; pub use self::emergency_access::{EmergencyAccess, EmergencyAccessStatus, EmergencyAccessType}; pub use self::favorite::Favorite; pub use self::folder::{Folder, FolderCipher}; +pub use self::group::{CollectionGroup, Group, GroupUser}; pub use self::org_policy::{OrgPolicy, OrgPolicyType}; pub use self::organization::{Organization, UserOrgStatus, UserOrgType, UserOrganization}; pub use self::send::{Send, SendType}; pub use self::two_factor::{TwoFactor, TwoFactorType}; pub use self::two_factor_incomplete::TwoFactorIncomplete; pub use self::user::{Invitation, User, UserStampException}; -pub use self::group::{Group, CollectionGroup, GroupUser}; \ No newline at end of file diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs index 49b21b1c..112b966b 100644 --- a/src/db/models/organization.rs +++ b/src/db/models/organization.rs @@ -2,7 +2,7 @@ use num_traits::FromPrimitive; use serde_json::Value; use std::cmp::Ordering; -use super::{CollectionUser, OrgPolicy, OrgPolicyType, User, GroupUser}; +use super::{CollectionUser, GroupUser, OrgPolicy, OrgPolicyType, User}; db_object! { #[derive(Identifiable, Queryable, Insertable, AsChangeset)] @@ -145,7 +145,7 @@ impl Organization { "Use2fa": true, "UseDirectory": false, // Is supported, but this value isn't checked anywhere (yet) "UseEvents": false, // not supported by us - "UseGroups": true, + "UseGroups": true, "UseTotp": true, "UsePolicies": true, "UseSso": false, // We do not support SSO @@ -276,7 +276,7 @@ impl UserOrganization { "Use2fa": true, "UseDirectory": false, // Is supported, but this value isn't checked anywhere (yet) "UseEvents": false, // not supported by us - "UseGroups": true, + "UseGroups": true, "UseTotp": true, "UsePolicies": true, "UseApi": false, // not supported by us