removing users

This commit is contained in:
Wyatt Verchere
2024-01-30 19:13:22 -08:00
parent 6b99f82cea
commit 719aded698
3 changed files with 39 additions and 4 deletions

View File

@@ -10,7 +10,9 @@ pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
profile_share_inbound_sync,
profile_share_outbound_sync,
profile_share_generate_share_link,
profile_share_accept_share_link
profile_share_accept_share_link,
profile_share_remove_users,
profile_share_remove_links
])
.build()
}
@@ -73,4 +75,22 @@ pub async fn profile_share_accept_share_link(
) -> Result<()> {
shared_profile::accept_share_link(link).await?;
Ok(())
}
#[tauri::command]
pub async fn profile_share_remove_users(
path : ProfilePathId,
users: Vec<String>
) -> Result<()> {
shared_profile::remove_shared_profile_users(path, users).await?;
Ok(())
}
#[tauri::command]
pub async fn profile_share_remove_links(
path : ProfilePathId,
links : Vec<String>
) -> Result<()> {
shared_profile::remove_shared_profile_links(path, links).await?;
Ok(())
}

View File

@@ -20,6 +20,16 @@ export async function share_accept(link) {
return await invoke('plugin:profile_share|profile_share_accept', { link })
}
/// Removes users from a shared profile
export async function remove_users(path, users) {
return await invoke('plugin:profile_share|profile_share_remove_users', { path, users })
}
/// Removes links from a shared profile
export async function remove_links(path, links) {
return await invoke('plugin:profile_share|profile_share_remove_links', { path, links })
}
/// Install a pack from a shared profile id
export async function share_install(id) {
return await invoke('plugin:profile_share|profile_share_install', { id })

View File

@@ -483,8 +483,8 @@
</div>
</div>
<div class="table-cell table-text manage">
<div v-tooltip="'Remove project'">
<Button icon-only @click="removeSharedPackUser(user)">
<div v-tooltip="'Remove user'">
<Button icon-only @click="removeSharedPackUser(user)" :disabled="user === installedSharedProfileData.owner_id">
<TrashIcon />
</Button>
</div>
@@ -633,7 +633,8 @@ import {
get_all,
outbound_sync,
inbound_sync,
share_generate
share_generate,
remove_users,
} from '@/helpers/shared_profiles.js'
import { computed, readonly, ref, shallowRef, watch } from 'vue'
import { get_max_memory } from '@/helpers/jre.js'
@@ -1042,6 +1043,10 @@ async function generateShareLink() {
shareLink.value = await share_generate(props.instance.path).catch(handleError)
}
async function removeSharedPackUser(user) {
await remove_users(props.instance.path, [user]).catch(handleError)
}
</script>
<style scoped lang="scss">