sync updates

This commit is contained in:
Luke Pulverenti
2015-01-20 22:54:45 -05:00
parent 9e809b06c4
commit f636c10e24
18 changed files with 206 additions and 157 deletions

View File

@@ -14,9 +14,19 @@ namespace MediaBrowser.Controller.Channels
public override bool IsVisible(User user)
{
if (!user.Policy.EnableAllChannels && !user.Policy.EnabledChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
if (user.Policy.BlockedChannels != null)
{
return false;
if (user.Policy.BlockedChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
{
return false;
}
}
else
{
if (!user.Policy.EnableAllChannels && !user.Policy.EnabledChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
{
return false;
}
}
return base.IsVisible(user);

View File

@@ -303,9 +303,22 @@ namespace MediaBrowser.Controller.Entities
{
if (this is ICollectionFolder)
{
if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
if (user.Policy.BlockedMediaFolders != null)
{
return false;
if (user.Policy.BlockedMediaFolders.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase) ||
// Backwards compatibility
user.Policy.BlockedMediaFolders.Contains(Name, StringComparer.OrdinalIgnoreCase))
{
return false;
}
}
else
{
if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
{
return false;
}
}
}
@@ -675,12 +688,12 @@ namespace MediaBrowser.Controller.Entities
path = System.IO.Path.GetDirectoryName(path);
}
if (ContainsPath(LibraryManager.GetDefaultVirtualFolders(), originalPath))
if (ContainsPath(LibraryManager.GetVirtualFolders(), originalPath))
{
return true;
}
return UserManager.Users.Any(user => ContainsPath(LibraryManager.GetVirtualFolders(user), originalPath));
return ContainsPath(LibraryManager.GetVirtualFolders(), originalPath);
}
/// <summary>

View File

@@ -123,14 +123,7 @@ namespace MediaBrowser.Controller.Library
/// Gets the default view.
/// </summary>
/// <returns>IEnumerable{VirtualFolderInfo}.</returns>
IEnumerable<VirtualFolderInfo> GetDefaultVirtualFolders();
/// <summary>
/// Gets the view.
/// </summary>
/// <param name="user">The user.</param>
/// <returns>IEnumerable{VirtualFolderInfo}.</returns>
IEnumerable<VirtualFolderInfo> GetVirtualFolders(User user);
IEnumerable<VirtualFolderInfo> GetVirtualFolders();
/// <summary>
/// Gets the item by id.

View File

@@ -1,8 +1,10 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Sync;
using MediaBrowser.Model.Users;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -10,6 +12,9 @@ namespace MediaBrowser.Controller.Sync
{
public interface ISyncManager
{
event EventHandler<GenericEventArgs<SyncJob>> SyncJobCreated;
event EventHandler<GenericEventArgs<SyncJob>> SyncJobCancelled;
/// <summary>
/// Creates the job.
/// </summary>
@@ -44,6 +49,20 @@ namespace MediaBrowser.Controller.Sync
/// <returns>Task.</returns>
Task UpdateJob(SyncJob job);
/// <summary>
/// Res the enable job item.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>Task.</returns>
Task ReEnableJobItem(string id);
/// <summary>
/// Cnacels the job item.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>Task.</returns>
Task CancelJobItem(string id);
/// <summary>
/// Cancels the job.
/// </summary>