mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 16:52:56 -07:00
omgwtf so many changes. #865
This commit is contained in:
parent
64d37c37a3
commit
2e8f08fef1
38 changed files with 264 additions and 135 deletions
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "2.0.0"
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ namespace Ombi.Core.Models.UI
|
|||
public List<ClaimCheckboxes> Claims { get; set; }
|
||||
public string EmailAddress { get; set; }
|
||||
public string Password { get; set; }
|
||||
public bool IsSetup { get; set; }
|
||||
public UserType UserType { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +135,7 @@ namespace Ombi.DependencyInjection
|
|||
services.AddTransient<IJobSetup, JobSetup>();
|
||||
services.AddTransient<IRadarrCacher, RadarrCacher>();
|
||||
services.AddTransient<IOmbiAutomaticUpdater, OmbiAutomaticUpdater>();
|
||||
services.AddTransient<IPlexUserImporter, PlexUserImporter>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using Hangfire;
|
||||
using Ombi.Schedule.Jobs;
|
||||
using Ombi.Schedule.Jobs.Emby;
|
||||
using Ombi.Schedule.Jobs.Plex;
|
||||
using Ombi.Schedule.Jobs.Radarr;
|
||||
using Ombi.Schedule.Ombi;
|
||||
|
||||
|
@ -9,17 +10,19 @@ namespace Ombi.Schedule
|
|||
public class JobSetup : IJobSetup
|
||||
{
|
||||
public JobSetup(IPlexContentCacher plexContentCacher, IRadarrCacher radarrCacher,
|
||||
IOmbiAutomaticUpdater updater, IEmbyContentCacher embyCacher)
|
||||
IOmbiAutomaticUpdater updater, IEmbyContentCacher embyCacher, IPlexUserImporter userImporter)
|
||||
{
|
||||
PlexContentCacher = plexContentCacher;
|
||||
RadarrCacher = radarrCacher;
|
||||
Updater = updater;
|
||||
EmbyContentCacher = embyCacher;
|
||||
PlexUserImporter = userImporter;
|
||||
}
|
||||
|
||||
private IPlexContentCacher PlexContentCacher { get; }
|
||||
private IRadarrCacher RadarrCacher { get; }
|
||||
private IOmbiAutomaticUpdater Updater { get; }
|
||||
private IPlexUserImporter PlexUserImporter { get; }
|
||||
private IEmbyContentCacher EmbyContentCacher { get; }
|
||||
|
||||
public void Setup()
|
||||
|
@ -27,9 +30,10 @@ namespace Ombi.Schedule
|
|||
RecurringJob.AddOrUpdate(() => PlexContentCacher.CacheContent(), Cron.Hourly);
|
||||
RecurringJob.AddOrUpdate(() => EmbyContentCacher.Start(), Cron.Hourly);
|
||||
RecurringJob.AddOrUpdate(() => RadarrCacher.CacheContent(), Cron.Hourly);
|
||||
//RecurringJob.AddOrUpdate(() => Updater.Update(), Cron.Daily);
|
||||
RecurringJob.AddOrUpdate(() => PlexUserImporter.Start(), Cron.Daily);
|
||||
RecurringJob.AddOrUpdate(() => Updater.Update(), Cron.Daily);
|
||||
|
||||
BackgroundJob.Enqueue(() => Updater.Update());
|
||||
//BackgroundJob.Enqueue(() => PlexUserImporter.Start());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
9
src/Ombi.Schedule/Jobs/Plex/IPlexUserImporter.cs
Normal file
9
src/Ombi.Schedule/Jobs/Plex/IPlexUserImporter.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ombi.Schedule.Jobs.Plex
|
||||
{
|
||||
public interface IPlexUserImporter
|
||||
{
|
||||
Task Start();
|
||||
}
|
||||
}
|
|
@ -7,29 +7,37 @@ using Ombi.Api.Plex;
|
|||
using Ombi.Core.Settings;
|
||||
using Ombi.Core.Settings.Models.External;
|
||||
using Ombi.Helpers;
|
||||
using Ombi.Settings.Settings.Models;
|
||||
using Ombi.Store.Entities;
|
||||
|
||||
namespace Ombi.Schedule.Jobs.Plex
|
||||
{
|
||||
public class PlexUserImporter
|
||||
public class PlexUserImporter : IPlexUserImporter
|
||||
{
|
||||
public PlexUserImporter(IPlexApi api, UserManager<OmbiUser> um, ILogger<PlexUserImporter> log,
|
||||
ISettingsService<PlexSettings> plexSettings)
|
||||
ISettingsService<PlexSettings> plexSettings, ISettingsService<UserManagementSettings> ums)
|
||||
{
|
||||
_api = api;
|
||||
_userManager = um;
|
||||
_log = log;
|
||||
_plexSettings = plexSettings;
|
||||
_userManagementSettings = ums;
|
||||
}
|
||||
|
||||
private readonly IPlexApi _api;
|
||||
private readonly UserManager<OmbiUser> _userManager;
|
||||
private readonly ILogger<PlexUserImporter> _log;
|
||||
private readonly ISettingsService<PlexSettings> _plexSettings;
|
||||
private readonly ISettingsService<UserManagementSettings> _userManagementSettings;
|
||||
|
||||
|
||||
public async Task Start()
|
||||
{
|
||||
var userManagementSettings = await _userManagementSettings.GetSettingsAsync();
|
||||
if (!userManagementSettings.ImportMediaServerUsers)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var settings = await _plexSettings.GetSettingsAsync();
|
||||
if (!settings.Enable)
|
||||
{
|
||||
|
@ -72,7 +80,13 @@ namespace Ombi.Schedule.Jobs.Plex
|
|||
continue;
|
||||
}
|
||||
// TODO Set default permissions/roles
|
||||
|
||||
if (userManagementSettings.DefaultRoles.Any())
|
||||
{
|
||||
foreach (var defaultRole in userManagementSettings.DefaultRoles)
|
||||
{
|
||||
await _userManager.AddToRoleAsync(newUser, defaultRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
10
src/Ombi.Settings/Settings/Models/UserManagementSettings.cs
Normal file
10
src/Ombi.Settings/Settings/Models/UserManagementSettings.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Ombi.Settings.Settings.Models
|
||||
{
|
||||
public class UserManagementSettings : Settings
|
||||
{
|
||||
public bool ImportMediaServerUsers { get; set; }
|
||||
public List<string> DefaultRoles { get; set; }
|
||||
}
|
||||
}
|
|
@ -7,9 +7,8 @@ import { RouterModule, Routes } from '@angular/router';
|
|||
import { HttpModule } from '@angular/http';
|
||||
|
||||
// Third Party
|
||||
import { ButtonModule, DialogModule, CaptchaModule } from 'primeng/primeng';
|
||||
import { ButtonModule, DialogModule, CaptchaModule,DataTableModule, SharedModule } from 'primeng/primeng';
|
||||
import { GrowlModule } from 'primeng/components/growl/growl';
|
||||
import { DataTableModule, SharedModule } from 'primeng/primeng';
|
||||
//import { DragulaModule, DragulaService } from 'ng2-dragula/ng2-dragula';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
|
@ -41,6 +40,7 @@ import { WizardModule } from './wizard/wizard.module';
|
|||
import { SearchModule } from './search/search.module';
|
||||
import { UserManagementModule } from './usermanagement/usermanagement.module';
|
||||
import { RequestsModule } from './requests/requests.module';
|
||||
//import { PipeModule } from './pipes/pipe.module';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '*', component: PageNotFoundComponent },
|
||||
|
@ -79,7 +79,7 @@ const routes: Routes = [
|
|||
ReactiveFormsModule,
|
||||
UserManagementModule,
|
||||
RequestsModule,
|
||||
CaptchaModule
|
||||
CaptchaModule,
|
||||
],
|
||||
declarations: [
|
||||
AppComponent,
|
||||
|
@ -87,7 +87,7 @@ const routes: Routes = [
|
|||
LoginComponent,
|
||||
LandingPageComponent,
|
||||
ResetPasswordComponent,
|
||||
TokenResetPasswordComponent
|
||||
TokenResetPasswordComponent,
|
||||
],
|
||||
providers: [
|
||||
RequestService,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
export interface IUserLogin {
|
||||
username: string,
|
||||
password:string
|
||||
password: string,
|
||||
rememberMe:boolean,
|
||||
}
|
||||
|
||||
export interface ILocalUser {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
export interface IRequestEngineResult {
|
||||
requestAdded: boolean,
|
||||
message: string
|
||||
message: string,
|
||||
errorMessage: string,
|
||||
}
|
|
@ -6,8 +6,7 @@
|
|||
emailAddress: string,
|
||||
password: string,
|
||||
userType: UserType,
|
||||
|
||||
|
||||
isSetup:boolean,
|
||||
// FOR UI
|
||||
checked: boolean,
|
||||
}
|
||||
|
|
|
@ -19,7 +19,10 @@ include the remember me checkbox
|
|||
<input type="password" id="inputPassword" class="form-control" formControlName="password" placeholder="Password">
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" id="RememberMe" formControlName="rememberMe"> Remember Me
|
||||
<input type="checkbox" id="RememberMe" formControlName="rememberMe" >
|
||||
|
||||
<label for="RememberMe"> Remember Me</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-success" type="submit">Sign in</button>
|
||||
|
|
|
@ -47,7 +47,6 @@ export class LoginComponent implements OnInit {
|
|||
|
||||
ngOnInit(): void {
|
||||
this.settingsService.getLandingPage().subscribe(x => {
|
||||
debugger;
|
||||
if (x.enabled && !this.landingFlag) {
|
||||
this.router.navigate(['landingpage']);
|
||||
}
|
||||
|
@ -62,10 +61,10 @@ export class LoginComponent implements OnInit {
|
|||
onSubmit(form: FormGroup): void {
|
||||
if (form.invalid) {
|
||||
this.notify.error("Validation", "Please check your entered values");
|
||||
return
|
||||
return;
|
||||
}
|
||||
var value = form.value;
|
||||
this.authService.login({ password: value.password, username: value.username })
|
||||
this.authService.login({ password: value.password, username: value.username, rememberMe:value.rememberMe })
|
||||
.subscribe(x => {
|
||||
localStorage.setItem("id_token", x.access_token);
|
||||
|
||||
|
|
17
src/Ombi/ClientApp/app/pipes/pipe.module.ts
Normal file
17
src/Ombi/ClientApp/app/pipes/pipe.module.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { NgModule, ModuleWithProviders } from '@angular/core';
|
||||
import { HumanizePipe } from './HumanizePipe';
|
||||
|
||||
@NgModule({
|
||||
imports: [],
|
||||
declarations: [HumanizePipe],
|
||||
exports: [HumanizePipe],
|
||||
})
|
||||
export class PipeModule {
|
||||
|
||||
static forRoot() : ModuleWithProviders {
|
||||
return {
|
||||
ngModule: PipeModule,
|
||||
providers: [],
|
||||
};
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ import 'rxjs/add/operator/distinctUntilChanged';
|
|||
import 'rxjs/add/operator/map';
|
||||
|
||||
import { RequestService } from '../services/request.service';
|
||||
import { IdentityService } from '../services/identity.service';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
|
||||
import { IMovieRequests } from '../interfaces/IRequestModel';
|
||||
|
||||
|
@ -20,7 +20,8 @@ import { IMovieRequests } from '../interfaces/IRequestModel';
|
|||
templateUrl: './movierequests.component.html'
|
||||
})
|
||||
export class MovieRequestsComponent implements OnInit, OnDestroy {
|
||||
constructor(private requestService: RequestService, private identityService: IdentityService) {
|
||||
constructor(private requestService: RequestService,
|
||||
private auth:AuthService) {
|
||||
this.searchChanged
|
||||
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
|
||||
.distinctUntilChanged() // only emit if value is different from previous value
|
||||
|
@ -54,6 +55,7 @@ export class MovieRequestsComponent implements OnInit, OnDestroy {
|
|||
this.amountToLoad = 5;
|
||||
this.currentlyLoaded = 5;
|
||||
this.loadInit();
|
||||
this.isAdmin = this.auth.hasRole("admin");
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +111,6 @@ export class MovieRequestsComponent implements OnInit, OnDestroy {
|
|||
this.requestService.getMovieRequests(this.amountToLoad, 0)
|
||||
.takeUntil(this.subscriptions)
|
||||
.subscribe(x => this.movieRequests = x);
|
||||
this.isAdmin = this.identityService.hasRole("Admin");
|
||||
}
|
||||
|
||||
private resetSearch() {
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
</div>
|
||||
|
||||
|
||||
<div class="col-md-1 col-md-push-9">
|
||||
<!--// TODO ADMIN-->
|
||||
<div class="col-md-1 col-md-push-9" *ngIf="isAdmin">
|
||||
<form>
|
||||
<button style="text-align: right" *ngIf="child.CanApprove" (click)="approve(child)" class="btn btn-sm btn-success-outline" type="submit"><i class="fa fa-plus"></i> Approve</button>
|
||||
</form>
|
||||
|
@ -69,14 +68,7 @@
|
|||
<span *ngIf="ep.available" class="label label-success">Available</span>
|
||||
<span *ngIf="ep.approved && !ep.available" class="label label-info">Processing Request</span>
|
||||
<div *ngIf="!ep.approved">
|
||||
<div *ngIf="ep.requested && !ep.available; then requested else notRequested"></div>
|
||||
<ng-template #requested>
|
||||
<span class="label label-warning">Pending Approval</span>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #notRequested>
|
||||
<span class="label label-danger">Not Yet Requested</span>
|
||||
</ng-template>
|
||||
<div *ngIf="!ep.available"><span class="label label-warning">Pending Approval</span></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -7,7 +7,7 @@ import { IChildRequests, IEpisodesRequests } from '../interfaces/IRequestModel';
|
|||
templateUrl: './tvrequest-children.component.html'
|
||||
})
|
||||
export class TvRequestChildrenComponent {
|
||||
constructor(private requestService: RequestService) {
|
||||
constructor(private requestService: RequestService ) {
|
||||
}
|
||||
|
||||
@Input() childRequests: IChildRequests[];
|
||||
|
|
|
@ -10,7 +10,7 @@ import 'rxjs/add/operator/distinctUntilChanged';
|
|||
import 'rxjs/add/operator/map';
|
||||
|
||||
import { RequestService } from '../services/request.service';
|
||||
import { IdentityService } from '../services/identity.service';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
|
||||
import { ITvRequests, IChildRequests, INewSeasonRequests, IEpisodesRequests } from '../interfaces/IRequestModel';
|
||||
import { TreeNode, } from "primeng/primeng";
|
||||
|
@ -25,7 +25,8 @@ import { TreeNode, } from "primeng/primeng";
|
|||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class TvRequestsComponent implements OnInit, OnDestroy {
|
||||
constructor(private requestService: RequestService, private identityService: IdentityService) {
|
||||
constructor(private requestService: RequestService,
|
||||
private auth:AuthService) {
|
||||
this.searchChanged
|
||||
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
|
||||
.distinctUntilChanged() // only emit if value is different from previous value
|
||||
|
@ -111,6 +112,7 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
|
|||
this.currentlyLoaded = 5;
|
||||
this.tvRequests = [];
|
||||
this.loadInit();
|
||||
this.isAdmin = this.auth.hasRole("admin");
|
||||
}
|
||||
|
||||
public loadMore() {
|
||||
|
@ -208,7 +210,6 @@ export class TvRequestsComponent implements OnInit, OnDestroy {
|
|||
.subscribe(x => {
|
||||
this.tvRequests = this.transformData(x);
|
||||
});
|
||||
this.isAdmin = this.identityService.hasRole("Admin");
|
||||
}
|
||||
|
||||
private resetSearch() {
|
||||
|
|
|
@ -56,7 +56,8 @@ export class MovieSearchComponent implements OnInit, OnDestroy {
|
|||
this.movieResults = [];
|
||||
this.result = {
|
||||
message: "",
|
||||
requestAdded: false
|
||||
requestAdded: false,
|
||||
errorMessage: ""
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +80,9 @@ export class MovieSearchComponent implements OnInit, OnDestroy {
|
|||
this.notificationService.success("Request Added",
|
||||
`Request for ${searchResult.title} has been added successfully`);
|
||||
} else {
|
||||
this.notificationService.warning("Request Added", this.result.message);
|
||||
this.notificationService.warning("Request Added", this.result.message ? this.result.message : this.result.errorMessage);
|
||||
searchResult.requested = false;
|
||||
searchResult.approved = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -32,14 +32,14 @@
|
|||
<div class="form-group">
|
||||
<label for="ApiKey" class="control-label">Api Key</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control form-control-custom" id="ApiKey" name="ApiKey" formControlName="apiKey">
|
||||
<input type="text" class="form-control form-control-custom" id="ApiKey" name="ApiKey" formControlName="apiKey" readonly="readonly" #apiKey>
|
||||
|
||||
<div class="input-group-addon">
|
||||
<div (click)="refreshApiKey()" id="refreshKey" class="fa fa-refresh" title="Reset API Key" pTooltip="This will invalidate the old API key"></div>
|
||||
<div (click)="refreshApiKey()" id="refreshKey" class="fa fa-refresh" title="Reset API Key" pTooltip="This will invalidate the old API key" ></div>
|
||||
</div>
|
||||
|
||||
<div class="input-group-addon">
|
||||
<div class="fa fa-clipboard"></div>
|
||||
<div ngxClipboard [ngxClipboard]="apiKey" class="fa fa-clipboard" (cbOnSuccess)="successfullyCopied()"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -20,7 +20,7 @@ export class OmbiComponent implements OnInit {
|
|||
this.form = this.fb.group({
|
||||
port: [x.port],
|
||||
collectAnalyticData: [x.collectAnalyticData],
|
||||
apiKey: [{ value: x.apiKey, disabled: true }],
|
||||
apiKey: [x.apiKey],
|
||||
externalUrl: [x.externalUrl],
|
||||
allowExternalUsersToAuthenticate: [x.allowExternalUsersToAuthenticate]
|
||||
});
|
||||
|
@ -49,4 +49,8 @@ export class OmbiComponent implements OnInit {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
successfullyCopied() {
|
||||
this.notificationService.success("Copied", "Copied the Api Key to the clipboard!");
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ import { CommonModule } from '@angular/common';
|
|||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { NgbModule, NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { ClipboardModule } from 'ngx-clipboard/dist';
|
||||
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
import { AuthGuard } from '../auth/auth.guard';
|
||||
|
@ -27,9 +28,9 @@ import { PushoverComponent } from './notifications/pushover.component';
|
|||
import { PushbulletComponent } from './notifications/pushbullet.component';
|
||||
import { MattermostComponent } from './notifications/mattermost.component';
|
||||
import { NotificationTemplate } from './notifications/notificationtemplate.component';
|
||||
import { PipeModule } from '../pipes/pipe.module';
|
||||
|
||||
import { SettingsMenuComponent } from './settingsmenu.component';
|
||||
import { HumanizePipe } from '../pipes/HumanizePipe';
|
||||
|
||||
import { MenuModule, InputSwitchModule, InputTextModule, TooltipModule, AutoCompleteModule, CalendarModule } from 'primeng/primeng';
|
||||
|
||||
|
@ -65,6 +66,8 @@ const routes: Routes = [
|
|||
NgbAccordionModule,
|
||||
AutoCompleteModule,
|
||||
CalendarModule,
|
||||
ClipboardModule,
|
||||
PipeModule,
|
||||
],
|
||||
declarations: [
|
||||
SettingsMenuComponent,
|
||||
|
@ -78,7 +81,6 @@ const routes: Routes = [
|
|||
SlackComponent,
|
||||
RadarrComponent,
|
||||
EmailNotificationComponent,
|
||||
HumanizePipe,
|
||||
NotificationTemplate,
|
||||
PushoverComponent,
|
||||
MattermostComponent,
|
||||
|
|
|
@ -2,8 +2,15 @@
|
|||
<h3>Create User</h3>
|
||||
<button type="button" class="btn btn-primary-outline" style="float:right;" [routerLink]="['/usermanagement/']">Back</button>
|
||||
|
||||
|
||||
<div class="modal-body" style="margin-top:45px;">
|
||||
<div class="modal-body" style="margin-top: 45px;">
|
||||
<div class="col-md-6">
|
||||
<h4>User Details</h4>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h4>Roles</h4>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="username" class="control-label">Username</label>
|
||||
<div>
|
||||
|
@ -37,17 +44,23 @@
|
|||
<input type="password" [(ngModel)]="confirmPass" class="form-control form-control-custom " id="confirmPass" name="confirmPass">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div *ngFor="let c of availableClaims">
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" [(ngModel)]="c.enabled" [value]="c.value" id="create{{c.value}}" [attr.name]="'create' + c.value" ng-checked="c.enabled">
|
||||
<label for="create{{c.value}}">{{c.value}}</label>
|
||||
<label for="create{{c.value}}">{{c.value | humanize}}</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<button type="button" class="btn btn-danger-outline" (click)="create()">Create</button>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -28,7 +28,8 @@ export class UserManagementAddComponent implements OnInit {
|
|||
password: "",
|
||||
username: "",
|
||||
userType: UserType.LocalUser,
|
||||
checked:false
|
||||
checked:false,
|
||||
isSetup:false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,14 @@
|
|||
<button type="button" class="btn btn-primary-outline" style="float:right;" [routerLink]="['/usermanagement/']">Back</button>
|
||||
|
||||
|
||||
<div class="modal-body" style="margin-top:45px;">
|
||||
<div class="modal-body" style="margin-top: 45px;">
|
||||
<div class="col-md-6">
|
||||
<h4>User Details</h4>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h4>Roles</h4>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="username" class="control-label">Username</label>
|
||||
<div>
|
||||
|
@ -23,22 +30,24 @@
|
|||
<input type="text" [(ngModel)]="user.emailAddress" class="form-control form-control-custom " id="emailAddress" name="emailAddress" value="{{user?.emailAddress}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div *ngFor="let c of user.claims">
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" [(ngModel)]="c.enabled" [value]="c.value" id="create{{c.value}}" [attr.name]="'create' + c.value" ng-checked="c.enabled">
|
||||
<label for="create{{c.value}}">{{c.value}}</label>
|
||||
<label for="create{{c.value}}">{{c.value | humanize}}</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" class="btn btn-primary-outline" (click)="update()">Update</button>
|
||||
<button type="button" class="btn btn-danger-outline" (click)="delete()">Delete</button>
|
||||
<button type="button" style="float:right;" class="btn btn-info-outline" (click)="resetPassword()" pTooltip="You need your SMTP settings setup">Send Reset Password Link</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -41,6 +41,20 @@ export class UserManagementEditComponent {
|
|||
});
|
||||
}
|
||||
|
||||
resetPassword(): void {
|
||||
this.identityService.submitResetPassword(this.user.emailAddress).subscribe(x => {
|
||||
if (x.successful) {
|
||||
this.notificationSerivce.success("Reset", `Sent reset password email to ${this.user.emailAddress}`);
|
||||
this.router.navigate(['usermanagement']);
|
||||
} else {
|
||||
x.errors.forEach((val) => {
|
||||
this.notificationSerivce.error("Error", val);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
update(): void {
|
||||
var hasClaims = this.user.claims.some((item) => {
|
||||
if (item.enabled) { return true; }
|
||||
|
|
|
@ -82,6 +82,9 @@
|
|||
<td>
|
||||
<a [routerLink]="['/usermanagement/edit/' + u.id]" class="btn btn-sm btn-info-outline">Details/Edit</a>
|
||||
</td>
|
||||
<td *ngIf="!u.isSetup">
|
||||
<a (click)="welcomeEmail(u)" class="btn btn-sm btn-info-outline">Send Welcome Email</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -18,6 +18,10 @@ export class UserManagementComponent implements OnInit {
|
|||
|
||||
}
|
||||
|
||||
welcomeEmail(user: IUser): void {
|
||||
|
||||
}
|
||||
|
||||
users: IUser[];
|
||||
checkAll = false;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MultiSelectModule } from 'primeng/primeng';
|
||||
import { MultiSelectModule, TooltipModule, } from 'primeng/primeng';
|
||||
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
|
@ -12,6 +12,7 @@ import { UserManagementAddComponent } from './usermanagement-add.component';
|
|||
import { UpdateDetailsComponent } from './updatedetails.component';
|
||||
|
||||
import { IdentityService } from '../services/identity.service';
|
||||
import { PipeModule } from '../pipes/pipe.module';
|
||||
|
||||
import { AuthGuard } from '../auth/auth.guard';
|
||||
|
||||
|
@ -29,13 +30,16 @@ const routes: Routes = [
|
|||
ReactiveFormsModule,
|
||||
RouterModule.forChild(routes),
|
||||
NgbModule.forRoot(),
|
||||
MultiSelectModule
|
||||
MultiSelectModule,
|
||||
PipeModule,
|
||||
|
||||
TooltipModule,
|
||||
],
|
||||
declarations: [
|
||||
UserManagementComponent,
|
||||
UserManagementAddComponent,
|
||||
UserManagementEditComponent,
|
||||
UpdateDetailsComponent
|
||||
UpdateDetailsComponent,
|
||||
],
|
||||
exports: [
|
||||
RouterModule
|
||||
|
|
|
@ -23,7 +23,7 @@ export class CreateAdminComponent {
|
|||
this.identityService.createWizardUser(this.username, this.password).subscribe(x => {
|
||||
if (x) {
|
||||
// Log me in.
|
||||
this.auth.login({ username: this.username, password: this.password }).subscribe(c => {
|
||||
this.auth.login({ username: this.username, password: this.password, rememberMe:false }).subscribe(c => {
|
||||
|
||||
localStorage.setItem("id_token", c.access_token);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Ombi.Controllers
|
|||
/// Indexes this instance.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IActionResult> Index()
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
|
|
@ -172,6 +172,7 @@ namespace Ombi.Controllers
|
|||
EmailAddress = user.Email,
|
||||
UserType = (Core.Models.UserType)(int)user.UserType,
|
||||
Claims = new List<ClaimCheckboxes>(),
|
||||
IsSetup = !string.IsNullOrEmpty(user.PasswordHash)
|
||||
};
|
||||
|
||||
foreach (var role in userRoles)
|
||||
|
@ -428,6 +429,11 @@ namespace Ombi.Controllers
|
|||
return claims;
|
||||
}
|
||||
|
||||
//public async Task SendWelcomeEmail([FromBody] UserViewModel user)
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Send out the email with the reset link
|
||||
/// </summary>
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace Ombi.Controllers
|
|||
if (model.RememberMe)
|
||||
{
|
||||
// Save the token so we can refresh it later
|
||||
await _token.CreateToken(new Tokens() {Token = accessToken, User = user});
|
||||
//await _token.CreateToken(new Tokens() {Token = accessToken, User = user});
|
||||
}
|
||||
|
||||
return new JsonResult(new
|
||||
|
|
|
@ -77,4 +77,10 @@
|
|||
<ProjectReference Include="..\Ombi.Updater\Ombi.Updater.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="ClientApp\app\pipes\pipe.module.js">
|
||||
<DependentUpon>pipe.module.ts</DependentUpon>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -201,10 +201,10 @@ namespace Ombi
|
|||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
//app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
|
||||
//{
|
||||
// HotModuleReplacement = true
|
||||
//});
|
||||
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
|
||||
{
|
||||
HotModuleReplacement = true
|
||||
});
|
||||
}
|
||||
|
||||
app.UseHangfireServer();
|
||||
|
@ -255,10 +255,7 @@ namespace Ombi
|
|||
{
|
||||
public bool Authorize(DashboardContext context)
|
||||
{
|
||||
var httpContext = context.GetHttpContext();
|
||||
|
||||
// Allow all authenticated users to see the Dashboard (potentially dangerous).
|
||||
return httpContext.User.IsInRole(OmbiRoles.Admin);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
13
src/Ombi/package-lock.json
generated
13
src/Ombi/package-lock.json
generated
|
@ -3889,11 +3889,24 @@
|
|||
"dragula": "3.7.2"
|
||||
}
|
||||
},
|
||||
"ngx-clipboard": {
|
||||
"version": "8.0.4",
|
||||
"resolved": "https://registry.npmjs.org/ngx-clipboard/-/ngx-clipboard-8.0.4.tgz",
|
||||
"integrity": "sha1-l82jDXiOfcHSgONqdyj4ZgDEVf0=",
|
||||
"requires": {
|
||||
"ngx-window-token": "0.0.2"
|
||||
}
|
||||
},
|
||||
"ngx-infinite-scroll": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/ngx-infinite-scroll/-/ngx-infinite-scroll-0.5.1.tgz",
|
||||
"integrity": "sha1-3ZRSxgL/fDIi8MoWhIGqFBQChrc="
|
||||
},
|
||||
"ngx-window-token": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ngx-window-token/-/ngx-window-token-0.0.2.tgz",
|
||||
"integrity": "sha1-aA7phrvm+V0H2q3xVMDs815YmSA="
|
||||
},
|
||||
"no-case": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.1.tgz",
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
"intro.js-mit": "^3.0.0",
|
||||
"jquery": "3.2.1",
|
||||
"ng2-dragula": "1.5.0",
|
||||
"ngx-clipboard": "^8.0.4",
|
||||
"ngx-infinite-scroll": "^0.5.1",
|
||||
"node-sass": "^4.5.3",
|
||||
"npm": "^5.4.1",
|
||||
|
|
|
@ -48,6 +48,7 @@ module.exports = function (env) {
|
|||
'pace-progress/themes/orange/pace-theme-flash.css',
|
||||
'intro.js-mit/intro.js',
|
||||
'intro.js-mit/introjs.css',
|
||||
'ngx-clipboard',
|
||||
//'ng2-dragula',
|
||||
//'dragula/dist/dragula.min.css'
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue