|
|
|
@ -442,8 +442,9 @@ async fn get_org_collections_details(org_id: OrganizationId, headers: ManagerHea |
|
|
|
let col_users = CollectionUser::find_by_organization_swap_user_uuid_with_member_uuid(&org_id, &conn).await; |
|
|
|
// Generate a HashMap to get the correct MembershipType 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
|
|
|
|
// This lists other members for admins, so it must not depend on the membership status
|
|
|
|
let membership_type: HashMap<MembershipId, i32> = |
|
|
|
Membership::find_confirmed_by_org(&org_id, &conn).await.into_iter().map(|m| (m.uuid, m.atype)).collect(); |
|
|
|
Membership::find_by_org(&org_id, &conn).await.into_iter().map(|m| (m.uuid, m.atype)).collect(); |
|
|
|
|
|
|
|
// check if current user has full access to the organization (either directly or via any group)
|
|
|
|
let has_full_access_to_org = member.has_full_access() |
|
|
|
@ -915,11 +916,9 @@ async fn get_org_collection_detail( |
|
|
|
|
|
|
|
// Generate a HashMap to get the correct MembershipType 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 membership_type: HashMap<MembershipId, i32> = Membership::find_confirmed_by_org(&org_id, &conn) |
|
|
|
.await |
|
|
|
.into_iter() |
|
|
|
.map(|m| (m.uuid, m.atype)) |
|
|
|
.collect(); |
|
|
|
// This lists other members for admins, so it must not depend on the membership status
|
|
|
|
let membership_type: HashMap<MembershipId, i32> = |
|
|
|
Membership::find_by_org(&org_id, &conn).await.into_iter().map(|m| (m.uuid, m.atype)).collect(); |
|
|
|
|
|
|
|
let users: Vec<Value> = |
|
|
|
CollectionUser::find_by_org_and_coll_swap_user_uuid_with_member_uuid(&org_id, &collection.uuid, &conn) |
|
|
|
@ -1176,8 +1175,9 @@ async fn get_members( |
|
|
|
|
|
|
|
let mut users_json = Vec::new(); |
|
|
|
for u in Membership::find_by_org(&org_id, &conn).await { |
|
|
|
// The user can be a manager instead of an admin, but we've checked above that they have full access
|
|
|
|
users_json.push( |
|
|
|
u.to_json_user_details( |
|
|
|
u.to_json_details_for_admin( |
|
|
|
data.include_collections.unwrap_or(false), |
|
|
|
data.include_groups.unwrap_or(false), |
|
|
|
&conn, |
|
|
|
@ -1848,7 +1848,9 @@ async fn get_user( |
|
|
|
// In this case, when groups are requested we also need to include collections.
|
|
|
|
// Else these will not be shown in the interface, and could lead to missing collections when saved.
|
|
|
|
let include_groups = data.include_groups.unwrap_or(false); |
|
|
|
Ok(Json(user.to_json_user_details(data.include_collections.unwrap_or(include_groups), include_groups, &conn).await)) |
|
|
|
Ok(Json( |
|
|
|
user.to_json_details_for_admin(data.include_collections.unwrap_or(include_groups), include_groups, &conn).await, |
|
|
|
)) |
|
|
|
} |
|
|
|
|
|
|
|
#[derive(Deserialize)] |
|
|
|
@ -2167,7 +2169,6 @@ async fn post_org_import( |
|
|
|
if org_id != headers.membership.org_uuid { |
|
|
|
err!("Organization not found", "Organization id's do not match"); |
|
|
|
} |
|
|
|
|
|
|
|
// AccessImportExport authorizes the complete organization import. Other confirmed members keep
|
|
|
|
// the regular per-target Create/Update authorization.
|
|
|
|
if !headers.membership.has_status(MembershipStatus::Confirmed) { |
|
|
|
|