/// <summary> /// Initializes a new instance of the <see cref="UserDto"/> class. /// </summary> public UserDto() { Configuration = new UserConfiguration(); Policy = new UserPolicy(); }
protected override bool GetBlockUnratedValue(UserPolicy config) { return config.BlockUnratedItems.Contains(UnratedItem.ChannelContent); }
private async Task UpdateUserPolicy(User user, UserPolicy userPolicy, bool fireEvent) { // The xml serializer will output differently if the type is not exact if (userPolicy.GetType() != typeof(UserPolicy)) { var json = _jsonSerializer.SerializeToString(userPolicy); userPolicy = _jsonSerializer.DeserializeFromString<UserPolicy>(json); } var path = GetPolifyFilePath(user); _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); lock (_policySyncLock) { _xmlSerializer.SerializeToFile(userPolicy, path); user.Policy = userPolicy; } await UpdateConfiguration(user, user.Configuration, true).ConfigureAwait(false); }
private bool CanAccessDevice(UserPolicy policy, string id) { if (policy.EnableAllDevices) { return true; } if (policy.IsAdministrator) { return true; } return ListHelper.ContainsIgnoreCase(policy.EnabledDevices, id); }
public Task UpdateUserPolicy(string userId, UserPolicy userPolicy) { var user = GetUserById(userId); return UpdateUserPolicy(user, userPolicy, true); }
protected override bool GetBlockUnratedValue(UserPolicy config) { return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram); }
protected override bool GetBlockUnratedValue(UserPolicy config) { // Don't block. return false; }
public bool IsEnabledToSendToUser(string type, string userId, UserPolicy userPolicy) { NotificationOption opt = GetOptions(type); if (opt != null && opt.Enabled) { if (opt.SendToUserMode == SendToUserType.All) { return true; } if (opt.SendToUserMode == SendToUserType.Admins && userPolicy.IsAdministrator) { return true; } return ListHelper.ContainsIgnoreCase(opt.SendToUsers, userId); } return false; }
public async Task UpdateUserPolicy(string userId, UserPolicy userPolicy) { var user = GetUserById(userId); var path = GetPolifyFilePath(user); lock (_policySyncLock) { _xmlSerializer.SerializeToFile(userPolicy, path); user.Policy = userPolicy; } }