forked from jellyfin/Swiftfin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Permissions Cleanup Squeezing in: jellyfin/jellyfin-web#6361
- Loading branch information
Showing
10 changed files
with
111 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// Swiftfin is subject to the terms of the Mozilla Public | ||
// License, v2.0. If a copy of the MPL was not distributed with this | ||
// file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
// | ||
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors | ||
// | ||
|
||
import JellyfinAPI | ||
|
||
struct UserPermissions { | ||
|
||
let isAdministrator: Bool | ||
let items: UserItemPermissions | ||
|
||
init(_ policy: UserPolicy?) { | ||
self.isAdministrator = policy?.isAdministrator ?? false | ||
self.items = UserItemPermissions(policy, isAdministrator: isAdministrator) | ||
} | ||
|
||
struct UserItemPermissions { | ||
|
||
let canDelete: Bool | ||
let canDownload: Bool | ||
let canEditMetadata: Bool | ||
let canManageSubtitles: Bool | ||
let canManageCollections: Bool | ||
let canManageLyrics: Bool | ||
|
||
init(_ policy: UserPolicy?, isAdministrator: Bool) { | ||
self.canDelete = policy?.enableContentDeletion ?? false || policy?.enableContentDeletionFromFolders != [] | ||
self.canDownload = policy?.enableContentDownloading ?? false | ||
self.canEditMetadata = isAdministrator | ||
// TODO: SDK 10.9 Enable Comments | ||
self.canManageSubtitles = isAdministrator // || policy?.enableSubtitleManagement ?? false | ||
self.canManageCollections = isAdministrator // || policy?.enableCollectionManagement ?? false | ||
// TODO: SDK 10.10 Enable Comments | ||
self.canManageLyrics = isAdministrator // || policy?.enableSubtitleManagement ?? false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters