feat(request-limits): Added the new request limit options into the user importer

pull/4365/head
tidusjar 3 years ago
parent 03bc23a74e
commit 01d4f4d718

@ -117,7 +117,11 @@ namespace Ombi.Schedule.Jobs.Emby
ProviderUserId = embyUser.Id, ProviderUserId = embyUser.Id,
Alias = isConnectUser ? embyUser.Name : string.Empty, Alias = isConnectUser ? embyUser.Name : string.Empty,
MovieRequestLimit = userManagementSettings.MovieRequestLimit, MovieRequestLimit = userManagementSettings.MovieRequestLimit,
MovieRequestLimitType = userManagementSettings.MovieRequestLimitType,
EpisodeRequestLimit = userManagementSettings.EpisodeRequestLimit, EpisodeRequestLimit = userManagementSettings.EpisodeRequestLimit,
EpisodeRequestLimitType = userManagementSettings.EpisodeRequestLimitType,
MusicRequestLimit = userManagementSettings.MusicRequestLimit,
MusicRequestLimitType = userManagementSettings.MusicRequestLimitType,
StreamingCountry = userManagementSettings.DefaultStreamingCountry StreamingCountry = userManagementSettings.DefaultStreamingCountry
}; };
var result = await _userManager.CreateAsync(newUser); var result = await _userManager.CreateAsync(newUser);

@ -104,7 +104,11 @@ namespace Ombi.Schedule.Jobs.Plex
Email = plexUser?.Email ?? string.Empty, Email = plexUser?.Email ?? string.Empty,
Alias = string.Empty, Alias = string.Empty,
MovieRequestLimit = userManagementSettings.MovieRequestLimit, MovieRequestLimit = userManagementSettings.MovieRequestLimit,
MovieRequestLimitType = userManagementSettings.MovieRequestLimitType,
EpisodeRequestLimit = userManagementSettings.EpisodeRequestLimit, EpisodeRequestLimit = userManagementSettings.EpisodeRequestLimit,
EpisodeRequestLimitType = userManagementSettings.EpisodeRequestLimitType,
MusicRequestLimit = userManagementSettings.MusicRequestLimit,
MusicRequestLimitType = userManagementSettings.MusicRequestLimitType,
StreamingCountry = userManagementSettings.DefaultStreamingCountry StreamingCountry = userManagementSettings.DefaultStreamingCountry
}; };
_log.LogInformation("Creating Plex user {0}", newUser.UserName); _log.LogInformation("Creating Plex user {0}", newUser.UserName);

@ -1,4 +1,5 @@
using System.Collections.Generic; using Ombi.Store.Entities;
using System.Collections.Generic;
namespace Ombi.Settings.Settings.Models namespace Ombi.Settings.Settings.Models
{ {
@ -9,7 +10,11 @@ namespace Ombi.Settings.Settings.Models
public bool ImportEmbyUsers { get; set; } public bool ImportEmbyUsers { get; set; }
public bool ImportJellyfinUsers { get; set; } public bool ImportJellyfinUsers { get; set; }
public int MovieRequestLimit { get; set; } public int MovieRequestLimit { get; set; }
public RequestLimitType MovieRequestLimitType { get; set; } = RequestLimitType.Week;
public int EpisodeRequestLimit { get; set; } public int EpisodeRequestLimit { get; set; }
public RequestLimitType EpisodeRequestLimitType { get; set; } = RequestLimitType.Week;
public int MusicRequestLimit { get; set; }
public RequestLimitType MusicRequestLimitType { get; set; } = RequestLimitType.Week;
public string DefaultStreamingCountry { get; set; } = "US"; public string DefaultStreamingCountry { get; set; } = "US";
public List<string> DefaultRoles { get; set; } = new List<string>(); public List<string> DefaultRoles { get; set; } = new List<string>();
public List<string> BannedPlexUserIds { get; set; } = new List<string>(); public List<string> BannedPlexUserIds { get; set; } = new List<string>();

@ -1,4 +1,5 @@
import { ISettings } from "./ICommon"; import { ISettings } from "./ICommon";
import { RequestLimitType } from ".";
export interface IExternalSettings extends ISettings { export interface IExternalSettings extends ISettings {
ssl: boolean; ssl: boolean;
@ -247,10 +248,14 @@ export interface IUserManagementSettings extends ISettings {
defaultRoles: string[]; defaultRoles: string[];
movieRequestLimit: number; movieRequestLimit: number;
episodeRequestLimit: number; episodeRequestLimit: number;
musicRequestLimit: number;
bannedPlexUserIds: string[]; bannedPlexUserIds: string[];
bannedEmbyUserIds: string[]; bannedEmbyUserIds: string[];
bannedJellyfinUserIds: string[]; bannedJellyfinUserIds: string[];
defaultStreamingCountry: string; defaultStreamingCountry: string;
movieRequestLimitType: RequestLimitType;
episodeRequestLimitType: RequestLimitType;
musicRequestLimitType: RequestLimitType;
} }
export interface IAbout { export interface IAbout {

@ -49,8 +49,8 @@
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<h4>Default Roles</h4> <h3>Default Roles</h3>
<hr>
<div *ngFor="let c of claims"> <div *ngFor="let c of claims">
<div class="form-group"> <div class="form-group">
<div> <div>
@ -60,7 +60,10 @@
</div> </div>
</div> </div>
<h4>Default Request Limits</h4> <h3>Default Request Limits</h3>
<hr>
<div class="form-group"> <div class="form-group">
<label for="movieRequestLimit" class="control-label">Movie Request Limit</label> <label for="movieRequestLimit" class="control-label">Movie Request Limit</label>
<div> <div>
@ -68,12 +71,38 @@
</div> </div>
</div> </div>
<mat-label>Movie Request Limit Type</mat-label>
<mat-select id="movieRequestLimitType" [(value)]="settings.movieRequestLimitType">
<mat-option *ngFor="let value of requestLimitTypes" [value]="value">
{{RequestLimitType[value]}}
</mat-option>
</mat-select>
<div class="form-group"> <div class="form-group">
<label for="episodeRequestLimit" class="control-label">Episode Request Limit</label> <label for="episodeRequestLimit" class="control-label">Episode Request Limit</label>
<div> <div>
<input type="text" [(ngModel)]="settings.episodeRequestLimit" class="form-control form-small form-control-custom" id="episodeRequestLimit" name="episodeRequestLimit" value="{{settings?.episodeRequestLimit}}"> <input type="text" [(ngModel)]="settings.episodeRequestLimit" class="form-control form-small form-control-custom" id="episodeRequestLimit" name="episodeRequestLimit" value="{{settings?.episodeRequestLimit}}">
</div> </div>
</div> </div>
<mat-label>Episode Request Limit Type</mat-label>
<mat-select id="episodeRequestLimitType" [(value)]="settings.episodeRequestLimitType">
<mat-option *ngFor="let value of requestLimitTypes" [value]="value">
{{RequestLimitType[value]}}
</mat-option>
</mat-select>
<div class="form-group">
<label for="episodeRequestLimit" class="control-label">Music Request Limit</label>
<div>
<input type="text" [(ngModel)]="settings.musicRequestLimit" class="form-control form-small form-control-custom" id="musicRequestLimit" name="musicRequestLimit" value="{{settings?.musicRequestLimit}}">
</div>
</div>
<mat-label>Music Request Limit Type</mat-label>
<mat-select id="musicRequestLimitType" [(value)]="settings.musicRequestLimitType">
<mat-option *ngFor="let value of requestLimitTypes" [value]="value">
{{RequestLimitType[value]}}
</mat-option>
</mat-select>
<mat-form-field> <mat-form-field>
<mat-label [translate]="'UserPreferences.StreamingCountry'"></mat-label> <mat-label [translate]="'UserPreferences.StreamingCountry'"></mat-label>

@ -1,8 +1,8 @@
import { Component, OnInit } from "@angular/core"; import { Component, OnInit } from "@angular/core";
import { EmbyService, IdentityService, JellyfinService, JobService, NotificationService, PlexService, SettingsService } from "../../services";
import { ICheckbox, IUserManagementSettings, RequestLimitType } from "../../interfaces";
import { ICheckbox, IUserManagementSettings } from "../../interfaces";
import { IUsersModel } from "../../interfaces"; import { IUsersModel } from "../../interfaces";
import { EmbyService, JellyfinService, IdentityService, JobService, NotificationService, PlexService, SettingsService } from "../../services";
@Component({ @Component({
templateUrl: "./usermanagement.component.html", templateUrl: "./usermanagement.component.html",
@ -31,6 +31,9 @@ export class UserManagementComponent implements OnInit {
public enableImportButton = false; public enableImportButton = false;
public countries: string[]; public countries: string[];
public requestLimitTypes: RequestLimitType[] = [RequestLimitType.Day, RequestLimitType.Week, RequestLimitType.Month];
public RequestLimitType = RequestLimitType;
constructor(private readonly settingsService: SettingsService, constructor(private readonly settingsService: SettingsService,
private readonly notificationService: NotificationService, private readonly notificationService: NotificationService,
private readonly identityService: IdentityService, private readonly identityService: IdentityService,
@ -120,7 +123,7 @@ export class UserManagementComponent implements OnInit {
if (x === true) { if (x === true) {
this.notificationService.success("Successfully saved the User Management Settings"); this.notificationService.success("Successfully saved the User Management Settings");
} else { } else {
this.notificationService.success( "There was an error when saving the Ombi settings"); this.notificationService.success( "There was an error when saving the settings");
} }
}); });
} }

Loading…
Cancel
Save