public bool IsEnabledToSendToUser(string type, string userId, UserConfiguration userConfig) { NotificationOption opt = GetOptions(type); if (opt != null && opt.Enabled) { if (opt.SendToUserMode == SendToUserType.All) { return(true); } if (opt.SendToUserMode == SendToUserType.Admins && userConfig.IsAdministrator) { return(true); } return(opt.SendToUsers.Contains(userId, StringComparer.OrdinalIgnoreCase)); } return(false); }
public UserConfig(UserConfiguration data) { this._data = data; }
/// <summary> /// Initializes a new instance of the <see cref="UserDto"/> class. /// </summary> public UserDto() { Configuration = new UserConfiguration(); Policy = new UserPolicy(); }
protected override bool GetBlockUnratedValue(UserConfiguration config) { // Don't block. Let either the entire series rating or episode rating determine it return false; }
private async Task UpdateConfiguration(User user, UserConfiguration config, bool fireEvent) { var path = GetConfigurationFilePath(user); // The xml serializer will output differently if the type is not exact if (config.GetType() != typeof(UserConfiguration)) { var json = _jsonSerializer.SerializeToString(config); config = _jsonSerializer.DeserializeFromString<UserConfiguration>(json); } _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); lock (_configSyncLock) { _xmlSerializer.SerializeToFile(config, path); user.Configuration = config; } if (fireEvent) { EventHelper.FireEventIfNotNull(UserConfigurationUpdated, this, new GenericEventArgs<User> { Argument = user }, _logger); } }
public Task UpdateConfiguration(string userId, UserConfiguration config) { var user = GetUserById(userId); return UpdateConfiguration(user, config, true); }
protected override bool GetBlockUnratedValue(UserConfiguration config) { return config.BlockUnratedItems.Contains(UnratedItem.ChannelContent); }
protected override bool GetBlockUnratedValue(UserConfiguration config) { return config.BlockUnratedMusic; }
protected override bool GetBlockUnratedValue(UserConfiguration config) { // Don't block. return false; }
public void UpdateConfiguration(User user, UserConfiguration newConfiguration) { var xmlPath = user.ConfigurationFilePath; Directory.CreateDirectory(Path.GetDirectoryName(xmlPath)); _xmlSerializer.SerializeToFile(newConfiguration, xmlPath); EventHelper.FireEventIfNotNull(UserConfigurationUpdated, this, new GenericEventArgs<User> { Argument = user }, _logger); }
/// <summary> /// Initializes a new instance of the <see cref="UserDto"/> class. /// </summary> public UserDto() { Configuration = new UserConfiguration(); }
/// <summary> /// Updates the configuration. /// </summary> /// <param name="config">The config.</param> /// <param name="serializer">The serializer.</param> /// <exception cref="System.ArgumentNullException">config</exception> public void UpdateConfiguration(UserConfiguration config, IXmlSerializer serializer) { if (config == null) { throw new ArgumentNullException("config"); } var customLibraryChanged = config.UseCustomLibrary != Configuration.UseCustomLibrary; Configuration = config; SaveConfiguration(serializer); // Force these to be lazy loaded again if (customLibraryChanged) { RootFolder = null; } }
/// <summary> /// Updates the configuration. /// </summary> /// <param name="config">The config.</param> /// <exception cref="System.ArgumentNullException">config</exception> public void UpdateConfiguration(UserConfiguration config) { if (config == null) { throw new ArgumentNullException("config"); } Configuration = config; UserManager.UpdateConfiguration(this, Configuration); }
/// <summary> /// Updates the configuration. /// </summary> /// <param name="config">The config.</param> /// <param name="serializer">The serializer.</param> /// <exception cref="System.ArgumentNullException">config</exception> public void UpdateConfiguration(UserConfiguration config, IXmlSerializer serializer) { if (config == null) { throw new ArgumentNullException("config"); } Configuration = config; SaveConfiguration(); }
protected override bool GetBlockUnratedValue(UserConfiguration config) { return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram); }
public bool IsEnabledToSendToUser(string type, string userId, UserConfiguration userConfig) { NotificationOption opt = GetOptions(type); if (opt != null && opt.Enabled) { if (opt.SendToUserMode == SendToUserType.All) { return true; } if (opt.SendToUserMode == SendToUserType.Admins && userConfig.IsAdministrator) { return true; } return ListHelper.ContainsIgnoreCase(opt.SendToUsers, userId); } return false; }