mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-23 06:25:24 -07:00
Hide delete request option if user is not allowed
This commit is contained in:
parent
a502a7953c
commit
c02770a348
4 changed files with 16 additions and 7 deletions
|
@ -60,7 +60,7 @@
|
|||
<th mat-header-cell *matHeaderCellDef> </th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<button mat-raised-button color="accent" [routerLink]="'/details/artist/' + element.foreignArtistId">{{ 'Requests.Details' | translate}}</button>
|
||||
<button mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin || manageOwnRequests"> {{ 'Requests.Options' | translate}}</button>
|
||||
<button mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin || ( manageOwnRequests && element.requestedUser?.userName == userName )"> {{ 'Requests.Options' | translate}}</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import { RequestServiceV2 } from "../../../services/requestV2.service";
|
|||
import { AuthService } from "../../../auth/auth.service";
|
||||
import { StorageService } from "../../../shared/storage/storage-service";
|
||||
import { RequestFilterType } from "../../models/RequestFilterType";
|
||||
import { IdentityService } from "../../../services";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./albums-grid.component.html",
|
||||
|
@ -26,6 +27,7 @@ export class AlbumsGridComponent implements OnInit, AfterViewInit {
|
|||
public defaultOrder: string = "desc";
|
||||
public currentFilter: RequestFilterType = RequestFilterType.All;
|
||||
public manageOwnRequests: boolean;
|
||||
public userName: string;
|
||||
|
||||
public RequestFilter = RequestFilterType;
|
||||
|
||||
|
@ -41,8 +43,11 @@ export class AlbumsGridComponent implements OnInit, AfterViewInit {
|
|||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
constructor(private requestService: RequestServiceV2, private ref: ChangeDetectorRef,
|
||||
private auth: AuthService, private storageService: StorageService) {
|
||||
private auth: AuthService, private storageService: StorageService, private identity: IdentityService) {
|
||||
|
||||
identity.getUser().subscribe(u => {
|
||||
this.userName = u.userName;
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnInit() {
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
<th mat-header-cell *matHeaderCellDef> </th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<button id="detailsButton{{element.id}}" mat-raised-button color="accent" [routerLink]="'/details/movie/' + element.theMovieDbId">{{ 'Requests.Details' | translate}}</button>
|
||||
<button id="optionsButton{{element.id}}" mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin || manageOwnRequests"> {{ 'Requests.Options' | translate}}</button>
|
||||
<button id="optionsButton{{element.id}}" mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin || ( manageOwnRequests && element.requestedUser?.userName == userName ) "> {{ 'Requests.Options' | translate}}</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { AfterViewInit, ChangeDetectorRef, Component, EventEmitter, OnInit, Output, ViewChild } from "@angular/core";
|
||||
import { IMovieRequests, IRequestEngineResult, IRequestsViewModel } from "../../../interfaces";
|
||||
import { NotificationService, RequestService } from "../../../services";
|
||||
import { IdentityService, NotificationService, RequestService } from "../../../services";
|
||||
import { Observable, forkJoin, merge, of as observableOf } from 'rxjs';
|
||||
import { catchError, map, startWith, switchMap } from 'rxjs/operators';
|
||||
|
||||
|
@ -31,6 +31,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
|
|||
public defaultOrder: string = "desc";
|
||||
public currentFilter: RequestFilterType = RequestFilterType.All;
|
||||
public selection = new SelectionModel<IMovieRequests>(true, []);
|
||||
public userName: string;
|
||||
|
||||
public RequestFilter = RequestFilterType;
|
||||
|
||||
|
@ -46,10 +47,13 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
|
|||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
constructor(private requestService: RequestServiceV2, private ref: ChangeDetectorRef,
|
||||
private auth: AuthService, private storageService: StorageService,
|
||||
private requestServiceV1: RequestService, private notification: NotificationService,
|
||||
private translateService: TranslateService) {
|
||||
private auth: AuthService, private storageService: StorageService,
|
||||
private requestServiceV1: RequestService, private notification: NotificationService,
|
||||
private translateService: TranslateService, private identity: IdentityService) {
|
||||
|
||||
identity.getUser().subscribe(u => {
|
||||
this.userName = u.userName;
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnInit() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue