1
0
mirror of https://github.com/bitwarden/web synced 2025-12-26 13:13:24 +00:00

Revert disableSendPolicy, add sendOptionsPolicy

This commit is contained in:
Thomas Rittson
2021-03-24 11:51:35 +10:00
parent 677fccab8c
commit 1d21279875
5 changed files with 63 additions and 22 deletions

View File

@@ -109,6 +109,13 @@ export class PoliciesComponent implements OnInit {
enabled: false,
display: true,
},
{
name: this.i18nService.t('sendOptions'),
description: this.i18nService.t('sendOptionsPolicyDesc'),
type: PolicyType.SendOptions,
enabled: false,
display: true,
},
];
await this.load();

View File

@@ -147,6 +147,16 @@
<label class="form-check-label" for="passGenIncludeNumber">{{'includeNumber' | i18n}}</label>
</div>
</ng-container>
<ng-container *ngIf="type === policyType.SendOptions">
<app-callout type="warning">
{{'sendOptionsExemption' | i18n}}
</app-callout>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="sendDisableHideEmail" [(ngModel)]="sendDisableHideEmail"
name="SendDisableHideEmail">
<label class="form-check-label" for="sendDisableHideEmail">{{'disableHideEmail' | i18n}}</label>
</div>
</ng-container>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading">

View File

@@ -12,7 +12,6 @@ import { Angulartics2 } from 'angulartics2';
import { ApiService } from 'jslib/abstractions/api.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { DisableSendType } from 'jslib/enums/disableSendType';
import { PolicyType } from 'jslib/enums/policyType';
import { PolicyRequest } from 'jslib/models/request/policyRequest';
@@ -61,6 +60,10 @@ export class PolicyEditComponent implements OnInit {
passGenCapitalize?: boolean;
passGenIncludeNumber?: boolean;
// Send options
sendDisableHideEmail?: boolean;
private policy: PolicyResponse;
constructor(private apiService: ApiService, private i18nService: I18nService,
@@ -114,6 +117,9 @@ export class PolicyEditComponent implements OnInit {
this.masterPassRequireNumbers = this.policy.data.requireNumbers;
this.masterPassRequireSpecial = this.policy.data.requireSpecial;
break;
case PolicyType.SendOptions:
this.sendDisableHideEmail = this.policy.data.disableHideEmail;
break;
default:
break;
}
@@ -160,6 +166,11 @@ export class PolicyEditComponent implements OnInit {
requireSpecial: this.masterPassRequireSpecial,
};
break;
case PolicyType.SendOptions:
request.data = {
disableHideEmail: this.sendDisableHideEmail,
};
break;
default:
break;
}

View File

@@ -9,15 +9,15 @@
</button>
</div>
<div class="modal-body" *ngIf="send">
<app-callout *ngIf="disableSend">
<span>{{(send.hideEmail && editMode && disableAnonymousSend ?
<app-callout *ngIf="disableThisSend">
<span>{{(send.hideEmail && editMode && disableHideEmailPolicy ?
'anonymousSendDisabledWarning' : 'sendDisabledWarning') | i18n}}</span>
</app-callout>
<div class="row">
<div class="col-6 form-group">
<label for="name">{{'name' | i18n}}</label>
<input id="name" class="form-control" type="text" name="Name" [(ngModel)]="send.name" required
[readOnly]="disableSend">
[readOnly]="disableThisSend">
<small class="form-text text-muted">{{'sendNameDesc' | i18n}}</small>
</div>
</div>
@@ -39,13 +39,13 @@
<div class="form-group">
<label for="text">{{'sendTypeText' | i18n}}</label>
<textarea id="text" name="Text.Text" rows="6" [(ngModel)]="send.text.text" class="form-control"
[readOnly]="disableSend"></textarea>
[readOnly]="disableThisSend"></textarea>
<small class="form-text text-muted">{{'sendTextDesc' | i18n}}</small>
</div>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" [(ngModel)]="send.text.hidden"
id="text-hidden" name="Text.Hidden" [disabled]="disableSend">
id="text-hidden" name="Text.Hidden" [disabled]="disableThisSend">
<label class="form-check-label" for="text-hidden">{{'textHiddenByDefault' | i18n}}</label>
</div>
</div>
@@ -60,7 +60,7 @@
<div *ngIf="!editMode">
<label for="file">{{'file' | i18n}}</label>
<input type="file" id="file" class="form-control-file" name="file" required
[disabled]="disableSend">
[disabled]="disableThisSend">
<small class="form-text text-muted">{{'sendFileDesc' | i18n}} {{'maxFileSize' |
i18n}}</small>
</div>
@@ -94,19 +94,19 @@
<ng-container *ngIf="isDateTimeLocalSupported">
<input id="deletionDateCustom" class="form-control mt-1" type="datetime-local"
name="DeletionDate" [(ngModel)]="deletionDate" required
placeholder="MM/DD/YYYY HH:MM AM/PM" [readOnly]="disableSend">
placeholder="MM/DD/YYYY HH:MM AM/PM" [readOnly]="disableThisSend">
</ng-container>
<div *ngIf="!isDateTimeLocalSupported" class="d-flex justify-content-around">
<input id="deletionDateCustomFallback" class="form-control mt-1" type="date"
name="DeletionDateFallback" [(ngModel)]="deletionDateFallback" required
placeholder="MM/DD/YYYY" [readOnly]="disableSend" data-date-format="mm/dd/yyyy">
placeholder="MM/DD/YYYY" [readOnly]="disableThisSend" data-date-format="mm/dd/yyyy">
<select *ngIf="isSafari" id="deletionTimeCustomFallback" class="form-control mt-1 ml-1" [required]="!editMode"
[(ngModel)]="safariDeletionTime" name="SafariDeletionTime">
<option *ngFor="let o of safariDeletionTimeOptions" [value]="o.military">{{o.standard}}</option>
</select>
<input *ngIf="!isSafari" id="deletionTimeCustomFallback" class="form-control mt-1 ml-1" type="time"
name="DeletionTimeDate" [(ngModel)]="deletionTimeFallback" required
placeholder="HH:MM AM/PM" [readOnly]="disableSend">
placeholder="HH:MM AM/PM" [readOnly]="disableThisSend">
</div>
</ng-template>
<div *ngIf="!editMode">
@@ -130,26 +130,26 @@
<div class="d-flex">
<label for="expirationDate">{{'expirationDate' | i18n}}</label>
<a href="#" appStopClick (click)="clearExpiration()" class="ml-auto"
*ngIf="editMode && !disableSend">
*ngIf="editMode && !disableThisSend">
{{'clear' | i18n}}
</a>
</div>
<ng-template #expirationDateCustom>
<ng-container *ngIf="isDateTimeLocalSupported">
<input id="expirationDateCustom" class="form-control mt-1" type="datetime-local"
name="ExpirationDate" [(ngModel)]="expirationDate" placeholder="MM/DD/YYYY HH:MM AM/PM" [readOnly]="disableSend">
name="ExpirationDate" [(ngModel)]="expirationDate" placeholder="MM/DD/YYYY HH:MM AM/PM" [readOnly]="disableThisSend">
</ng-container>
<div class="d-flex justify-content-around" *ngIf="!isDateTimeLocalSupported">
<input id="expirationDateCustomFallback" class="form-control mt-1" type="date"
name="ExpirationDateFallback" [(ngModel)]="expirationDateFallback" [required]="!editMode"
placeholder="MM/DD/YYYY" [readOnly]="disableSend" data-date-format="mm/dd/yyyy" (change)="expirationDateFallbackChanged()">
placeholder="MM/DD/YYYY" [readOnly]="disableThisSend" data-date-format="mm/dd/yyyy" (change)="expirationDateFallbackChanged()">
<select *ngIf="isSafari" id="expirationTimeCustomFallback" class="form-control mt-1 ml-1" [required]="!editMode"
[(ngModel)]="safariExpirationTime" name="SafariExpirationTime">
<option *ngFor="let o of safariExpirationTimeOptions" [ngValue]="o.military">{{o.standard}}</option>
</select>
<input *ngIf="!isSafari" id="expirationTimeCustomFallback" class="form-control mt-1 ml-1" type="time"
name="ExpirationTimeFallback" [(ngModel)]="expirationTimeFallback" [required]="!editMode"
placeholder="HH:MM AM/PM" [readOnly]="disableSend">
placeholder="HH:MM AM/PM" [readOnly]="disableThisSend">
</div>
</ng-template>
<div *ngIf="!editMode">
@@ -174,7 +174,7 @@
<div class="col-6 form-group">
<label for="maxAccessCount">{{'maxAccessCount' | i18n}}</label>
<input id="maxAccessCount" class="form-control" type="number" name="MaxAccessCount"
[(ngModel)]="send.maxAccessCount" min="1" [readOnly]="disableSend">
[(ngModel)]="send.maxAccessCount" min="1" [readOnly]="disableThisSend">
<div class="form-text text-muted small">{{'maxAccessCountDesc' | i18n}}</div>
</div>
<div class="col-6 form-group" *ngIf="editMode">
@@ -190,7 +190,7 @@
<div class="input-group">
<input id="password" class="form-control text-monospace"
type="{{showPassword ? 'text' : 'password'}}" name="Password" [(ngModel)]="password"
[readOnly]="disableSend">
[readOnly]="disableThisSend">
<div class="input-group-append">
<button type="button" class="btn btn-outline-secondary"
appA11yTitle="{{'toggleVisibility' | i18n}}" (click)="togglePasswordVisible()">
@@ -205,32 +205,32 @@
<div class="form-group">
<label for="notes">{{'notes' | i18n}}</label>
<textarea id="notes" name="Notes" rows="6" [(ngModel)]="send.notes" class="form-control"
[readOnly]="disableSend"></textarea>
[readOnly]="disableThisSend"></textarea>
<div class="form-text text-muted small">{{'sendNotesDesc' | i18n}}</div>
</div>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" [(ngModel)]="send.hideEmail" id="hideEmail"
name="HideEmail" [disabled]="disableAnonymousSend || disableSend">
name="HideEmail" [disabled]="disableHideEmailPolicy || disableThisSend">
<label class="form-check-label" for="hideEmail">
{{'hideEmail' | i18n}}<span *ngIf="disableAnonymousSend && !editMode" class="font-italic"> {{'anonymousSendDisabled' | i18n}}</span>
{{'hideEmail' | i18n}}<span *ngIf="disableHideEmailPolicy && !editMode" class="font-italic"> {{'anonymousSendDisabled' | i18n}}</span>
</label>
</div>
</div>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" [(ngModel)]="send.disabled" id="disabled"
name="Disabled" [disabled]="disableSend">
name="Disabled" [disabled]="disableThisSend">
<label class="form-check-label" for="disabled">{{'disableThisSend' | i18n}}</label>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary disabled" disabled=true *ngIf="disableSend">
<button class="btn btn-primary disabled" disabled=true *ngIf="disableThisSend">
<span>{{'save' | i18n}}</span>
</button>
<button type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading" *ngIf="!disableSend">
<button type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading" *ngIf="!disableThisSend">
<i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}" aria-hidden="true"></i>
<span>{{'save' | i18n}}</span>
</button>

View File

@@ -3642,6 +3642,19 @@
"message": "Due to an enterprise policy, you are only able to delete an existing Send that hides your email address. There are no restrictions on Sends that do not hide your email address.",
"description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated."
},
"sendOptions": {
"message": "Send Options"
},
"sendOptionsPolicyDesc": {
"message": "Set options for creating and editing Sends."
},
"sendOptionsExemption": {
"message": "Organization users that can manage the organization's policies are exempt from this policy's enforcement."
},
"disableHideEmail": {
"message": "Do not allow users to hide their email address when creating a Send.",
"description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated."
},
"modifiedPolicyId": {
"message": "Modified policy $ID$.",
"placeholders": {