diff --git a/src/frontend/app/administration/group/group-administration.component.html b/src/frontend/app/administration/group/group-administration.component.html index 0d749f5c99c8bf21e19ae00216c3762aee4b036c..7f9b49c93b7289782b0e350e8e1aebf42ffe855e 100755 --- a/src/frontend/app/administration/group/group-administration.component.html +++ b/src/frontend/app/administration/group/group-administration.component.html @@ -34,7 +34,8 @@ required matTextareaAutosize matAutosizeMinRows="1" matAutosizeMaxRows="5"></textarea> <mat-icon style="cursor:pointer;" color="primary" matSuffix class="fa fa-info-circle" - matTooltip="{{lang.keywordHelper}}" (click)="snav2.toggle()"></mat-icon> + matTooltip="{{lang.keywordHelper}}" + (click)="panelMode='keywordInfos';snav2.toggle()"></mat-icon> </mat-form-field> <div class="col-md-12 text-center" style="padding:10px;"> <button mat-raised-button [disabled]="!groupForm.form.valid" @@ -67,6 +68,12 @@ (change)="toggleService($event,administration)" matTooltip="{{administration.comment}}">{{administration.label}} </mat-slide-toggle> + <button mat-icon-button [class.active]="panelMode === administration.id" + *ngIf="administration.hasParams" + (click)="$event.stopPropagation();openUserParams(administration.id)" + color="primary" [title]="lang.goToAdminParams"> + <mat-icon class="fa fa-cogs"></mat-icon> + </button> </div> </mat-tab> <mat-tab label="{{lang.functionnalities}}"> @@ -189,39 +196,59 @@ <mat-sidenav #snav2 [mode]="appService.getViewMode() ? 'over' : 'side'" [fixedInViewport]="appService.getViewMode()" fixedTopGap="56" position='end' [opened]="appService.getViewMode() ? false : false"> - - <mat-nav-list> - <h3 mat-subheader>{{lang.keywordHelp}}</h3> - </mat-nav-list> - <mat-list role="list" style="width: 400px;padding: 5px;"> - <p style="font-size:10px;">{{lang.keywordHelpDesc_11}}</p> - <div style="border:1px black solid; padding:3px;font-size:10px;"> - <b>DESTINATION = @my_primary_entity or DESTINATION in (@subentities[@my_primary_entity])</b> - </div> - <h4 mat-line style="font-weight:bold;font-size:10px;">@user :</h4> - <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_1}}</p> - <h4 mat-line style="font-weight:bold;font-size:10px;">@user_id :</h4> - <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_12}}</p> - <h4 mat-line style="font-weight:bold;font-size:10px;">@email :</h4> - <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_2}}</p> - <h4 mat-line style="font-weight:bold;font-size:10px;">@my_entities :</h4> - <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_3}}</p> - <h4 mat-line style="font-weight:bold;font-size:10px;">@my_primary_entity :</h4> - <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_4}}</p> - <h4 mat-line style="font-weight:bold;font-size:10px;">@subentities[('entity_1',...,'entity_n')] :</h4> - <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_5}}</p> - <h4 mat-line style="font-weight:bold;font-size:10px;">@parent_entity['entity_id'] :</h4> - <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_6}}</p> - <h4 mat-line style="font-weight:bold;font-size:10px;">@sisters_entities['entity_id'] :</h4> - <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_7}}</p> - <h4 mat-line style="font-weight:bold;font-size:10px;">@entity_type['type'] :</h4> - <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_8}}</p> - <h4 mat-line style="font-weight:bold;font-size:10px;">@all_entities :</h4> - <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_9}}</p> - <h4 mat-line style="font-weight:bold;font-size:10px;">@immediate_children['entity_1',..., 'entity_id'] : - </h4> - <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_10}}</p> - </mat-list> + <ng-container *ngIf="panelMode === 'keywordInfos'"> + <mat-nav-list> + <h3 mat-subheader>{{lang.keywordHelp}}</h3> + </mat-nav-list> + <mat-list role="list" style="width: 400px;padding: 5px;"> + <p style="font-size:10px;">{{lang.keywordHelpDesc_11}}</p> + <div style="border:1px black solid; padding:3px;font-size:10px;"> + <b>DESTINATION = @my_primary_entity or DESTINATION in (@subentities[@my_primary_entity])</b> + </div> + <h4 mat-line style="font-weight:bold;font-size:10px;">@user :</h4> + <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_1}}</p> + <h4 mat-line style="font-weight:bold;font-size:10px;">@user_id :</h4> + <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_12}}</p> + <h4 mat-line style="font-weight:bold;font-size:10px;">@email :</h4> + <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_2}}</p> + <h4 mat-line style="font-weight:bold;font-size:10px;">@my_entities :</h4> + <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_3}}</p> + <h4 mat-line style="font-weight:bold;font-size:10px;">@my_primary_entity :</h4> + <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_4}}</p> + <h4 mat-line style="font-weight:bold;font-size:10px;">@subentities[('entity_1',...,'entity_n')] : + </h4> + <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_5}}</p> + <h4 mat-line style="font-weight:bold;font-size:10px;">@parent_entity['entity_id'] :</h4> + <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_6}}</p> + <h4 mat-line style="font-weight:bold;font-size:10px;">@sisters_entities['entity_id'] :</h4> + <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_7}}</p> + <h4 mat-line style="font-weight:bold;font-size:10px;">@entity_type['type'] :</h4> + <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_8}}</p> + <h4 mat-line style="font-weight:bold;font-size:10px;">@all_entities :</h4> + <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_9}}</p> + <h4 mat-line style="font-weight:bold;font-size:10px;">@immediate_children['entity_1',..., + 'entity_id'] : + </h4> + <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_10}}</p> + </mat-list> + </ng-container> + <ng-container *ngIf="panelMode === 'admin_users'"> + <mat-nav-list> + <h3 mat-subheader>{{lang.adminParamsUsers}}</h3> + </mat-nav-list> + <mat-list role="list" style="width: 400px;padding: 5px;"> + <p color="primary" style="text-decoration: underline;"> + {{lang.chooseAllowedGroups}} : + </p> + <mat-selection-list #paramsList (selectionChange)="updatePrivilegeParams(paramsList.selectedOptions.selected)"> + <mat-list-option color="primary" style="font-size: 13px;" checkboxPosition="before" + *ngFor="let authorizedGroup of authorizedGroupsUserParams" + [selected]="authorizedGroup.checked" [value]="authorizedGroup.id"> + {{authorizedGroup.label}} + </mat-list-option> + </mat-selection-list> + </mat-list> + </ng-container> </mat-sidenav> </mat-sidenav-container> </div> \ No newline at end of file diff --git a/src/frontend/app/administration/group/group-administration.component.scss b/src/frontend/app/administration/group/group-administration.component.scss index 60d51e5d83f745005903fc915436b465f72bfd36..0079e44d7e3410bfb5a18f7ba9477afcd4583aee 100644 --- a/src/frontend/app/administration/group/group-administration.component.scss +++ b/src/frontend/app/administration/group/group-administration.component.scss @@ -1,4 +1,10 @@ +@import '../../../css/vars.scss'; + textarea.mat-input-element { padding: 0; margin: 0; +} + +.active { + color: $secondary; } \ No newline at end of file diff --git a/src/frontend/app/administration/group/group-administration.component.ts b/src/frontend/app/administration/group/group-administration.component.ts index d9f4f040bd60545b8490ad62b346418bafd1dfe9..480b4910c31a02bf54b536b87e416a551eb4e8f4 100755 --- a/src/frontend/app/administration/group/group-administration.component.ts +++ b/src/frontend/app/administration/group/group-administration.component.ts @@ -10,9 +10,10 @@ import { MatSort } from '@angular/material/sort'; import { MatTableDataSource } from '@angular/material/table'; import { AppService } from '../../../service/app.service'; import { PrivilegeService } from '../../../service/privileges.service'; -import { tap, catchError, exhaustMap } from 'rxjs/operators'; +import { tap, catchError, exhaustMap, map, finalize } from 'rxjs/operators'; import { of } from 'rxjs'; import { MenuShortcutComponent } from '../../menu/menu-shortcut.component'; +import { MatSelectionList } from '@angular/material'; declare function $j(selector: any): any; @@ -28,6 +29,7 @@ export class GroupAdministrationComponent implements OnInit { lang: any = LANG; loading: boolean = false; + paramsLoading: boolean = false; group: any = { security: {} @@ -42,6 +44,9 @@ export class GroupAdministrationComponent implements OnInit { unitPrivileges: any[] = []; + authorizedGroupsUserParams: any[] = []; + panelMode = 'keywordInfos'; + @ViewChild('paginatorBaskets', { static: false }) paginatorBaskets: MatPaginator; @ViewChild('sortBaskets', { static: true }) sortBaskets: MatSort; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator; @@ -208,8 +213,8 @@ export class GroupAdministrationComponent implements OnInit { resfreshShortcut() { this.headerService.resfreshCurrentUser(); setTimeout(() => { - this.appShortcut.loadShortcuts(); - }, 200); + this.appShortcut.loadShortcuts(); + }, 200); } getCurrentPrivListDiff(serviceId: string) { @@ -298,4 +303,62 @@ export class GroupAdministrationComponent implements OnInit { this.notify.error(err.error.errors); }); } + + openUserParams(id: string) { + this.sidenavRight.toggle(); + if (!this.sidenavRight.opened) { + this.panelMode = ''; + } else { + this.panelMode = id; + this.paramsLoading = true; + this.http.get(`../../rest/groups`).pipe( + map((data: any) => { + data.groups = data.groups.map((group: any) => { + return { + id: group.id, + label: group.group_desc + } + }); + return data; + }), + tap((data: any) => { + this.authorizedGroupsUserParams = data.groups; + }), + exhaustMap(() => this.http.get(`../../rest/groups/${this.group.id}/privileges/${this.panelMode}/parameters?parameter=groups`)), + tap((data: any) => { + const allowedGroups: any[] = data; + this.authorizedGroupsUserParams.forEach(group => { + if (allowedGroups.indexOf(group.id) > -1) { + group.checked = true; + } else { + group.checked = false; + } + }); + }), + finalize(() => this.paramsLoading = false), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } + } + + updatePrivilegeParams(paramList: any) { + let obj = {}; + if (this.panelMode === 'admin_users') { + obj = { + groups: paramList.map((param: any) => param.value) + } + } + this.http.put(`../../rest/groups/${this.group.id}/privileges/${this.panelMode}/parameters`, { parameters: obj }).pipe( + tap(() => { + this.notify.success('parametres modifiés'); + }), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } } diff --git a/src/frontend/app/administration/group/groups-administration.component.ts b/src/frontend/app/administration/group/groups-administration.component.ts index 8f72079595dc0932f7a6c771211f150343dcf67a..9c8959409a7118567bb8d7e622fa5993ff216aaa 100755 --- a/src/frontend/app/administration/group/groups-administration.component.ts +++ b/src/frontend/app/administration/group/groups-administration.component.ts @@ -77,7 +77,7 @@ export class GroupsAdministrationComponent implements OnInit { preDelete(group: any) { if (group.users.length == 0) { - let r = confirm("Etes vous sûr de vouloir supprimer ce groupe ?"); + let r = confirm(this.lang.reallyWantToDeleteThisGroup); if (r) { this.deleteGroup(group); diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts index 52dc701d53f93a4d6aadfe9c54d0070b5745db3a..18d3ac1905556b70ae08d4a3fd7e0fa15689b2e8 100755 --- a/src/frontend/lang/lang-en.ts +++ b/src/frontend/lang/lang-en.ts @@ -1294,4 +1294,8 @@ export const LANG_EN = { "contact_physical" : "Physical contact", "contact_corporate" : "Corporate contact", "contact_internal" : "Internal user", + "goToAdminParams" : "Access to admin settings", + "adminParamsUsers" : "Settings for users administration", + "chooseAllowedGroups" : "Choose allowed groups", + "reallyWantToDeleteThisGroup" : "Do you really want to remove this group ?", }; diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index 6f3eb4b65162469832a181825eb5c3e1fa4f3371..be6dbb324f0675bbbb4cb63586157449e1dc315b 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -1331,4 +1331,8 @@ export const LANG_FR = { "contact_physical" : "Contact physique", "contact_corporate" : "Contact moral", "contact_internal" : "Utilisateur interne", + "goToAdminParams" : "Accéder aux paramètres de l'administration", + "adminParamsUsers" : "Options administration utilisateurs", + "chooseAllowedGroups" : "Choissisez les groupes d'affectation autorisés", + "reallyWantToDeleteThisGroup" : "Êtes-vous sûr de vouloir supprimer ce groupe ?", }; diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts index 3f42e287cf560e7b2236c4af95d81f1511ecca94..27638c1b05f25b40689c29b16547c2ce10cec57c 100755 --- a/src/frontend/lang/lang-nl.ts +++ b/src/frontend/lang/lang-nl.ts @@ -1318,4 +1318,8 @@ export const LANG_NL = { "contact_physical" : "Physical contact", //_TO_TRANSLATE "contact_corporate" : "Corporate contact", //_TO_TRANSLATE "contact_internal" : "Internal user", //_TO_TRANSLATE + "goToAdminParams" : "Access to admin settings", //_TO_TRANSLATE + "adminParamsUsers" : "Settings for users administration", //_TO_TRANSLATE + "chooseAllowedGroups" : "Choose allowed groups", //_TO_TRANSLATE + "reallyWantToDeleteThisGroup" : "Do you really want to remove this group ?", //_TO_TRANSLATE }; diff --git a/src/frontend/service/privileges.service.ts b/src/frontend/service/privileges.service.ts index 468014b5bc2a6008fc430e92773f0856b28760bf..ea1fbfddf4f04f47de184d9d1c1044681e6ba963 100644 --- a/src/frontend/service/privileges.service.ts +++ b/src/frontend/service/privileges.service.ts @@ -21,6 +21,7 @@ interface administration { 'style': string, //icone used interface 'unit': 'organisation' | 'classement' | 'production' | 'supervision' //category of administration 'angular': boolean //to navigate in V1 <=>V2 + 'hasParams' : boolean } interface privilege { @@ -43,7 +44,8 @@ export class PrivilegeService { "route": "/administration/users", "unit": "organisation", "style": "fa fa-user", - "angular" : true + "angular" : true, + "hasParams" : true }, { "id": "admin_groups", @@ -52,7 +54,8 @@ export class PrivilegeService { "route": "/administration/groups", "unit": "organisation", "style": "fa fa-users", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "manage_entities", @@ -61,7 +64,8 @@ export class PrivilegeService { "route": "/administration/entities", "unit": "organisation", "style": "fa fa-sitemap", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_listmodels", @@ -70,7 +74,8 @@ export class PrivilegeService { "route": "/administration/diffusionModels", "unit": "organisation", "style": "fa fa-th-list", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_architecture", @@ -79,7 +84,8 @@ export class PrivilegeService { "route": "/administration/doctypes", "unit": "classement", "style": "fa fa-suitcase", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_tag", @@ -88,7 +94,8 @@ export class PrivilegeService { "route": "index.php?page=manage_tag_list_controller&module=tags", "unit": "classement", "style": "fa fa-tags", - "angular" : false + "angular" : false, + "hasParams" : false }, { "id": "admin_baskets", @@ -97,7 +104,8 @@ export class PrivilegeService { "route": "/administration/baskets", "unit": "production", "style": "fa fa-inbox", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_status", @@ -106,7 +114,8 @@ export class PrivilegeService { "route": "/administration/statuses", "unit": "production", "style": "fa fa-check-circle", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_actions", @@ -115,7 +124,8 @@ export class PrivilegeService { "route": "/administration/actions", "unit": "production", "style": "fa fa-exchange-alt", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_contacts", @@ -124,7 +134,8 @@ export class PrivilegeService { "route": "index.php?page=admin_contacts&admin=contacts", "unit": "production", "style": "fa fa-book", - "angular" : false + "angular" : false, + "hasParams" : false }, { "id": "admin_priorities", @@ -133,7 +144,8 @@ export class PrivilegeService { "route": "/administration/priorities", "unit": "production", "style": "fa fa-clock", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_templates", @@ -142,7 +154,8 @@ export class PrivilegeService { "route": "/administration/templates", "unit": "production", "style": "fa fa-file-alt", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_indexing_models", @@ -151,7 +164,8 @@ export class PrivilegeService { "route": "/administration/indexingModels", "unit": "production", "style": "fab fa-wpforms", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_custom_fields", @@ -160,7 +174,8 @@ export class PrivilegeService { "route": "/administration/customFields", "unit": "production", "style": "fa fa-code", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_notif", @@ -169,7 +184,8 @@ export class PrivilegeService { "route": "/administration/notifications", "unit": "production", "style": "fa fa-bell", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "update_status_mail", @@ -178,7 +194,8 @@ export class PrivilegeService { "route": "/administration/update-status", "unit": "supervision", "style": "fa fa-envelope-square", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_docservers", @@ -187,7 +204,8 @@ export class PrivilegeService { "route": "/administration/docservers", "unit": "supervision", "style": "fa fa-hdd", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_parameters", @@ -196,7 +214,8 @@ export class PrivilegeService { "route": "/administration/parameters", "unit": "supervision", "style": "fa fa-wrench", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_password_rules", @@ -205,7 +224,8 @@ export class PrivilegeService { "route": "/administration/securities", "unit": "supervision", "style": "fa fa-lock", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_email_server", @@ -214,7 +234,8 @@ export class PrivilegeService { "route": "/administration/sendmail", "unit": "supervision", "style": "fa fa-mail-bulk", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_shippings", @@ -223,7 +244,8 @@ export class PrivilegeService { "route": "/administration/shippings", "unit": "supervision", "style": "fa fa-shipping-fast", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_reports", @@ -232,7 +254,8 @@ export class PrivilegeService { "route": "/administration/reports", "unit": "supervision", "style": "fa fa-chart-area", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "view_history", @@ -241,7 +264,8 @@ export class PrivilegeService { "route": "/administration/history", "unit": "supervision", "style": "fa fa-history", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "view_history_batch", @@ -250,7 +274,8 @@ export class PrivilegeService { "route": "/administration/history", "unit": "supervision", "style": "fa fa-history", - "angular" : true + "angular" : true, + "hasParams" : false }, { "id": "admin_update_control", @@ -259,7 +284,8 @@ export class PrivilegeService { "route": "/administration/versions-update", "unit": "supervision", "style": "fa fa-sync", - "angular" : true + "angular" : true, + "hasParams" : false } ];