Skip to content

Commit

Permalink
Rename function to mention swapping uuid's
Browse files Browse the repository at this point in the history
Signed-off-by: BlackDex <[email protected]>
  • Loading branch information
BlackDex committed Jan 1, 2025
1 parent 296e45b commit ac70451
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/api/core/organizations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, i32> = UserOrganization::find_confirmed_by_org(org_id, &mut conn)
Expand Down Expand Up @@ -871,7 +871,7 @@ struct InviteData {
async fn send_invite(org_id: &str, data: Json<InviteData>, 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)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion src/db/models/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,10 @@ impl CollectionUser {
}}
}

pub async fn find_by_organization(org_uuid: &str, conn: &mut DbConn) -> Vec<Self> {
pub async fn find_by_organization_swap_user_uuid_with_org_user_uuid(
org_uuid: &str,
conn: &mut DbConn,
) -> Vec<Self> {
db_run! { conn: {
users_collections::table
.inner_join(collections::table.on(collections::uuid.eq(users_collections::collection_uuid)))
Expand Down

0 comments on commit ac70451

Please sign in to comment.