1
0
mirror of https://github.com/bitwarden/web synced 2026-01-04 17:43:47 +00:00

org disabled and license expired warnings

This commit is contained in:
Kyle Spearrin
2018-08-01 16:51:25 -04:00
parent 12bdd87705
commit 6ed80eb6c9
7 changed files with 36 additions and 3 deletions

View File

@@ -5,11 +5,15 @@ import {
Router,
} from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { UserService } from 'jslib/abstractions/user.service';
@Injectable()
export class OrganizationGuardService implements CanActivate {
constructor(private userService: UserService, private router: Router) { }
constructor(private userService: UserService, private router: Router,
private toasterService: ToasterService, private i18nService: I18nService) { }
async canActivate(route: ActivatedRouteSnapshot) {
const org = await this.userService.getOrganization(route.params.organizationId);
@@ -17,6 +21,11 @@ export class OrganizationGuardService implements CanActivate {
this.router.navigate(['/']);
return false;
}
if (!org.isOwner && !org.enabled) {
this.toasterService.popAsync('error', null, this.i18nService.t('organizationIsDisabled'));
this.router.navigate(['/']);
return false;
}
return true;
}