mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-02 13:58:29 +01:00
sync updates
This commit is contained in:
@@ -73,10 +73,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
private readonly Func<IDtoService> _dtoServiceFactory;
|
||||
private readonly Func<IConnectManager> _connectFactory;
|
||||
private readonly Func<IChannelManager> _channelManager;
|
||||
private readonly Func<ILibraryManager> _libraryManager;
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func<IImageProcessor> imageProcessorFactory, Func<IDtoService> dtoServiceFactory, Func<IConnectManager> connectFactory, IServerApplicationHost appHost, IJsonSerializer jsonSerializer, IFileSystem fileSystem, Func<IChannelManager> channelManager)
|
||||
public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository, IXmlSerializer xmlSerializer, INetworkManager networkManager, Func<IImageProcessor> imageProcessorFactory, Func<IDtoService> dtoServiceFactory, Func<IConnectManager> connectFactory, IServerApplicationHost appHost, IJsonSerializer jsonSerializer, IFileSystem fileSystem, Func<IChannelManager> channelManager, Func<ILibraryManager> libraryManager)
|
||||
{
|
||||
_logger = logger;
|
||||
UserRepository = userRepository;
|
||||
@@ -89,6 +90,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_fileSystem = fileSystem;
|
||||
_channelManager = channelManager;
|
||||
_libraryManager = libraryManager;
|
||||
ConfigurationManager = configurationManager;
|
||||
Users = new List<User>();
|
||||
|
||||
@@ -173,6 +175,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
{
|
||||
await DoPolicyMigration(user).ConfigureAwait(false);
|
||||
await DoChannelMigration(user).ConfigureAwait(false);
|
||||
await DoLibraryMigration(user).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
// If there are no local users with admin rights, make them all admins
|
||||
@@ -389,6 +392,39 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DoLibraryMigration(User user)
|
||||
{
|
||||
if (user.Policy.BlockedMediaFolders != null)
|
||||
{
|
||||
if (user.Policy.BlockedMediaFolders.Length > 0)
|
||||
{
|
||||
user.Policy.EnableAllFolders = false;
|
||||
|
||||
try
|
||||
{
|
||||
user.Policy.EnabledFolders = _libraryManager().RootFolder
|
||||
.Children
|
||||
.Where(i => !user.Policy.BlockedMediaFolders.Contains(i.Name, StringComparer.OrdinalIgnoreCase) && !user.Policy.BlockedMediaFolders.Contains(i.Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
|
||||
.Select(i => i.Id.ToString("N"))
|
||||
.ToArray();
|
||||
}
|
||||
catch
|
||||
{
|
||||
user.Policy.EnabledFolders = new string[] { };
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
user.Policy.EnableAllFolders = true;
|
||||
user.Policy.EnabledFolders = new string[] { };
|
||||
}
|
||||
|
||||
user.Policy.BlockedMediaFolders = null;
|
||||
|
||||
await UpdateUserPolicy(user, user.Policy, false);
|
||||
}
|
||||
}
|
||||
|
||||
public UserDto GetUserDto(User user, string remoteEndPoint = null)
|
||||
{
|
||||
if (user == null)
|
||||
|
||||
Reference in New Issue
Block a user