1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-24 12:06:15 +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); 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() { protected loadCollections() {
if (!this.organization.isAdmin) { if (!this.organization.isAdmin) {
return super.loadCollections(); return super.loadCollections();
@ -67,7 +78,7 @@ export class AddEditComponent extends BaseAddEditComponent {
} }
protected async saveCipher(cipher: Cipher) { protected async saveCipher(cipher: Cipher) {
if (!this.organization.isAdmin) { if (!this.organization.isAdmin || cipher.organizationId == null) {
return super.saveCipher(cipher); return super.saveCipher(cipher);
} }
if (this.editMode && !this.cloneMode) { if (this.editMode && !this.cloneMode) {

View File

@ -439,8 +439,7 @@
</select> </select>
</div> </div>
</div> </div>
<ng-container <ng-container *ngIf="allowOwnershipAssignment()">
*ngIf="(!editMode || cloneMode) && !organization && ownershipOptions && ownershipOptions.length > 1">
<h3 class="mt-4">{{'ownership' | i18n}}</h3> <h3 class="mt-4">{{'ownership' | i18n}}</h3>
<div class="row"> <div class="row">
<div class="col-5"> <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) { private async totpTick(intervalSeconds: number) {
const epoch = Math.round(new Date().getTime() / 1000.0); const epoch = Math.round(new Date().getTime() / 1000.0);
const mod = epoch % intervalSeconds; const mod = epoch % intervalSeconds;