mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Hide UI tour steps if user doesnt have permissions
This commit is contained in:
@@ -8,13 +8,15 @@ import {
|
||||
import { Injectable } from '@angular/core'
|
||||
import { PermissionsService } from '../services/permissions.service'
|
||||
import { ToastService } from '../services/toast.service'
|
||||
import { TourService } from 'ngx-ui-tour-ng-bootstrap'
|
||||
|
||||
@Injectable()
|
||||
export class PermissionsGuard implements CanActivate {
|
||||
constructor(
|
||||
private permissionsService: PermissionsService,
|
||||
private router: Router,
|
||||
private toastService: ToastService
|
||||
private toastService: ToastService,
|
||||
private tourService: TourService
|
||||
) {}
|
||||
|
||||
canActivate(
|
||||
@@ -27,9 +29,12 @@ export class PermissionsGuard implements CanActivate {
|
||||
route.data.requiredPermission.type
|
||||
)
|
||||
) {
|
||||
this.toastService.showError(
|
||||
$localize`You don't have permissions to do that`
|
||||
)
|
||||
// Check if tour is running 1 = TourState.ON
|
||||
if (this.tourService.getStatus() !== 1) {
|
||||
this.toastService.showError(
|
||||
$localize`You don't have permissions to do that`
|
||||
)
|
||||
}
|
||||
return this.router.parseUrl('/dashboard')
|
||||
} else {
|
||||
return true
|
||||
|
Reference in New Issue
Block a user