Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
Set default ownership if Personal Ownership policy applies (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
eliykat committed Oct 7, 2021
1 parent bfa9a1e commit 64bc115
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions angular/src/components/add-edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,21 @@ export class AddEditComponent implements OnInit {
}

async init() {
const myEmail = await this.userService.getEmail();
this.ownershipOptions.push({ name: myEmail, value: null });
if (await this.policyService.policyAppliesToUser(PolicyType.PersonalOwnership)) {
this.allowPersonal = false;
} else {
const myEmail = await this.userService.getEmail();
this.ownershipOptions.push({ name: myEmail, value: null });
}

const orgs = await this.userService.getAllOrganizations();
orgs.sort(Utils.getSortFunction(this.i18nService, 'name')).forEach(o => {
if (o.enabled && o.status === OrganizationUserStatusType.Confirmed) {
this.ownershipOptions.push({ name: o.name, value: o.id });
}
});

if (this.allowPersonal && await this.policyService.policyAppliesToUser(PolicyType.PersonalOwnership)) {
this.allowPersonal = false;
this.ownershipOptions.splice(0, 1);
if (!this.allowPersonal) {
this.organizationId = this.ownershipOptions[0].value;
}

this.writeableCollections = await this.loadCollections();
Expand Down

0 comments on commit 64bc115

Please sign in to comment.