-
Notifications
You must be signed in to change notification settings - Fork 403
Refactor orgnaization policy management #1147
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oscar I think this looks great and is a good refactor for our policies pattern. I'll let one other person on the team take a look and see if I missed anything as far as implementation details or technicalities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question and some minor feedback. Looks great, Oscar!
this.policyListService.addPolicies([ | ||
new TwoFactorAuthenticationPolicy(), | ||
new MasterPasswordPolicy(), | ||
new PasswordGeneratorPolicy(), | ||
new SingleOrgPolicy(), | ||
new RequireSsoPolicy(), | ||
new PersonalOwnershipPolicy(), | ||
new DisableSendPolicy(), | ||
new SendOptionsPolicy(), | ||
new ResetPasswordPolicy(), | ||
]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you weren't happy about loading policies here, but I think it's perfect besides being in app.component. We get clear control and vision on what policies are supported & the addPolicies call taking an array is pretty clean.
Just curious, could we not populate the service in policies.component? What about in a constructor for the policy list service?
|
||
<div class="modal-body"> | ||
<div class="modal-body" *ngIf="loading"> | ||
<i class="fa fa-spinner fa-spin text-muted" title="{{'loading' | i18n}}" aria-hidden="true"></i> | ||
<span class="sr-only">{{'loading' | i18n}}</span> | ||
</div> | ||
<div [hidden]="loading"> | ||
<p>{{policy.description | i18n}}</p> | ||
<ng-template #policyForm></ng-template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hooray for organized html 🥳
Boolean-toggle enterprise policies (like 'Two-Step Login' and 'Personal Ownership') don't provide a data attribute in the new version of the web client. This updates the backend to expect these to be optional. Web change introduced in bitwarden/web#1147 which added https://github.com/bitwarden/web/blob/2cbe023a38792ff70a2a4907f4748354bb4e0573/src/app/organizations/policies/base-policy.component.ts#L48-L50
Objective
Refactors the policy management page for organizations. Instead of having a single component
PolicyEditComponent
containing a multitude of if statements, we now have aBasePolicy
andBasePolicyComponent
which encapsulates a single Policy. ThePoliciesComponents
displays a list of components which it retrives from thePolicyListService
, andPolicyEditComponent
lets theBasePolicyComponent
handle the policy specific details.I've also removed the deprecation warning for policies since it's no longer accurate.
Noteworthy Code Changes
componentFactoryResolver
.Testing Considerations
Since this PR does some drastic changes to the policy management pages, we will have to do a full regression surrounding it.
Asana: https://app.asana.com/0/1198901840263430/1200796078487139