Remove ng2 file upload module
[oweals/peertube.git] / client / src / app / +admin / admin-guard.service.ts
1 import { Injectable } from '@angular/core'
2 import {
3   ActivatedRouteSnapshot,
4   CanActivateChild,
5   RouterStateSnapshot,
6   CanActivate
7 } from '@angular/router'
8
9 import { AuthService } from '../core'
10
11 @Injectable()
12 export class AdminGuard implements CanActivate, CanActivateChild {
13
14   constructor (private auth: AuthService) {}
15
16   canActivate (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
17     return this.auth.isAdmin()
18   }
19
20   canActivateChild (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
21     return this.canActivate(route, state)
22   }
23 }