From edb2265fdfb3b7f0440c0769eb976a69fd88b214 Mon Sep 17 00:00:00 2001 From: FyloZ Date: Mon, 5 Apr 2021 19:26:28 -0400 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20des=20permissions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accounts/services/account.service.ts | 2 +- .../mix-editor/mix-editor.component.ts | 2 +- .../mix-table/mix-table.component.html | 29 ++- .../mix-table/mix-table.component.ts | 15 ++ .../colors/pages/edit/edit.component.ts | 2 +- .../pages/explore/explore.component.html | 25 +- .../colors/pages/explore/explore.component.ts | 7 + .../colors/pages/list/list.component.ts | 2 +- .../company/pages/edit/edit.component.html | 2 +- .../company/pages/list/list.component.html | 2 +- .../company/pages/list/list.component.ts | 2 +- .../employees/pages/edit/edit.component.html | 2 +- .../employees/pages/list/list.component.html | 2 +- .../employees/pages/list/list.component.ts | 4 +- .../employees-list.component.ts | 2 +- .../groups/pages/edit/edit.component.html | 2 +- .../groups/pages/list/list.component.html | 2 +- .../groups/pages/list/list.component.ts | 3 +- .../pages/edit/edit.component.html | 2 +- .../pages/list/list.component.html | 2 +- .../pages/list/list.component.ts | 2 +- .../material/pages/edit/edit.component.html | 2 +- .../pages/inventory/inventory.component.html | 4 +- .../pages/inventory/inventory.component.ts | 6 +- .../components/header/header.component.html | 2 +- .../components/header/header.component.ts | 14 +- src/app/modules/shared/model/employee.ts | 224 ++++++++---------- src/app/pages/catalog/catalog.component.ts | 6 +- 28 files changed, 195 insertions(+), 176 deletions(-) diff --git a/src/app/modules/accounts/services/account.service.ts b/src/app/modules/accounts/services/account.service.ts index 962df6d..ab037e2 100644 --- a/src/app/modules/accounts/services/account.service.ts +++ b/src/app/modules/accounts/services/account.service.ts @@ -72,7 +72,7 @@ export class AccountService implements OnDestroy { } logout(success: () => void) { - this.api.get('/employee/logout', true).pipe( + this.api.get('/logout', true).pipe( take(1), takeUntil(this.destroy$) ) diff --git a/src/app/modules/colors/components/mix-editor/mix-editor.component.ts b/src/app/modules/colors/components/mix-editor/mix-editor.component.ts index fec8b0d..41c9fd9 100644 --- a/src/app/modules/colors/components/mix-editor/mix-editor.component.ts +++ b/src/app/modules/colors/components/mix-editor/mix-editor.component.ts @@ -157,7 +157,7 @@ export class MixEditorComponent extends ErrorHandlingComponent { } get canDeleteMix() { - return this.accountService.hasPermission(EmployeePermission.REMOVE_RECIPE) + return this.accountService.hasPermission(EmployeePermission.REMOVE_RECIPES) } private generateForm() { diff --git a/src/app/modules/colors/components/mix-table/mix-table.component.html b/src/app/modules/colors/components/mix-table/mix-table.component.html index a10fd91..dd8ee81 100644 --- a/src/app/modules/colors/components/mix-table/mix-table.component.html +++ b/src/app/modules/colors/components/mix-table/mix-table.component.html @@ -6,16 +6,33 @@
- + Casier - + +

+ {{mix.location}} +

-
- +
+
-
- +
+
diff --git a/src/app/modules/colors/components/mix-table/mix-table.component.ts b/src/app/modules/colors/components/mix-table/mix-table.component.ts index 61240c3..9832e3c 100644 --- a/src/app/modules/colors/components/mix-table/mix-table.component.ts +++ b/src/app/modules/colors/components/mix-table/mix-table.component.ts @@ -10,6 +10,8 @@ import {ErrorService} from '../../../shared/service/error.service' import {AlertService} from '../../../shared/service/alert.service' import {environment} from '../../../../../environments/environment' import {MaterialService} from '../../../material/service/material.service' +import {EmployeePermission} from '../../../shared/model/employee' +import {AccountService} from '../../../accounts/services/account.service' @Component({ selector: 'cre-mix-table', @@ -43,6 +45,7 @@ export class MixTableComponent extends SubscribingComponent { constructor( private materialService: MaterialService, + private accountService: AccountService, private alertService: AlertService, errorService: ErrorService, router: Router, @@ -173,6 +176,18 @@ export class MixTableComponent extends SubscribingComponent { } } + get canPrintMixes(): boolean { + return this.accountService.hasPermission(EmployeePermission.PRINT_MIXES) + } + + get canDeductFromInventory(): boolean { + return this.accountService.hasPermission(EmployeePermission.DEDUCT_FROM_INVENTORY) + } + + get canEditRecipesPublicData(): boolean { + return this.accountService.hasPermission(EmployeePermission.EDIT_RECIPES_PUBLIC_DATA) + } + private emitQuantityChangeEvent(index: number) { const quantity = this.mixMaterials[index] this.quantityChange.emit({ diff --git a/src/app/modules/colors/pages/edit/edit.component.ts b/src/app/modules/colors/pages/edit/edit.component.ts index b801f16..c4606ad 100644 --- a/src/app/modules/colors/pages/edit/edit.component.ts +++ b/src/app/modules/colors/pages/edit/edit.component.ts @@ -170,7 +170,7 @@ export class EditComponent extends ErrorHandlingComponent { } get hasDeletePermission(): boolean { - return this.accountService.hasPermission(EmployeePermission.REMOVE_RECIPE) + return this.accountService.hasPermission(EmployeePermission.REMOVE_RECIPES) } get loggedInEmployeeGroupId(): number { diff --git a/src/app/modules/colors/pages/explore/explore.component.html b/src/app/modules/colors/pages/explore/explore.component.html index 0a98562..e06b6be 100644 --- a/src/app/modules/colors/pages/explore/explore.component.html +++ b/src/app/modules/colors/pages/explore/explore.component.html @@ -4,9 +4,25 @@
- - - + +
@@ -26,7 +42,7 @@
- + Note +

{{selectedGroupNote}}

diff --git a/src/app/modules/colors/pages/explore/explore.component.ts b/src/app/modules/colors/pages/explore/explore.component.ts index 3dc9b6e..f868b9c 100644 --- a/src/app/modules/colors/pages/explore/explore.component.ts +++ b/src/app/modules/colors/pages/explore/explore.component.ts @@ -11,6 +11,8 @@ import {InventoryService} from '../../../material/service/inventory.service' import {ConfirmBoxComponent} from '../../../shared/components/confirm-box/confirm-box.component' import {GroupService} from '../../../groups/services/group.service' import {AppState} from '../../../shared/app-state' +import {AccountService} from '../../../accounts/services/account.service' +import {EmployeePermission} from '../../../shared/model/employee' @Component({ selector: 'cre-explore', @@ -41,6 +43,7 @@ export class ExploreComponent extends ErrorHandlingComponent { private inventoryService: InventoryService, private groupService: GroupService, private alertService: AlertService, + private accountService: AccountService, private appState: AppState, errorService: ErrorService, router: Router, @@ -141,6 +144,10 @@ export class ExploreComponent extends ErrorHandlingComponent { this.groupsNote.set(this.selectedGroupId, value) } + get canEditRecipesPublicData(): boolean { + return this.accountService.hasPermission(EmployeePermission.EDIT_RECIPES_PUBLIC_DATA) + } + private get mappedUpdatedNotes(): Map { const updatedNotes = new Map() diff --git a/src/app/modules/colors/pages/list/list.component.ts b/src/app/modules/colors/pages/list/list.component.ts index a877447..84d98ac 100644 --- a/src/app/modules/colors/pages/list/list.component.ts +++ b/src/app/modules/colors/pages/list/list.component.ts @@ -61,7 +61,7 @@ export class ListComponent extends ErrorHandlingComponent { } get hasEditPermission(): boolean { - return this.accountService.hasPermission(EmployeePermission.EDIT_RECIPE) + return this.accountService.hasPermission(EmployeePermission.EDIT_RECIPES) } private recipeMatchesSearchQuery(recipe: Recipe) { diff --git a/src/app/modules/company/pages/edit/edit.component.html b/src/app/modules/company/pages/edit/edit.component.html index 04864a7..cd9b72b 100644 --- a/src/app/modules/company/pages/edit/edit.component.html +++ b/src/app/modules/company/pages/edit/edit.component.html @@ -3,7 +3,7 @@ title="Modifier la bannière {{company.name}}" deleteConfirmMessage="Voulez-vous vraiment supprimer la bannière {{company.name}}?" backButtonLink="/catalog/company/list" - deletePermission="REMOVE_COMPANY" + deletePermission="REMOVE_COMPANIES" [entity]="company" [formFields]="formFields" (submit)="submit($event)" diff --git a/src/app/modules/company/pages/list/list.component.html b/src/app/modules/company/pages/list/list.component.html index fe05358..e0781de 100644 --- a/src/app/modules/company/pages/list/list.component.html +++ b/src/app/modules/company/pages/list/list.component.html @@ -3,5 +3,5 @@ [columns]="columns" [buttons]="buttons" addLink="/catalog/company/add" - addPermission="EDIT_COMPANY"> + addPermission="EDIT_COMPANIES"> diff --git a/src/app/modules/company/pages/list/list.component.ts b/src/app/modules/company/pages/list/list.component.ts index 7f7a88d..d817a86 100644 --- a/src/app/modules/company/pages/list/list.component.ts +++ b/src/app/modules/company/pages/list/list.component.ts @@ -18,7 +18,7 @@ export class ListComponent extends ErrorHandlingComponent { buttons = [{ text: 'Modifier', linkFn: t => `/catalog/company/edit/${t.id}`, - permission: EmployeePermission.EDIT_COMPANY + permission: EmployeePermission.EDIT_COMPANIES }] constructor( diff --git a/src/app/modules/employees/pages/edit/edit.component.html b/src/app/modules/employees/pages/edit/edit.component.html index 6a5595e..2ab4d53 100644 --- a/src/app/modules/employees/pages/edit/edit.component.html +++ b/src/app/modules/employees/pages/edit/edit.component.html @@ -2,7 +2,7 @@ *ngIf="employee" title="Modification de l'utilisateur #{{employee.id}}" backButtonLink="/employee/list" - deletePermission="REMOVE_EMPLOYEE" + deletePermission="REMOVE_USERS" deleteConfirmMessage="Voulez-vous vraiment supprimer l'utilisateur #{{employee.id}}?" [entity]="employee" [formFields]="formFields" diff --git a/src/app/modules/employees/pages/list/list.component.html b/src/app/modules/employees/pages/list/list.component.html index e52139f..1190b10 100644 --- a/src/app/modules/employees/pages/list/list.component.html +++ b/src/app/modules/employees/pages/list/list.component.html @@ -1,6 +1,6 @@ `/employee/edit/${employee.id}`, - permission: EmployeePermission.EDIT_EMPLOYEE + permission: EmployeePermission.EDIT_USERS }, { text: 'Modifier mot de passe', linkFn: employee => `/employee/password/edit/${employee.id}`, - permission: EmployeePermission.EDIT_EMPLOYEE_PASSWORD + permission: EmployeePermission.EDIT_USERS }] constructor( diff --git a/src/app/modules/groups/components/employees-list/employees-list.component.ts b/src/app/modules/groups/components/employees-list/employees-list.component.ts index d99d8bc..fce4f06 100644 --- a/src/app/modules/groups/components/employees-list/employees-list.component.ts +++ b/src/app/modules/groups/components/employees-list/employees-list.component.ts @@ -26,6 +26,6 @@ export class EmployeesListComponent implements OnInit { } get canEditEmployee(): boolean { - return this.accountService.hasPermission(EmployeePermission.EDIT_EMPLOYEE) + return this.accountService.hasPermission(EmployeePermission.EDIT_USERS) } } diff --git a/src/app/modules/groups/pages/edit/edit.component.html b/src/app/modules/groups/pages/edit/edit.component.html index 6e47fe1..4ea243e 100644 --- a/src/app/modules/groups/pages/edit/edit.component.html +++ b/src/app/modules/groups/pages/edit/edit.component.html @@ -2,7 +2,7 @@ *ngIf="group" title="Modifier le groupe {{group.name}}" backButtonLink="/group/list" - deletePermission="REMOVE_EMPLOYEE_GROUP" + deletePermission="REMOVE_USERS" deleteConfirmMessage="Voulez-vous vraiment supprimer le groupe {{group.name}}?" [entity]="group" [formFields]="formFields" diff --git a/src/app/modules/groups/pages/list/list.component.html b/src/app/modules/groups/pages/list/list.component.html index 4d17df7..12b7c04 100644 --- a/src/app/modules/groups/pages/list/list.component.html +++ b/src/app/modules/groups/pages/list/list.component.html @@ -1,6 +1,6 @@ this.setDefaultGroup(group), - permission: EmployeePermission.SET_BROWSER_DEFAULT_GROUP, disabledFn: group => this.isDefaultGroup(group) }, { text: 'Modifier', linkFn: group => `/group/edit/${group.id}`, - permission: EmployeePermission.EDIT_EMPLOYEE_GROUP + permission: EmployeePermission.EDIT_USERS }] handledErrorModels: ErrorModel[] = [{ diff --git a/src/app/modules/material-type/pages/edit/edit.component.html b/src/app/modules/material-type/pages/edit/edit.component.html index 07862c1..f817426 100644 --- a/src/app/modules/material-type/pages/edit/edit.component.html +++ b/src/app/modules/material-type/pages/edit/edit.component.html @@ -3,7 +3,7 @@ title="Modifier le group {{materialType.name}}" deleteConfirmMessage="Voulez-vous vraiment supprimer le type de produit {{materialType.name}}?" backButtonLink="/catalog/materialtype/list" - deletePermission="REMOVE_MATERIAL_TYPE" + deletePermission="REMOVE_MATERIAL_TYPES" [entity]="materialType" [formFields]="formFields" (submit)="submit($event)" diff --git a/src/app/modules/material-type/pages/list/list.component.html b/src/app/modules/material-type/pages/list/list.component.html index 661e7a5..f70251f 100644 --- a/src/app/modules/material-type/pages/list/list.component.html +++ b/src/app/modules/material-type/pages/list/list.component.html @@ -3,5 +3,5 @@ [columns]="columns" [buttons]="buttons" addLink="/catalog/materialtype/add" - addPermission="EDIT_MATERIAL_TYPE"> + addPermission="EDIT_MATERIAL_TYPES"> diff --git a/src/app/modules/material-type/pages/list/list.component.ts b/src/app/modules/material-type/pages/list/list.component.ts index 6a9719e..c729638 100644 --- a/src/app/modules/material-type/pages/list/list.component.ts +++ b/src/app/modules/material-type/pages/list/list.component.ts @@ -21,7 +21,7 @@ export class ListComponent extends ErrorHandlingComponent { { text: 'Modifier', linkFn: t => `/catalog/materialtype/edit/${t.id}`, - permission: EmployeePermission.EDIT_MATERIAL_TYPE, + permission: EmployeePermission.EDIT_MATERIAL_TYPES, disabledFn: t => t.systemType } ] diff --git a/src/app/modules/material/pages/edit/edit.component.html b/src/app/modules/material/pages/edit/edit.component.html index e6d5051..3785f33 100644 --- a/src/app/modules/material/pages/edit/edit.component.html +++ b/src/app/modules/material/pages/edit/edit.component.html @@ -3,7 +3,7 @@ title="Modifier le produit {{material.name}}" deleteConfirmMessage="Voulez-vous vraiment supprimer le produit {{material.name}}?" backButtonLink="/catalog/material/list" - deletePermission="REMOVE_MATERIAL" + deletePermission="REMOVE_MATERIALS" [entity]="material" [formFields]="formFields" (submit)="submit($event)" diff --git a/src/app/modules/material/pages/inventory/inventory.component.html b/src/app/modules/material/pages/inventory/inventory.component.html index 2c4f175..1d55bc2 100644 --- a/src/app/modules/material/pages/inventory/inventory.component.html +++ b/src/app/modules/material/pages/inventory/inventory.component.html @@ -67,13 +67,13 @@ - +
- + = 0 } }) - - this.catalogEnabled = this.accountService.hasPermission(EmployeePermission.VIEW_MATERIAL_TYPE) || - this.accountService.hasPermission(EmployeePermission.VIEW_MATERIAL) || - this.accountService.hasPermission(EmployeePermission.VIEW_COMPANY) } private link(route: string) { diff --git a/src/app/modules/shared/model/employee.ts b/src/app/modules/shared/model/employee.ts index 5472bb8..050c3b7 100644 --- a/src/app/modules/shared/model/employee.ts +++ b/src/app/modules/shared/model/employee.ts @@ -21,142 +21,108 @@ export class EmployeeGroup { } export enum EmployeePermission { - VIEW_MATERIAL = 'VIEW_MATERIAL', - VIEW_MATERIAL_TYPE = 'VIEW_MATERIAL_TYPE', - VIEW_COMPANY = 'VIEW_COMPANY', - VIEW_RECIPE = 'VIEW_RECIPE', - VIEW = 'VIEW', - VIEW_EMPLOYEE = 'VIEW_EMPLOYEE', - VIEW_EMPLOYEE_GROUP = 'VIEW_EMPLOYEE_GROUP', + VIEW_RECIPES = 'VIEW_RECIPES', + VIEW_USERS = 'VIEW_USERS', + VIEW_CATALOG = 'VIEW_CATALOG', - EDIT_MATERIAL = 'EDIT_MATERIAL', - EDIT_MATERIAL_TYPE = 'EDIT_MATERIAL_TYPE', - EDIT_COMPANY = 'EDIT_COMPANY', - EDIT_RECIPE = 'EDIT_RECIPE', - EDIT = 'EDIT', - EDIT_EMPLOYEE = 'EDIT_EMPLOYEE', - EDIT_EMPLOYEE_PASSWORD = 'EDIT_EMPLOYEE_PASSWORD', - EDIT_EMPLOYEE_GROUP = 'EDIT_EMPLOYEE_GROUP', + PRINT_MIXES = 'PRINT_MIXES', - REMOVE_MATERIAL = 'REMOVE_MATERIAL', - REMOVE_MATERIAL_TYPE = 'REMOVE_MATERIAL_TYPE', - REMOVE_COMPANY = 'REMOVE_COMPANY', - REMOVE_RECIPE = 'REMOVE_RECIPE', - REMOVE = 'REMOVE', - REMOVE_EMPLOYEE = 'REMOVE_EMPLOYEE', - REMOVE_EMPLOYEE_GROUP = 'REMOVE_EMPLOYEE_GROUP', + EDIT_RECIPES_PUBLIC_DATA = 'EDIT_RECIPES_PUBLIC_DATA', + EDIT_RECIPES = 'EDIT_RECIPES', + EDIT_MATERIALS = 'EDIT_MATERIALS', + EDIT_MATERIAL_TYPES = 'EDIT_MATERIAL_TYPES', + EDIT_COMPANIES = 'EDIT_COMPANIES', + EDIT_USERS = 'EDIT_USERS', + EDIT_CATALOG = 'EDIT_CATALOG', + + REMOVE_RECIPES = 'REMOVE_RECIPES', + REMOVE_MATERIALS = 'REMOVE_MATERIALS', + REMOVE_MATERIAL_TYPES = 'REMOVE_MATERIAL_TYPES', + REMOVE_COMPANIES = 'REMOVE_COMPANIES', + REMOVE_USERS = 'REMOVE_USERS', + REMOVE_CATALOG = 'REMOVE_CATALOG', + + ADD_TO_INVENTORY = 'ADD_TO_INVENTORY', + DEDUCT_FROM_INVENTORY = 'DEDUCT_FROM_INVENTORY', - SET_BROWSER_DEFAULT_GROUP = 'SET_BROWSER_DEFAULT_GROUP', ADMIN = 'ADMIN' } export const mapped_permissions = { view: [ - {permission: EmployeePermission.VIEW_MATERIAL, description: 'Voir les produits', impliedPermissions: []}, - { - permission: EmployeePermission.VIEW_MATERIAL_TYPE, - description: 'Voir les types de produit', - impliedPermissions: [] - }, - {permission: EmployeePermission.VIEW_COMPANY, description: 'Voir les bannières', impliedPermissions: []}, - {permission: EmployeePermission.VIEW_RECIPE, description: 'Voir les couleurs', impliedPermissions: []}, - { - permission: EmployeePermission.VIEW, - description: 'Voir', - impliedPermissions: [EmployeePermission.VIEW_MATERIAL, EmployeePermission.VIEW_MATERIAL_TYPE, EmployeePermission.VIEW_COMPANY, EmployeePermission.VIEW_RECIPE] - }, - {permission: EmployeePermission.VIEW_EMPLOYEE, description: 'Voir les utilisateurs', impliedPermissions: []}, - {permission: EmployeePermission.VIEW_EMPLOYEE_GROUP, description: 'Voir les groupes', impliedPermissions: []}, + {permission: EmployeePermission.VIEW_RECIPES, description: 'Voir les recettes', impliedPermissions: []}, + {permission: EmployeePermission.VIEW_CATALOG, description: 'Voir le catalogue', impliedPermissions: []}, + {permission: EmployeePermission.VIEW_USERS, description: 'Voir les utilisateurs', impliedPermissions: []}, ], - edit: [ - { - permission: EmployeePermission.EDIT_MATERIAL, - description: 'Modifier les produits', - impliedPermissions: [EmployeePermission.VIEW_MATERIAL_TYPE] - }, - { - permission: EmployeePermission.EDIT_MATERIAL_TYPE, - description: 'Modifier les types de produit', - impliedPermissions: [EmployeePermission.VIEW_MATERIAL_TYPE] - }, - { - permission: EmployeePermission.EDIT_COMPANY, - description: 'Modifier les bannières', - impliedPermissions: [EmployeePermission.VIEW_COMPANY] - }, - { - permission: EmployeePermission.EDIT_RECIPE, - description: 'Modifier les couleurs', - impliedPermissions: [EmployeePermission.VIEW_RECIPE] - }, - { - permission: EmployeePermission.EDIT, - description: 'Modifier', - impliedPermissions: [EmployeePermission.EDIT_MATERIAL, EmployeePermission.EDIT_MATERIAL_TYPE, EmployeePermission.EDIT_COMPANY, EmployeePermission.EDIT_RECIPE, EmployeePermission.VIEW] - }, - { - permission: EmployeePermission.EDIT_EMPLOYEE, - description: 'Modifier les utilisateurs', - impliedPermissions: [EmployeePermission.VIEW_EMPLOYEE] - }, - { - permission: EmployeePermission.EDIT_EMPLOYEE_PASSWORD, - description: 'Modifier le mot de passe des employés', - impliedPermissions: [EmployeePermission.EDIT_EMPLOYEE] - }, - { - permission: EmployeePermission.EDIT_EMPLOYEE_GROUP, - description: 'Modifier les groupes', - impliedPermissions: [EmployeePermission.VIEW_EMPLOYEE_GROUP] - }, - ], - remove: [ - { - permission: EmployeePermission.REMOVE_MATERIAL, - description: 'Supprimer des produits', - impliedPermissions: [EmployeePermission.EDIT_MATERIAL] - }, - { - permission: EmployeePermission.REMOVE_MATERIAL_TYPE, - description: 'Supprimer des types de produit', - impliedPermissions: [EmployeePermission.EDIT_MATERIAL_TYPE] - }, - { - permission: EmployeePermission.REMOVE_COMPANY, - description: 'Supprimer des bannières', - impliedPermissions: [EmployeePermission.EDIT_COMPANY] - }, - { - permission: EmployeePermission.REMOVE_RECIPE, - description: 'Supprimer des couleurs', - impliedPermissions: [EmployeePermission.EDIT_RECIPE] - }, - { - permission: EmployeePermission.REMOVE, - description: 'Supprimer', - impliedPermissions: [EmployeePermission.REMOVE_MATERIAL, EmployeePermission.REMOVE_MATERIAL_TYPE, EmployeePermission.REMOVE_COMPANY, EmployeePermission.REMOVE_RECIPE, EmployeePermission.EDIT] - }, - { - permission: EmployeePermission.REMOVE_EMPLOYEE, - description: 'Supprimer des utilisateurs', - impliedPermissions: [EmployeePermission.EDIT_EMPLOYEE] - }, - { - permission: EmployeePermission.REMOVE_EMPLOYEE_GROUP, - description: 'Supprimer des groupes', - impliedPermissions: [EmployeePermission.EDIT_EMPLOYEE_GROUP] - }, - ], - other: [ - { - permission: EmployeePermission.SET_BROWSER_DEFAULT_GROUP, - description: 'Définir le groupe par défaut', - impliedPermissions: [EmployeePermission.VIEW_EMPLOYEE_GROUP] - }, - { - permission: EmployeePermission.ADMIN, - description: 'Administrateur', - impliedPermissions: [EmployeePermission.REMOVE, EmployeePermission.SET_BROWSER_DEFAULT_GROUP, EmployeePermission.REMOVE_EMPLOYEE, EmployeePermission.EDIT_EMPLOYEE_PASSWORD, EmployeePermission.REMOVE_EMPLOYEE_GROUP] - } - ] + edit: [{ + permission: EmployeePermission.EDIT_RECIPES_PUBLIC_DATA, + description: 'Modifier les données publiques des recettes', + impliedPermissions: [EmployeePermission.VIEW_RECIPES] + }, { + permission: EmployeePermission.EDIT_RECIPES, + description: 'Modifier les recettes', + impliedPermissions: [EmployeePermission.EDIT_RECIPES_PUBLIC_DATA] + }, { + permission: EmployeePermission.EDIT_MATERIALS, + description: 'Modifier les produits', + impliedPermissions: [EmployeePermission.VIEW_CATALOG] + }, { + permission: EmployeePermission.EDIT_MATERIAL_TYPES, + description: 'Modifier les types de produit', + impliedPermissions: [EmployeePermission.VIEW_CATALOG] + }, { + permission: EmployeePermission.EDIT_COMPANIES, + description: 'Modifier les bannières', + impliedPermissions: [EmployeePermission.VIEW_CATALOG] + }, { + permission: EmployeePermission.EDIT_CATALOG, + description: 'Modifier le catalogue', + impliedPermissions: [EmployeePermission.EDIT_MATERIALS, EmployeePermission.EDIT_MATERIAL_TYPES, EmployeePermission.EDIT_COMPANIES] + }, { + permission: EmployeePermission.EDIT_USERS, + description: 'Modifier les utilisateurs', + impliedPermissions: [EmployeePermission.VIEW_USERS] + }], + remove: [{ + permission: EmployeePermission.REMOVE_RECIPES, + description: 'Supprimer des recettes', + impliedPermissions: [EmployeePermission.EDIT_RECIPES] + }, { + permission: EmployeePermission.REMOVE_MATERIALS, + description: 'Supprimer des produits', + impliedPermissions: [EmployeePermission.EDIT_MATERIALS] + }, { + permission: EmployeePermission.REMOVE_MATERIAL_TYPES, + description: 'Supprimer des types de produit', + impliedPermissions: [EmployeePermission.EDIT_MATERIAL_TYPES] + }, { + permission: EmployeePermission.REMOVE_COMPANIES, + description: 'Supprimer des bannières', + impliedPermissions: [EmployeePermission.EDIT_COMPANIES] + }, { + permission: EmployeePermission.REMOVE_CATALOG, + description: 'Supprimer dans le catalogue', + impliedPermissions: [EmployeePermission.REMOVE_MATERIALS, EmployeePermission.REMOVE_MATERIAL_TYPES, EmployeePermission.REMOVE_COMPANIES] + }, { + permission: EmployeePermission.REMOVE_USERS, + description: 'Supprimer des utilisateurs', + impliedPermissions: [EmployeePermission.EDIT_USERS] + }], + other: [{ + permission: EmployeePermission.PRINT_MIXES, + description: 'Imprimer les mélanges (bPac)', + impliedPermissions: [EmployeePermission.VIEW_RECIPES] + }, { + permission: EmployeePermission.ADD_TO_INVENTORY, + description: 'Ajouter dans l\'inventaire', + impliedPermissions: [EmployeePermission.VIEW_CATALOG] + }, { + permission: EmployeePermission.DEDUCT_FROM_INVENTORY, + description: 'Déduire dans l\'inventaire', + impliedPermissions: [EmployeePermission.VIEW_RECIPES] + }, { + permission: EmployeePermission.ADMIN, + description: 'Administrateur', + impliedPermissions: [EmployeePermission.EDIT_CATALOG, EmployeePermission.REMOVE_RECIPES, EmployeePermission.REMOVE_USERS, EmployeePermission.REMOVE_CATALOG, EmployeePermission.PRINT_MIXES, EmployeePermission.ADD_TO_INVENTORY, EmployeePermission.DEDUCT_FROM_INVENTORY] + }] } diff --git a/src/app/pages/catalog/catalog.component.ts b/src/app/pages/catalog/catalog.component.ts index 79ec177..ab3bfe6 100644 --- a/src/app/pages/catalog/catalog.component.ts +++ b/src/app/pages/catalog/catalog.component.ts @@ -10,9 +10,9 @@ import {GlobalAlertHandlerComponent} from '../../modules/shared/components/globa }) export class CatalogComponent implements OnInit, OnDestroy { links: NavLink[] = [ - {route: '/catalog/materialtype', title: 'Types de produit', permission: EmployeePermission.VIEW_MATERIAL_TYPE}, - {route: '/catalog/material', title: 'Inventaire', permission: EmployeePermission.VIEW_MATERIAL}, - {route: '/catalog/company', title: 'Bannières', permission: EmployeePermission.VIEW_COMPANY} + {route: '/catalog/materialtype', title: 'Types de produit', permission: EmployeePermission.VIEW_CATALOG}, + {route: '/catalog/material', title: 'Inventaire', permission: EmployeePermission.VIEW_CATALOG}, + {route: '/catalog/company', title: 'Bannières', permission: EmployeePermission.VIEW_CATALOG} ] ngOnInit(): void {