Skip to content

Commit

Permalink
fix: add permission check to edit the company profile
Browse files Browse the repository at this point in the history
  • Loading branch information
SGrueber committed Jun 16, 2021
1 parent f1eb525 commit 2096b26
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/app/pages/account-profile/account-profile-page.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { AuthorizationToggleGuard } from 'ish-core/authorization-toggle.module';
import { SharedModule } from 'ish-shared/shared.module';

import { AccountProfilePageComponent } from './account-profile-page.component';
Expand Down Expand Up @@ -45,7 +46,9 @@ const routes: Routes = [
},
{
path: 'company',
canActivate: [AuthorizationToggleGuard],
data: {
permission: 'APP_B2B_MANAGE_USERS',
breadcrumbData: [
{ key: 'account.profile.link', link: '/account/profile' },
{ key: 'account.company_profile.heading' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ <h3>{{ 'account.company_profile.detail.heading' | translate }}</h3>
</div>
<div class="col-2 col-lg-4">
<a
*ishIsAuthorizedTo="'APP_B2B_MANAGE_USERS'"
routerLink="/account/profile/company"
class="btn-tool"
title="{{ 'account.profile.update.link' | translate }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { TranslateModule } from '@ngx-translate/core';
import { MockComponent, MockDirective } from 'ng-mocks';

import { AuthorizationToggleModule } from 'ish-core/authorization-toggle.module';
import { IdentityProviderCapabilityDirective } from 'ish-core/directives/identity-provider-capability.directive';
import { ServerHtmlDirective } from 'ish-core/directives/server-html.directive';
import { IdentityProviderModule } from 'ish-core/identity-provider.module';
Expand All @@ -27,7 +28,11 @@ describe('Account Profile Component', () => {
MockComponent(FaIconComponent),
MockDirective(ServerHtmlDirective),
],
imports: [IdentityProviderModule.forTesting(), TranslateModule.forRoot()],
imports: [
AuthorizationToggleModule.forTesting('APP_B2B_MANAGE_USERS'),
IdentityProviderModule.forTesting(),
TranslateModule.forRoot(),
],
}).compileComponents();
});

Expand Down

0 comments on commit 2096b26

Please sign in to comment.