Skip to content

Commit 5b67ee8

Browse files
author
Ashley
committed
Update Jellyfin user invitation handling
- Fixes an issue where the specific libraries were not being properly extracted from the invitation. - Updates the user policy to enable all folders and set the maximum active sessions to 2. - If there are specific libraries specified in the invitation, the user policy will only enable those libraries.
1 parent 339cb4c commit 5b67ee8

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

backend/helpers/jellyfin.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,11 @@ def invite_jellyfin_user(username: str, password: str, code: str, server_api_key
247247
# Get Invitation from Database
248248
invitation = Invitations.get_or_none(Invitations.code == code)
249249

250+
sections = None
251+
250252
# Get libraries from invitation
251-
sections = (
252-
[]
253-
if invitation.specific_libraries is None
254-
else invitation.specific_libraries.split(",")
255-
)
253+
if invitation.specific_libraries is not None and len(invitation.specific_libraries) > 0:
254+
sections = invitation.specific_libraries.split(",")
256255

257256
# Create user object
258257
new_user = { "Name": str(username), "Password": str(password) }
@@ -261,7 +260,12 @@ def invite_jellyfin_user(username: str, password: str, code: str, server_api_key
261260
user_response = post_jellyfin(api_path="/Users/New", json=new_user, server_api_key=server_api_key, server_url=server_url)
262261

263262
# Create policy object
264-
new_policy = { "EnableAllFolders": False, "EnabledFolders": sections }
263+
new_policy = { "EnableAllFolders": True, "MaxActiveSessions": 2 }
264+
265+
if sections:
266+
new_policy["EnableAllFolders"] = False
267+
new_policy["EnabledFolders"] = sections
268+
265269
old_policy = user_response["Policy"]
266270

267271
# Merge policy with user policy don't overwrite

0 commit comments

Comments
 (0)