mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-01 13:13:36 +01:00
[EC-203] Add logic for falling back to the users vault (#1688)
* Add logic for falling back to the users vault * Update error message * Add jira ticket
This commit is contained in:
parent
30057d2ac4
commit
7b55c8ad1a
@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { ActivatedRouteSnapshot, CanActivate, Router } from "@angular/router";
|
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from "@angular/router";
|
||||||
|
|
||||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { OrganizationService } from "jslib-common/abstractions/organization.service";
|
import { OrganizationService } from "jslib-common/abstractions/organization.service";
|
||||||
@ -17,7 +17,7 @@ export class PermissionsGuard implements CanActivate {
|
|||||||
private syncService: SyncService
|
private syncService: SyncService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async canActivate(route: ActivatedRouteSnapshot) {
|
async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
||||||
// TODO: We need to fix this issue once and for all.
|
// TODO: We need to fix this issue once and for all.
|
||||||
if ((await this.syncService.getLastSync()) == null) {
|
if ((await this.syncService.getLastSync()) == null) {
|
||||||
await this.syncService.fullSync(false);
|
await this.syncService.fullSync(false);
|
||||||
@ -39,6 +39,16 @@ export class PermissionsGuard implements CanActivate {
|
|||||||
|
|
||||||
const permissions = route.data == null ? [] : (route.data.permissions as Permissions[]);
|
const permissions = route.data == null ? [] : (route.data.permissions as Permissions[]);
|
||||||
if (permissions != null && !org.hasAnyPermission(permissions)) {
|
if (permissions != null && !org.hasAnyPermission(permissions)) {
|
||||||
|
// Handle linkable ciphers for organizations the user only has view access to
|
||||||
|
// https://bitwarden.atlassian.net/browse/EC-203
|
||||||
|
if (state.root.queryParamMap.has("cipherId")) {
|
||||||
|
return this.router.createUrlTree(["/vault"], {
|
||||||
|
queryParams: {
|
||||||
|
cipherId: state.root.queryParamMap.get("cipherId"),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.platformUtilsService.showToast("error", null, this.i18nService.t("accessDenied"));
|
this.platformUtilsService.showToast("error", null, this.i18nService.t("accessDenied"));
|
||||||
return this.router.createUrlTree(["/"]);
|
return this.router.createUrlTree(["/"]);
|
||||||
}
|
}
|
||||||
|
@ -5005,7 +5005,7 @@
|
|||||||
"message": "Service"
|
"message": "Service"
|
||||||
},
|
},
|
||||||
"unknownCipher": {
|
"unknownCipher": {
|
||||||
"message": "Unknown Item, you may need to login with another account to access this item."
|
"message": "Unknown Item, you may need to request permission to access this item."
|
||||||
},
|
},
|
||||||
"cannotSponsorSelf": {
|
"cannotSponsorSelf": {
|
||||||
"message": "You cannot redeem for the active account. Enter a different email."
|
"message": "You cannot redeem for the active account. Enter a different email."
|
||||||
|
Loading…
Reference in New Issue
Block a user