mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
stub out policies management page
This commit is contained in:
parent
4de7b52044
commit
a2472e0cf5
@ -24,6 +24,7 @@ import { EventsComponent as OrgEventsComponent } from './organizations/manage/ev
|
|||||||
import { GroupsComponent as OrgGroupsComponent } from './organizations/manage/groups.component';
|
import { GroupsComponent as OrgGroupsComponent } from './organizations/manage/groups.component';
|
||||||
import { ManageComponent as OrgManageComponent } from './organizations/manage/manage.component';
|
import { ManageComponent as OrgManageComponent } from './organizations/manage/manage.component';
|
||||||
import { PeopleComponent as OrgPeopleComponent } from './organizations/manage/people.component';
|
import { PeopleComponent as OrgPeopleComponent } from './organizations/manage/people.component';
|
||||||
|
import { PoliciesComponent as OrgPoliciesComponent } from './organizations/manage/policies.component';
|
||||||
|
|
||||||
import { AccountComponent as OrgAccountComponent } from './organizations/settings/account.component';
|
import { AccountComponent as OrgAccountComponent } from './organizations/settings/account.component';
|
||||||
import { OrganizationBillingComponent } from './organizations/settings/organization-billing.component';
|
import { OrganizationBillingComponent } from './organizations/settings/organization-billing.component';
|
||||||
@ -264,6 +265,7 @@ const routes: Routes = [
|
|||||||
{ path: 'events', component: OrgEventsComponent, data: { titleId: 'eventLogs' } },
|
{ path: 'events', component: OrgEventsComponent, data: { titleId: 'eventLogs' } },
|
||||||
{ path: 'groups', component: OrgGroupsComponent, data: { titleId: 'groups' } },
|
{ path: 'groups', component: OrgGroupsComponent, data: { titleId: 'groups' } },
|
||||||
{ path: 'people', component: OrgPeopleComponent, data: { titleId: 'people' } },
|
{ path: 'people', component: OrgPeopleComponent, data: { titleId: 'people' } },
|
||||||
|
{ path: 'policies', component: OrgPoliciesComponent, data: { titleId: 'policies' } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -51,6 +51,7 @@ import { GroupAddEditComponent as OrgGroupAddEditComponent } from './organizatio
|
|||||||
import { GroupsComponent as OrgGroupsComponent } from './organizations/manage/groups.component';
|
import { GroupsComponent as OrgGroupsComponent } from './organizations/manage/groups.component';
|
||||||
import { ManageComponent as OrgManageComponent } from './organizations/manage/manage.component';
|
import { ManageComponent as OrgManageComponent } from './organizations/manage/manage.component';
|
||||||
import { PeopleComponent as OrgPeopleComponent } from './organizations/manage/people.component';
|
import { PeopleComponent as OrgPeopleComponent } from './organizations/manage/people.component';
|
||||||
|
import { PoliciesComponent as OrgPoliciesComponent } from './organizations/manage/policies.component';
|
||||||
import { UserAddEditComponent as OrgUserAddEditComponent } from './organizations/manage/user-add-edit.component';
|
import { UserAddEditComponent as OrgUserAddEditComponent } from './organizations/manage/user-add-edit.component';
|
||||||
import { UserConfirmComponent as OrgUserConfirmComponent } from './organizations/manage/user-confirm.component';
|
import { UserConfirmComponent as OrgUserConfirmComponent } from './organizations/manage/user-confirm.component';
|
||||||
import { UserGroupsComponent as OrgUserGroupsComponent } from './organizations/manage/user-groups.component';
|
import { UserGroupsComponent as OrgUserGroupsComponent } from './organizations/manage/user-groups.component';
|
||||||
@ -311,6 +312,7 @@ registerLocaleData(localeZhTw, 'zh-TW');
|
|||||||
OrgManageCollectionsComponent,
|
OrgManageCollectionsComponent,
|
||||||
OrgManageComponent,
|
OrgManageComponent,
|
||||||
OrgPeopleComponent,
|
OrgPeopleComponent,
|
||||||
|
OrgPoliciesComponent,
|
||||||
OrgReusedPasswordsReportComponent,
|
OrgReusedPasswordsReportComponent,
|
||||||
OrgRotateApiKeyComponent,
|
OrgRotateApiKeyComponent,
|
||||||
OrgSettingComponent,
|
OrgSettingComponent,
|
||||||
|
20
src/app/organizations/manage/policies.component.html
Normal file
20
src/app/organizations/manage/policies.component.html
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<div class="page-header d-flex">
|
||||||
|
<h1>{{'policies' | i18n}}</h1>
|
||||||
|
</div>
|
||||||
|
<ng-container *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>
|
||||||
|
</ng-container>
|
||||||
|
<table class="table table-hover table-list">
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let p of policies">
|
||||||
|
<td>
|
||||||
|
<a href="#">{{p.name}}</a>
|
||||||
|
</td>
|
||||||
|
<td class="table-list-options">
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<ng-template #edit></ng-template>
|
96
src/app/organizations/manage/policies.component.ts
Normal file
96
src/app/organizations/manage/policies.component.ts
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
import {
|
||||||
|
Component,
|
||||||
|
ComponentFactoryResolver,
|
||||||
|
OnInit,
|
||||||
|
ViewChild,
|
||||||
|
ViewContainerRef,
|
||||||
|
} from '@angular/core';
|
||||||
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
|
|
||||||
|
import { ToasterService } from 'angular2-toaster';
|
||||||
|
import { Angulartics2 } from 'angulartics2';
|
||||||
|
|
||||||
|
import { ApiService } from 'jslib/abstractions/api.service';
|
||||||
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||||
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||||
|
import { UserService } from 'jslib/abstractions/user.service';
|
||||||
|
|
||||||
|
import { PolicyResponse } from 'jslib/models/response/policyResponse';
|
||||||
|
|
||||||
|
import { Utils } from 'jslib/misc/utils';
|
||||||
|
|
||||||
|
import { ModalComponent } from '../../modal.component';
|
||||||
|
import { EntityUsersComponent } from './entity-users.component';
|
||||||
|
import { GroupAddEditComponent } from './group-add-edit.component';
|
||||||
|
|
||||||
|
import { PolicyType } from 'jslib/enums/policyType';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-org-policies',
|
||||||
|
templateUrl: 'policies.component.html',
|
||||||
|
})
|
||||||
|
export class PoliciesComponent implements OnInit {
|
||||||
|
@ViewChild('edit', { read: ViewContainerRef }) editModalRef: ViewContainerRef;
|
||||||
|
|
||||||
|
loading = true;
|
||||||
|
organizationId: string;
|
||||||
|
policies: any[];
|
||||||
|
|
||||||
|
private modal: ModalComponent = null;
|
||||||
|
private orgPolicies: PolicyResponse[];
|
||||||
|
private policiesEnabledMap: Map<PolicyType, boolean> = new Map<PolicyType, boolean>();
|
||||||
|
|
||||||
|
constructor(private apiService: ApiService, private route: ActivatedRoute,
|
||||||
|
private i18nService: I18nService, private componentFactoryResolver: ComponentFactoryResolver,
|
||||||
|
private analytics: Angulartics2, private toasterService: ToasterService,
|
||||||
|
private platformUtilsService: PlatformUtilsService, private userService: UserService,
|
||||||
|
private router: Router) {
|
||||||
|
this.policies = [
|
||||||
|
{
|
||||||
|
name: 'Two-step Login',
|
||||||
|
description: 'vbxcvbxvcbxc',
|
||||||
|
type: PolicyType.TwoFactorAuthentication,
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Master Password',
|
||||||
|
description: 'vbxcvb',
|
||||||
|
type: PolicyType.MasterPassword,
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Password Generator',
|
||||||
|
description: 'rye5tbfgdbfghj',
|
||||||
|
type: PolicyType.PasswordGenerator,
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
async ngOnInit() {
|
||||||
|
this.route.parent.parent.params.subscribe(async (params) => {
|
||||||
|
this.organizationId = params.organizationId;
|
||||||
|
const organization = await this.userService.getOrganization(this.organizationId);
|
||||||
|
if (organization == null || !organization.usePolicies) {
|
||||||
|
this.router.navigate(['/organizations', this.organizationId]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await this.load();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async load() {
|
||||||
|
const response = await this.apiService.getPolicies(this.organizationId);
|
||||||
|
this.orgPolicies = response.data != null && response.data.length > 0 ? response.data : [];
|
||||||
|
this.orgPolicies.forEach((op) => {
|
||||||
|
this.policiesEnabledMap.set(op.type, op.enabled);
|
||||||
|
});
|
||||||
|
this.policies.forEach((p) => {
|
||||||
|
p.enabled = this.policiesEnabledMap.has(p.type) && this.policiesEnabledMap.get(p.type);
|
||||||
|
});
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user