1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-06 18:57:56 +01:00

add basic org manager access and UI elements

This commit is contained in:
Kyle Spearrin 2018-10-17 10:53:04 -04:00
parent 1aa93e7737
commit 668271bb31
10 changed files with 45 additions and 14 deletions

2
jslib

@ -1 +1 @@
Subproject commit 2f6426deb470b71838b51c52587929ac64d428bf Subproject commit 00efae261684eb97e7fcd8fd77aa04bca5e87a72

View File

@ -174,7 +174,13 @@ const routes: Routes = [
path: 'manage', path: 'manage',
component: OrgManageComponent, component: OrgManageComponent,
canActivate: [OrganizationTypeGuardService], canActivate: [OrganizationTypeGuardService],
data: { allowedTypes: [OrganizationUserType.Owner, OrganizationUserType.Admin] }, data: {
allowedTypes: [
OrganizationUserType.Owner,
OrganizationUserType.Admin,
OrganizationUserType.Manager,
]
},
children: [ children: [
{ path: '', pathMatch: 'full', redirectTo: 'people' }, { path: '', pathMatch: 'full', redirectTo: 'people' },
{ path: 'collections', component: OrgManageCollectionsComponent, data: { titleId: 'collections' } }, { path: 'collections', component: OrgManageCollectionsComponent, data: { titleId: 'collections' } },

View File

@ -14,7 +14,7 @@
</div> </div>
</div> </div>
</div> </div>
<ul class="nav nav-tabs" *ngIf="organization.isAdmin"> <ul class="nav nav-tabs" *ngIf="organization.isManager">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" routerLink="vault" routerLinkActive="active"> <a class="nav-link" routerLink="vault" routerLinkActive="active">
<i class="fa fa-lock"></i> <i class="fa fa-lock"></i>
@ -27,7 +27,7 @@
{{'manage' | i18n}} {{'manage' | i18n}}
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item" *ngIf="organization.isAdmin">
<a class="nav-link" routerLink="tools" routerLinkActive="active"> <a class="nav-link" routerLink="tools" routerLinkActive="active">
<i class="fa fa-wrench"></i> <i class="fa fa-wrench"></i>
{{'tools' | i18n}} {{'tools' | i18n}}

View File

@ -36,6 +36,7 @@
<td> <td>
<span *ngIf="u.type === organizationUserType.Owner">{{'owner' | i18n}}</span> <span *ngIf="u.type === organizationUserType.Owner">{{'owner' | i18n}}</span>
<span *ngIf="u.type === organizationUserType.Admin">{{'admin' | i18n}}</span> <span *ngIf="u.type === organizationUserType.Admin">{{'admin' | i18n}}</span>
<span *ngIf="u.type === organizationUserType.Manager">{{'manager' | i18n}}</span>
<span *ngIf="u.type === organizationUserType.User">{{'user' | i18n}}</span> <span *ngIf="u.type === organizationUserType.User">{{'user' | i18n}}</span>
</td> </td>
<td class="table-list-options wider"> <td class="table-list-options wider">

View File

@ -4,16 +4,16 @@
<div class="card"> <div class="card">
<div class="card-header">{{'manage' | i18n}}</div> <div class="card-header">{{'manage' | i18n}}</div>
<div class="list-group list-group-flush"> <div class="list-group list-group-flush">
<a routerLink="people" class="list-group-item" routerLinkActive="active"> <a routerLink="people" class="list-group-item" routerLinkActive="active" *ngIf="organization.isAdmin">
{{'people' | i18n}} {{'people' | i18n}}
</a> </a>
<a routerLink="collections" class="list-group-item" routerLinkActive="active"> <a routerLink="collections" class="list-group-item" routerLinkActive="active">
{{'collections' | i18n}} {{'collections' | i18n}}
</a> </a>
<a routerLink="groups" class="list-group-item" routerLinkActive="active" *ngIf="accessGroups"> <a routerLink="groups" class="list-group-item" routerLinkActive="active" *ngIf="organization.isAdmin && accessGroups">
{{'groups' | i18n}} {{'groups' | i18n}}
</a> </a>
<a routerLink="events" class="list-group-item" routerLinkActive="active" *ngIf="accessEvents"> <a routerLink="events" class="list-group-item" routerLinkActive="active" *ngIf="organization.isAdmin && accessEvents">
{{'eventLogs' | i18n}} {{'eventLogs' | i18n}}
</a> </a>
</div> </div>

View File

@ -6,11 +6,14 @@ import { ActivatedRoute } from '@angular/router';
import { UserService } from 'jslib/abstractions/user.service'; import { UserService } from 'jslib/abstractions/user.service';
import { Organization } from 'jslib/models/domain/organization';
@Component({ @Component({
selector: 'app-org-manage', selector: 'app-org-manage',
templateUrl: 'manage.component.html', templateUrl: 'manage.component.html',
}) })
export class ManageComponent implements OnInit { export class ManageComponent implements OnInit {
organization: Organization;
accessGroups = false; accessGroups = false;
accessEvents = false; accessEvents = false;
@ -18,9 +21,9 @@ export class ManageComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.route.parent.params.subscribe(async (params) => { this.route.parent.params.subscribe(async (params) => {
const organization = await this.userService.getOrganization(params.organizationId); this.organization = await this.userService.getOrganization(params.organizationId);
this.accessEvents = organization.useEvents; this.accessEvents = this.organization.useEvents;
this.accessGroups = organization.useGroups; this.accessGroups = this.organization.useGroups;
}); });
} }
} }

View File

@ -48,6 +48,7 @@
<td> <td>
<span *ngIf="u.type === organizationUserType.Owner">{{'owner' | i18n}}</span> <span *ngIf="u.type === organizationUserType.Owner">{{'owner' | i18n}}</span>
<span *ngIf="u.type === organizationUserType.Admin">{{'admin' | i18n}}</span> <span *ngIf="u.type === organizationUserType.Admin">{{'admin' | i18n}}</span>
<span *ngIf="u.type === organizationUserType.Manager">{{'manager' | i18n}}</span>
<span *ngIf="u.type === organizationUserType.User">{{'user' | i18n}}</span> <span *ngIf="u.type === organizationUserType.User">{{'user' | i18n}}</span>
</td> </td>
<td class="table-list-options"> <td class="table-list-options">

View File

@ -5,7 +5,10 @@ import {
ViewChild, ViewChild,
ViewContainerRef, ViewContainerRef,
} from '@angular/core'; } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import {
ActivatedRoute,
Router,
} from '@angular/router';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2'; import { Angulartics2 } from 'angulartics2';
@ -58,12 +61,16 @@ export class PeopleComponent implements OnInit {
private i18nService: I18nService, private componentFactoryResolver: ComponentFactoryResolver, private i18nService: I18nService, private componentFactoryResolver: ComponentFactoryResolver,
private platformUtilsService: PlatformUtilsService, private analytics: Angulartics2, private platformUtilsService: PlatformUtilsService, private analytics: Angulartics2,
private toasterService: ToasterService, private cryptoService: CryptoService, private toasterService: ToasterService, private cryptoService: CryptoService,
private userService: UserService) { } private userService: UserService, private router: Router) { }
async ngOnInit() { async ngOnInit() {
this.route.parent.parent.params.subscribe(async (params) => { this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId; this.organizationId = params.organizationId;
const organization = await this.userService.getOrganization(this.organizationId); const organization = await this.userService.getOrganization(this.organizationId);
if (!organization.isAdmin) {
this.router.navigate(['../collections'], { relativeTo: this.route });
return;
}
this.accessEvents = organization.useEvents; this.accessEvents = organization.useEvents;
this.accessGroups = organization.useGroups; this.accessGroups = organization.useGroups;
await this.load(); await this.load();

View File

@ -30,6 +30,13 @@
<small>{{'userDesc' | i18n}}</small> <small>{{'userDesc' | i18n}}</small>
</label> </label>
</div> </div>
<div class="form-check mt-2 form-check-block">
<input class="form-check-input" type="radio" name="userType" id="userTypeManager" [value]="organizationUserType.Manager" [(ngModel)]="type">
<label class="form-check-label" for="userTypeManager">
{{'manager' | i18n}}
<small>{{'managerDesc' | i18n}}</small>
</label>
</div>
<div class="form-check mt-2 form-check-block"> <div class="form-check mt-2 form-check-block">
<input class="form-check-input" type="radio" name="userType" id="userTypeAdmin" [value]="organizationUserType.Admin" [(ngModel)]="type"> <input class="form-check-input" type="radio" name="userType" id="userTypeAdmin" [value]="organizationUserType.Admin" [(ngModel)]="type">
<label class="form-check-label" for="userTypeAdmin"> <label class="form-check-label" for="userTypeAdmin">

View File

@ -1905,13 +1905,19 @@
"message": "Admin" "message": "Admin"
}, },
"adminDesc": { "adminDesc": {
"message": " Admins can access and manage all items, collections and users in your organization." "message": "Admins can access and manage all items, collections and users in your organization."
}, },
"user": { "user": {
"message": "User" "message": "User"
}, },
"userDesc": { "userDesc": {
"message": "A regular user with access to your organization's collections." "message": "A regular user with access to assigned collections in your organization."
},
"manager": {
"message": "Manager"
},
"managerDesc": {
"message": "Managers can access and manage assigned collections in your organization."
}, },
"all": { "all": {
"message": "All" "message": "All"