From dee2abcb382aa262293cffa086f0775f01269f48 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sat, 22 May 2021 23:05:32 +0100 Subject: [PATCH] Added the ability for the admin to be able to copy the app link to send to users that have the app installed so they can automatically be authenticated --- .../usermanagement-user.component.html | 5 ++-- .../usermanagement-user.component.ts | 26 ++++++++++++++----- .../usermanagement/usermanagement.module.ts | 26 ++++++++----------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.html b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.html index 74770a3d8..e247f0ea1 100644 --- a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.html +++ b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.html @@ -145,13 +145,14 @@
-
+
- +
diff --git a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts index bfbabd0a3..c091d3861 100644 --- a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts +++ b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts @@ -1,9 +1,10 @@ -import { Location } from "@angular/common"; -import { AfterViewInit, Component, OnInit } from "@angular/core"; -import { ActivatedRoute, Router } from "@angular/router"; +import { ActivatedRoute, Router } from "@angular/router"; +import { Component, OnInit } from "@angular/core"; +import { ICheckbox, ICustomizationSettings, INotificationAgent, INotificationPreferences, IRadarrProfile, IRadarrRootFolder, ISonarrProfile, ISonarrRootFolder, IUser, UserType } from "../interfaces"; +import { IdentityService, MessageService, RadarrService, SettingsService, SonarrService } from "../services"; -import { ICheckbox, INotificationAgent, INotificationPreferences, IRadarrProfile, IRadarrRootFolder, ISonarrProfile, ISonarrRootFolder, IUser, UserType } from "../interfaces"; -import { IdentityService, RadarrService, SonarrService, MessageService } from "../services"; +import { Clipboard } from '@angular/cdk/clipboard'; +import { Location } from "@angular/common"; @Component({ templateUrl: "./usermanagement-user.component.html", @@ -27,12 +28,17 @@ export class UserManagementUserComponent implements OnInit { public countries: string[]; + private customization: ICustomizationSettings; + private accessToken: string; + constructor(private identityService: IdentityService, private notificationService: MessageService, + private readonly settingsService: SettingsService, private router: Router, private route: ActivatedRoute, private sonarrService: SonarrService, private radarrService: RadarrService, + private clipboard: Clipboard, private location: Location) { this.route.params.subscribe((params: any) => { @@ -60,6 +66,9 @@ export class UserManagementUserComponent implements OnInit { this.radarrService.getQualityProfilesFromSettings().subscribe(x => this.radarrQualities = x); this.radarrService.getRootFoldersFromSettings().subscribe(x => this.radarrRootFolders = x); + this.settingsService.getCustomization().subscribe(x => this.customization = x); + this.identityService.getAccessToken().subscribe(x => this.accessToken = x); + if(!this.edit) { this.user = { alias: "", @@ -178,7 +187,12 @@ export class UserManagementUserComponent implements OnInit { } }); } - + + public async appLink() { + this.clipboard.copy(`ombi://${this.customization.applicationUrl}|${this.accessToken}`); + this.notificationService.send("Copied!"); + } + public back() { this.location.back(); } diff --git a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement.module.ts b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement.module.ts index 885e6e2e4..a55702101 100644 --- a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement.module.ts +++ b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement.module.ts @@ -1,23 +1,19 @@ -import { CommonModule } from "@angular/common"; -import { NgModule } from "@angular/core"; -import { FormsModule, ReactiveFormsModule } from "@angular/forms"; -import { RouterModule, Routes } from "@angular/router"; -import { ConfirmDialogModule } from "primeng/confirmdialog"; -import { MultiSelectModule } from "primeng/multiselect"; -import { SidebarModule } from "primeng/sidebar"; -import { TooltipModule } from "primeng/tooltip"; - -import { UserManagementUserComponent } from "./usermanagement-user.component"; -import { UserManagementComponent } from "./usermanagement.component"; - -import { PipeModule } from "../pipes/pipe.module"; +import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { IdentityService, PlexService, RadarrService, SonarrService } from "../services"; +import { RouterModule, Routes } from "@angular/router"; import { AuthGuard } from "../auth/auth.guard"; - +import { CommonModule } from "@angular/common"; +import { ConfirmDialogModule } from "primeng/confirmdialog"; +import { MultiSelectModule } from "primeng/multiselect"; +import { NgModule } from "@angular/core"; import { OrderModule } from "ngx-order-pipe"; - +import { PipeModule } from "../pipes/pipe.module"; import { SharedModule } from "../shared/shared.module"; +import { SidebarModule } from "primeng/sidebar"; +import { TooltipModule } from "primeng/tooltip"; +import { UserManagementComponent } from "./usermanagement.component"; +import { UserManagementUserComponent } from "./usermanagement-user.component"; const routes: Routes = [ { path: "", component: UserManagementComponent, canActivate: [AuthGuard] },