jellyseerr icon indicating copy to clipboard operation
jellyseerr copied to clipboard

[Feature Request] Option to automatically delete Jellyseer users when the corresponding Jellyfin user is deleted

Open cmbarba opened this issue 3 years ago • 1 comments

Description

At moment, when Jellyfin users are deleted from Jellyfin through the Jellyfin>Dashboard>Users page or through something like jfa-go, the Jellyseer accounts that were made from those Jellyfin users remain and must be manually deleted. Adding a way to automatically deal with orphaned users would make the Fin/Seer experience more seamless. This is really just a quality of life issue and might be more of general Overseerr accounts issue and thus out of the scope of this project anyway, but I thought to bring it up since it deals with Jellyfin.

Desired Behavior

Add a togglable option under Jellyseer>Settings (Admin)>Users to allow Jellyfin user deletions to trigger Jellyseer user deletions, matched by user name. Possibly also add a function on the Jellyseer>Users (Admin) page that purges all orphaned users.

cmbarba avatar May 09 '22 15:05 cmbarba

Hey so while we are working on implementing this, you might be interested in this script someone (MattrixM) in discord wrote for this:

#Hostname or IP:port
$URL = ""

#Jellyseerr API Key
$APIKey = ""



$a = Invoke-RestMethod -uri "http://$URL/api/v1/settings/jellyfin/users" -method Get -Headers @{"x-api-key" = "$APIKey"} -ContentType "application/json"

$b = Invoke-RestMethod -uri "http://$URL/api/v1/user?take=200&skip=0&sort=displayname" -method Get -Headers @{"x-api-key" = "$APIKey"} -ContentType "application/json"

$EmbyUsers = $a | select username

$SeerUsers = $b.results | select jellyfinusername, id

ForEach($Item in $SeerUsers)
{
    If($EmbyUsers.username -notcontains $Item.jellyfinUsername)
    {
    $ID = $item.id
    Invoke-RestMethod -uri "http://$URL/api/v1/user/$ID" -method Delete -Headers @{"x-api-key" = "$APIKey"} -ContentType "application/json"
    } 
} 

fallenbagel avatar Jul 31 '22 15:07 fallenbagel