mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
Set default ownership if Personal Ownership policy applies (#509)
This commit is contained in:
parent
bfa9a1e1bc
commit
64bc115109
@ -150,18 +150,21 @@ export class AddEditComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
const myEmail = await this.userService.getEmail();
|
if (await this.policyService.policyAppliesToUser(PolicyType.PersonalOwnership)) {
|
||||||
this.ownershipOptions.push({ name: myEmail, value: null });
|
this.allowPersonal = false;
|
||||||
|
} else {
|
||||||
|
const myEmail = await this.userService.getEmail();
|
||||||
|
this.ownershipOptions.push({ name: myEmail, value: null });
|
||||||
|
}
|
||||||
|
|
||||||
const orgs = await this.userService.getAllOrganizations();
|
const orgs = await this.userService.getAllOrganizations();
|
||||||
orgs.sort(Utils.getSortFunction(this.i18nService, 'name')).forEach(o => {
|
orgs.sort(Utils.getSortFunction(this.i18nService, 'name')).forEach(o => {
|
||||||
if (o.enabled && o.status === OrganizationUserStatusType.Confirmed) {
|
if (o.enabled && o.status === OrganizationUserStatusType.Confirmed) {
|
||||||
this.ownershipOptions.push({ name: o.name, value: o.id });
|
this.ownershipOptions.push({ name: o.name, value: o.id });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (!this.allowPersonal) {
|
||||||
if (this.allowPersonal && await this.policyService.policyAppliesToUser(PolicyType.PersonalOwnership)) {
|
this.organizationId = this.ownershipOptions[0].value;
|
||||||
this.allowPersonal = false;
|
|
||||||
this.ownershipOptions.splice(0, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writeableCollections = await this.loadCollections();
|
this.writeableCollections = await this.loadCollections();
|
||||||
|
Loading…
Reference in New Issue
Block a user