1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

Add policy for disabling personal vault export (#1189)

This commit is contained in:
Oscar Hinton
2021-09-15 21:05:02 +02:00
committed by GitHub
parent 30d2aeb6a3
commit 7daba63c56
9 changed files with 69 additions and 13 deletions

View File

@@ -6,11 +6,10 @@ import { EventService } from 'jslib-common/abstractions/event.service';
import { ExportService } from 'jslib-common/abstractions/export.service';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { PolicyService } from 'jslib-common/abstractions/policy.service';
import { ExportComponent as BaseExportComponent } from '../../tools/export.component';
import { EventType } from 'jslib-common/enums/eventType';
@Component({
selector: 'app-org-export',
templateUrl: '../../tools/export.component.html',
@@ -18,16 +17,21 @@ import { EventType } from 'jslib-common/enums/eventType';
export class ExportComponent extends BaseExportComponent {
constructor(cryptoService: CryptoService, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, exportService: ExportService,
eventService: EventService, private route: ActivatedRoute) {
super(cryptoService, i18nService, platformUtilsService, exportService, eventService);
eventService: EventService, private route: ActivatedRoute, policyService: PolicyService) {
super(cryptoService, i18nService, platformUtilsService, exportService, eventService, policyService);
}
ngOnInit() {
async ngOnInit() {
await super.ngOnInit();
this.route.parent.parent.params.subscribe(async params => {
this.organizationId = params.organizationId;
});
}
async checkExportDisabled() {
return;
}
getExportData() {
return this.exportService.getOrganizationExport(this.organizationId, this.format);
}

View File

@@ -2,11 +2,16 @@
<div class="page-header">
<h1>{{'exportVault' | i18n}}</h1>
</div>
<app-callout type="error" title="{{'vaultExportDisabled' | i18n}}" *ngIf="disabledByPolicy">
{{'personalVaultExportPolicyInEffect' | i18n}}
</app-callout>
<p>{{'exportMasterPassword' | i18n}}</p>
<div class="row">
<div class="form-group col-6">
<label for="format">{{'fileFormat' | i18n}}</label>
<select class="form-control" id="format" name="Format" [(ngModel)]="format">
<select class="form-control" id="format" name="Format" [(ngModel)]="format" [disabled]="disabledByPolicy">
<option value="json">.json</option>
<option value="csv">.csv</option>
<option value="encrypted_json">.json (Encrypted)</option>
@@ -17,11 +22,11 @@
<div class="form-group col-6">
<label for="masterPassword">{{'masterPass' | i18n}}</label>
<input id="masterPassword" type="password" name="MasterPassword" class="form-control"
[(ngModel)]="masterPassword" required appInputVerbatim>
[(ngModel)]="masterPassword" required appInputVerbatim [disabled]="disabledByPolicy">
</div>
</div>
<button type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading">
<i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}" aria-hidden="true"></i>
<span>{{'exportVault' | i18n}}</span>
<button type="submit" class="btn btn-primary" [disabled]="form.loading || disabledByPolicy">
<i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}" aria-hidden="true" *ngIf="form.loading"></i>
<span *ngIf="!form.loading">{{'exportVault' | i18n}}</span>
</button>
</form>

View File

@@ -7,6 +7,7 @@ import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { ExportComponent as BaseExportComponent } from 'jslib-angular/components/export.component';
import { PolicyService } from 'jslib-common/abstractions/policy.service';
@Component({
selector: 'app-export',
@@ -17,8 +18,8 @@ export class ExportComponent extends BaseExportComponent {
constructor(cryptoService: CryptoService, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, exportService: ExportService,
eventService: EventService) {
super(cryptoService, i18nService, platformUtilsService, exportService, eventService, window);
eventService: EventService, policyService: PolicyService) {
super(cryptoService, i18nService, platformUtilsService, exportService, eventService, policyService, window);
}
protected saved() {

View File

@@ -4235,5 +4235,17 @@
},
"vaultTimeoutToLarge": {
"message": "Your vault timeout exceeds the restriction set by your organization."
},
"disablePersonalVaultExport": {
"message": "Disable Personal Vault Export"
},
"disablePersonalVaultExportDesc": {
"message": "Prohibits users from exporting their private vault data."
},
"vaultExportDisabled": {
"message": "Vault Export Disabled"
},
"personalVaultExportPolicyInEffect": {
"message": "One or more organization policies prevents you from exporting your personal vault."
}
}