1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-27 17:18:04 +01:00

Allow organizational admins to assign clone ownership (#458)

This commit is contained in:
Vincent Salucci 2020-02-12 15:11:38 -06:00 committed by GitHub
parent 6ed991593a
commit b7cd18b715
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View File

@ -42,6 +42,17 @@ export class AddEditComponent extends BaseAddEditComponent {
eventService);
}
protected allowOwnershipAssignment() {
if (this.ownershipOptions != null && this.ownershipOptions.length > 1) {
if (this.organization != null) {
return this.cloneMode && this.organization.isAdmin;
} else {
return !this.editMode || this.cloneMode;
}
}
return false;
}
protected loadCollections() {
if (!this.organization.isAdmin) {
return super.loadCollections();
@ -67,7 +78,7 @@ export class AddEditComponent extends BaseAddEditComponent {
}
protected async saveCipher(cipher: Cipher) {
if (!this.organization.isAdmin) {
if (!this.organization.isAdmin || cipher.organizationId == null) {
return super.saveCipher(cipher);
}
if (this.editMode && !this.cloneMode) {

View File

@ -439,8 +439,7 @@
</select>
</div>
</div>
<ng-container
*ngIf="(!editMode || cloneMode) && !organization && ownershipOptions && ownershipOptions.length > 1">
<ng-container *ngIf="allowOwnershipAssignment()">
<h3 class="mt-4">{{'ownership' | i18n}}</h3>
<div class="row">
<div class="col-5">

View File

@ -154,6 +154,10 @@ export class AddEditComponent extends BaseAddEditComponent {
}
}
protected allowOwnershipAssignment() {
return (!this.editMode || this.cloneMode) && this.ownershipOptions != null && this.ownershipOptions.length > 1;
}
private async totpTick(intervalSeconds: number) {
const epoch = Math.round(new Date().getTime() / 1000.0);
const mod = epoch % intervalSeconds;