1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-29 12:55:21 +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:
Oscar Hinton 2022-05-17 18:46:42 +02:00 committed by GitHub
parent 30057d2ac4
commit 7b55c8ad1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -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(["/"]);
} }

View File

@ -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."