diff --git a/src/api/core/organizations.rs b/src/api/core/organizations.rs index b1a4dd033e..902ab25a12 100644 --- a/src/api/core/organizations.rs +++ b/src/api/core/organizations.rs @@ -325,7 +325,7 @@ async fn get_org_collections_details(org_id: &str, headers: ManagerHeadersLoose, }; // get all collection memberships for the current organization - let coll_users = CollectionUser::find_by_organization(org_id, &mut conn).await; + let coll_users = CollectionUser::find_by_organization_swap_user_uuid_with_org_user_uuid(org_id, &mut conn).await; // Generate a HashMap to get the correct UserOrgType per user to determine the manage permission // We use the uuid instead of the user_uuid here, since that is what is used in CollectionUser let users_org_type: HashMap = UserOrganization::find_confirmed_by_org(org_id, &mut conn) @@ -871,7 +871,7 @@ struct InviteData { async fn send_invite(org_id: &str, data: Json, headers: AdminHeaders, mut conn: DbConn) -> EmptyResult { let mut data: InviteData = data.into_inner(); - // HACK: We need the raw user-type be be sure custom role is selected to determine the access_all permission + // HACK: We need the raw user-type to be sure custom role is selected to determine the access_all permission // The from_str() will convert the custom role type into a manager role type let raw_type = &data.r#type.into_string(); // UserOrgType::from_str will convert custom (4) to manager (3) @@ -885,7 +885,7 @@ async fn send_invite(org_id: &str, data: Json, headers: AdminHeaders } // HACK: This converts the Custom role which has the `Manage all collections` box checked into an access_all flag - // Since the parent checkbox is not send to the server we need to check and verify the child checkboxes + // Since the parent checkbox is not sent to the server we need to check and verify the child checkboxes // If the box is not checked, the user will still be a manager, but not with the access_all permission if raw_type.eq("4") && data.permissions.get("editAnyCollection") == Some(&json!(true)) @@ -1371,7 +1371,7 @@ async fn edit_user( ) -> EmptyResult { let mut data: EditUserData = data.into_inner(); - // HACK: We need the raw user-type be be sure custom role is selected to determine the access_all permission + // HACK: We need the raw user-type to be sure custom role is selected to determine the access_all permission // The from_str() will convert the custom role type into a manager role type let raw_type = &data.r#type.into_string(); // UserOrgType::from_str will convert custom (4) to manager (3) @@ -1380,7 +1380,7 @@ async fn edit_user( }; // HACK: This converts the Custom role which has the `Manage all collections` box checked into an access_all flag - // Since the parent checkbox is not send to the server we need to check and verify the child checkboxes + // Since the parent checkbox is not sent to the server we need to check and verify the child checkboxes // If the box is not checked, the user will still be a manager, but not with the access_all permission if raw_type.eq("4") && data.permissions.get("editAnyCollection") == Some(&json!(true)) @@ -3011,7 +3011,7 @@ async fn put_reset_password_enrollment( if reset_request.reset_password_key.is_none() && OrgPolicy::org_is_reset_password_auto_enroll(org_id, &mut conn).await { - err!("Reset password can't be withdrawed due to an enterprise policy"); + err!("Reset password can't be withdrawn due to an enterprise policy"); } if reset_request.reset_password_key.is_some() { diff --git a/src/db/models/collection.rs b/src/db/models/collection.rs index a26f22c72e..907aebf7a8 100644 --- a/src/db/models/collection.rs +++ b/src/db/models/collection.rs @@ -511,7 +511,10 @@ impl CollectionUser { }} } - pub async fn find_by_organization(org_uuid: &str, conn: &mut DbConn) -> Vec { + pub async fn find_by_organization_swap_user_uuid_with_org_user_uuid( + org_uuid: &str, + conn: &mut DbConn, + ) -> Vec { db_run! { conn: { users_collections::table .inner_join(collections::table.on(collections::uuid.eq(users_collections::collection_uuid))) diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs index 5f8434dea9..c8c1d3a459 100644 --- a/src/db/models/organization.rs +++ b/src/db/models/organization.rs @@ -652,7 +652,7 @@ impl UserOrganization { pub async fn to_json_mini_details(&self, conn: &mut DbConn) -> Value { let user = User::find_by_uuid(&self.user_uuid, conn).await.unwrap(); - // Because BitWarden want the status to be -1 for revoked users we need to catch that here. + // Because Bitwarden wants the status to be -1 for revoked users we need to catch that here. // We subtract/add a number so we can restore/activate the user to it's previous state again. let status = if self.status < UserOrgStatus::Revoked as i32 { UserOrgStatus::Revoked as i32