@chat21/chat21-ionic 3.4.33 → 3.4.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/package.json +1 -1
  3. package/src/app/app.component.ts +3 -0
  4. package/src/app/components/canned-response/canned-response.component.html +26 -23
  5. package/src/app/components/canned-response/canned-response.component.scss +0 -2
  6. package/src/app/components/canned-response/canned-response.component.ts +3 -1
  7. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +1 -1
  8. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +3 -0
  9. package/src/app/components/conversation-info/info-group/info-group.component.ts +23 -21
  10. package/src/app/components/conversations-list/header-conversations-list/header-conversations-list.component.html +1 -1
  11. package/src/app/components/conversations-list/header-conversations-list/header-conversations-list.component.ts +5 -1
  12. package/src/app/components/navbar/navbar.component.html +3 -3
  13. package/src/app/components/navbar/navbar.component.ts +29 -39
  14. package/src/app/components/project-item/project-item.component.ts +1 -1
  15. package/src/app/components/sidebar/sidebar.component.html +64 -64
  16. package/src/app/components/sidebar/sidebar.component.ts +110 -119
  17. package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +2 -1
  18. package/src/app/modals/create-ticket/create-ticket.page.ts +4 -2
  19. package/src/app/pages/conversation-detail/conversation-detail.page.html +4 -2
  20. package/src/app/pages/conversation-detail/conversation-detail.page.ts +45 -3
  21. package/src/app/pages/conversations-list/conversations-list.page.html +2 -0
  22. package/src/app/pages/conversations-list/conversations-list.page.ts +36 -4
  23. package/src/app/services/project_users/project-users.service.spec.ts +16 -0
  24. package/src/app/services/project_users/project-users.service.ts +63 -0
  25. package/src/app/services/projects/project.service.ts +1 -1
  26. package/src/app/services/tiledesk/tiledesk.service.ts +0 -17
  27. package/src/app/utils/permissions.constants.ts +138 -0
  28. package/src/app/utils/project-utils.ts +2 -2
  29. package/src/app/utils/utils.ts +17 -0
  30. package/src/assets/i18n/ar.json +4 -0
  31. package/src/assets/i18n/az.json +4 -0
  32. package/src/assets/i18n/de.json +4 -0
  33. package/src/assets/i18n/en.json +4 -0
  34. package/src/assets/i18n/es.json +4 -0
  35. package/src/assets/i18n/fr.json +4 -0
  36. package/src/assets/i18n/it.json +4 -0
  37. package/src/assets/i18n/kk.json +4 -0
  38. package/src/assets/i18n/pt.json +4 -0
  39. package/src/assets/i18n/ru.json +4 -0
  40. package/src/assets/i18n/sr.json +4 -0
  41. package/src/assets/i18n/sv.json +4 -0
  42. package/src/assets/i18n/tr.json +4 -0
  43. package/src/assets/i18n/uk.json +4 -0
  44. package/src/assets/i18n/uz.json +4 -0
  45. package/src/chat21-core/models/{project_user.ts → projectUsers.ts} +13 -11
  46. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +3 -0
package/CHANGELOG.md CHANGED
@@ -8,6 +8,9 @@
8
8
  ### **Copyright**:
9
9
  *Tiledesk SRL*
10
10
 
11
+ # 3.4.34 in PROD
12
+ - **added**: role handling in the affected components (sidebar, navbar, conversations list, conversation detail) using shared `hasRole` checks and `ProjectUser.rolePermissions`.
13
+
11
14
  # 3.4.33 in PROD
12
15
 
13
16
  # 3.4.32 in PROD
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.4.33",
4
+ "version": "3.4.34",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -44,6 +44,7 @@ import { conversationToMessage } from 'src/chat21-core/utils/utils-message';
44
44
  import { ProjectService } from './services/projects/project.service';
45
45
  import { ContactsService } from './services/contacts/contacts.service';
46
46
  import { TiledeskService } from './services/tiledesk/tiledesk.service';
47
+ import { ProjectUsersService } from './services/project_users/project-users.service';
47
48
 
48
49
  @Component({
49
50
  selector: 'app-root',
@@ -141,6 +142,7 @@ export class AppComponent implements OnInit {
141
142
  /**TILEDESK SERVICES */
142
143
  private tiledeskService: TiledeskService,
143
144
  private projectService: ProjectService,
145
+ private projectUsersService: ProjectUsersService,
144
146
  private contactsService: ContactsService
145
147
  ) {
146
148
 
@@ -1181,6 +1183,7 @@ export class AppComponent implements OnInit {
1181
1183
 
1182
1184
  this.tiledeskService.initialize(serverBaseURL)
1183
1185
  this.projectService.initialize(serverBaseURL)
1186
+ this.projectUsersService.initialize(serverBaseURL)
1184
1187
  this.contactsService.initialize(serverBaseURL)
1185
1188
 
1186
1189
 
@@ -1,20 +1,30 @@
1
1
  <div>
2
- <div class="canned-list" *ngIf="tagsCannedFilter.length > 0">
3
- <ion-item button="true" [ngClass]="{'is_active_item': i == arrowkeyLocation}" lines="none"
4
- class="canned-item no-ripple border" id="{{'canned-item_'+ i }}"
5
- *ngFor="let canned of tagsCannedFilter; let i = index;"
6
- (click)="onClickCannedFN(canned, $event)">
7
- <div class="cannedContent">
8
- <ion-input [class.readonly]="canned?.disabled" [readonly]="canned?.disabled" type="text" [(ngModel)]="canned.title" class="title" id="{{'titleCanned_'+canned._id}}" #title></ion-input>
9
- <ion-input [class.readonly]="canned?.disabled" [readonly]="canned?.disabled" type="text" [(ngModel)]="canned.text" class="text truncate"></ion-input>
2
+ <div class="canned-list" *ngIf="!showLoading">
3
+ <span *ngIf="tagsCannedFilter.length > 0">
4
+ <ion-item button="true" [ngClass]="{'is_active_item': i == arrowkeyLocation}" lines="none"
5
+ class="canned-item no-ripple border" id="{{'canned-item_'+ i }}"
6
+ *ngFor="let canned of tagsCannedFilter; let i = index;"
7
+ (click)="onClickCannedFN(canned, $event)">
8
+ <div class="cannedContent">
9
+ <ion-input [class.readonly]="canned?.disabled" [readonly]="canned?.disabled" type="text" [(ngModel)]="canned.title" class="title" id="{{'titleCanned_'+canned._id}}" #title></ion-input>
10
+ <ion-input [class.readonly]="canned?.disabled" [readonly]="canned?.disabled" type="text" [(ngModel)]="canned.text" class="text truncate"></ion-input>
11
+ </div>
12
+ <!-- <ion-icon class="canned-item-icon" name="pin" src="assets/images/pin.svg" slot=end *ngIf="canned.pinned" (click)="onPinCanned(canned, $event)"></ion-icon>
13
+ <ion-icon class="canned-item-icon" name="pin" src="assets/images/pinned.svg" slot=end (click)="onUnPinCanned(canned, $event)"></ion-icon> -->
14
+ <ion-icon class="canned-item-icon" name="checkmark-sharp" slot=end *ngIf="(canned.createdBy === loggedUser.uid && !canned.disabled) && roles[PERMISSIONS.CANNED_RESPONSES_UPDATE]" (click)="onConfirmEditCanned(canned, $event)"></ion-icon>
15
+ <ion-icon class="canned-item-icon" name="pencil-sharp" slot=end *ngIf="(canned.createdBy === loggedUser.uid && canned.disabled) && roles[PERMISSIONS.CANNED_RESPONSES_UPDATE]" (click)="onEditCanned(canned, $event)"></ion-icon>
16
+ <ion-icon class="canned-item-icon" name="trash-bin-outline" slot=end *ngIf="(canned.createdBy === loggedUser.uid) && roles[PERMISSIONS.CANNED_RESPONSES_DELETE]" (click)="onDeleteCanned(canned, $event)"></ion-icon>
17
+ </ion-item>
18
+ </span>
19
+ <div class="no-data" *ngIf="tagsCannedFilter.length === 0">
20
+ <div class="container">
21
+ <ion-item button="false" lines="none" class="canned-item no-ripple border">
22
+ <ion-icon name="cloud-offline" slot="start"></ion-icon>
23
+ <ion-label>{{translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE')}}</ion-label>
24
+ </ion-item>
10
25
  </div>
11
- <!-- <ion-icon class="canned-item-icon" name="pin" src="assets/img/pin.svg" slot=end *ngIf="canned.pinned" (click)="onPinCanned(canned, $event)"></ion-icon>
12
- <ion-icon class="canned-item-icon" name="pin" src="assets/img/pinned.svg" slot=end (click)="onUnPinCanned(canned, $event)"></ion-icon> -->
13
- <ion-icon class="canned-item-icon" name="checkmark-sharp" slot=end *ngIf="canned.createdBy === loggedUser.uid && !canned.disabled" (click)="onConfirmEditCanned(canned, $event)"></ion-icon>
14
- <ion-icon class="canned-item-icon" name="pencil-sharp" slot=end *ngIf="canned.createdBy === loggedUser.uid && canned.disabled" (click)="onEditCanned(canned, $event)"></ion-icon>
15
- <ion-icon class="canned-item-icon" name="trash-bin-outline" slot=end *ngIf="canned.createdBy === loggedUser.uid" (click)="onDeleteCanned(canned, $event)"></ion-icon>
16
- </ion-item>
17
- <ion-item class="canned-item add-canned-response-wpr" button="true" lines="none" (click)="onClickAddCannedResponseFN()">
26
+ </div>
27
+ <ion-item *ngIf="roles[PERMISSIONS.CANNED_RESPONSES_CREATE]" class="canned-item add-canned-response-wpr" button="true" lines="none" (click)="onClickAddCannedResponseFN()">
18
28
  <ion-icon class="add-canned-response-icon" name="flash-outline"></ion-icon>
19
29
  <span class="add-canned-response-add-icon">+</span>
20
30
  <label class="add-canned-response-label" >{{translationMap?.get('AddNewCannedResponse')}}</label>
@@ -33,12 +43,5 @@
33
43
  <div class="label">{{translationMap.get('LABEL_LOADING')}}</div>
34
44
  </div>
35
45
  </div>
36
- <div class="no-data" *ngIf="tagsCannedFilter.length === 0 && !showLoading">
37
- <div class="container">
38
- <ion-item button="false" lines="none" class="canned-item no-ripple border">
39
- <ion-icon name="cloud-offline" slot="start"></ion-icon>
40
- <ion-label>{{translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE')}}</ion-label>
41
- </ion-item>
42
- </div>
43
- </div>
46
+
44
47
  </div>
@@ -278,7 +278,5 @@ ion-item {
278
278
  display: flex;
279
279
  justify-content: center;
280
280
  flex-direction: column;
281
- align-items: center;
282
-
283
281
  }
284
282
  }
@@ -9,6 +9,7 @@ import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk
9
9
  import { compareValues, htmlEntities } from 'src/chat21-core/utils/utils';
10
10
  import { getProjectIdSelectedConversation } from 'src/chat21-core/utils/utils-message';
11
11
  import { PLAN_NAME } from 'src/chat21-core/utils/constants';
12
+ import { PERMISSIONS } from 'src/app/utils/permissions.constants';
12
13
 
13
14
  @Component({
14
15
  selector: 'app-canned-response',
@@ -21,7 +22,7 @@ export class CannedResponseComponent implements OnInit {
21
22
  @Input() conversationWith: string;
22
23
  @Input() conversationWithFullname: string;
23
24
  @Input() currentString: string;
24
- @Input() canShowCanned: boolean = true;
25
+ @Input() roles: Array<string>;
25
26
  @Input() stylesMap: Map<string, string>;
26
27
  @Input() translationMap: Map<string, string>;
27
28
  @Output() onLoadedCannedResponses = new EventEmitter<[any]>();
@@ -36,6 +37,7 @@ export class CannedResponseComponent implements OnInit {
36
37
 
37
38
  public arrowkeyLocation = -1
38
39
 
40
+ PERMISSIONS = PERMISSIONS
39
41
 
40
42
  private logger: LoggerService = LoggerInstance.getInstance();
41
43
  constructor(
@@ -57,7 +57,7 @@
57
57
  <div class="buttons-left">
58
58
 
59
59
  <!-- CANNED RESPONSES -->
60
- <ng-container *ngIf="areVisibleCAR && supportMode">
60
+ <ng-container *ngIf="areVisibleCAR && supportMode && cannedSection">
61
61
  <div class="canned-responses-btn-wpr" tooltip="{{translationMap?.get('CANNED_RESPONSES')}}" placement="top">
62
62
  <ion-button ion-button fill="clear" class="canned-responses-btn" (click)="openCannedResponses()"
63
63
  [disabled]="!conversationWith?.startsWith(CHANNEL_TYPE.SUPPORT_GROUP) || disableTextarea">
@@ -26,6 +26,7 @@ import { CopilotService } from 'src/app/services/copilot/copilot.service';
26
26
  import { BRAND_BASE_INFO } from 'src/app/utils/utils-resources';
27
27
  import { ProjectService } from 'src/app/services/projects/project.service';
28
28
  import { Project } from 'src/chat21-core/models/projects';
29
+ import { ProjectUser } from 'src/chat21-core/models/projectUsers';
29
30
 
30
31
 
31
32
  @Component({
@@ -49,6 +50,7 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
49
50
  @ViewChild('fileInput', { static: false }) fileInput: any;
50
51
 
51
52
  @Input() loggedUser: UserModel;
53
+ @Input() projectUser: ProjectUser;
52
54
  @Input() conversationWith: string;
53
55
  @Input() channelType: string;
54
56
  @Input() channel: string;
@@ -62,6 +64,7 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
62
64
  @Input() offlineMsgEmail: boolean;
63
65
  @Input() whatsappTemplatesSection: boolean;
64
66
  @Input() isOpenInfoConversation: boolean;
67
+ @Input() cannedSection: boolean;
65
68
  @Input() stylesMap: Map<string, string>;
66
69
  @Input() translationMap: Map<string, string>;
67
70
  @Input() dropEvent: any;
@@ -151,27 +151,29 @@ export class InfoGroupComponent implements OnInit, AfterViewInit, OnChanges {
151
151
  });
152
152
 
153
153
  this.contactsService.loadContactDetail(key).pipe(takeUntil(this.unsubscribe$)).subscribe(user => {
154
- this.logger.log('InfoGroupComponent group detail loadContactDetail RES', user);
155
- // this.logger.log('InfoGroupComponent group detail this.presenceService.BSIsOnline.value()', this.presenceService.BSIsOnline.getValue);
156
-
157
- user.imageurl = this.imageRepoService.getImagePhotoUrl(key)
158
- // this.member_array.push({ userid: user.uid, avatar: user.avatar, color: user.color, email: user.email, fullname: user.fullname, imageurl: user.imageurl, userOnline: isOnline })
159
- var index = this.member_array.findIndex(m => m.userid === user.uid);
160
- this.logger.log('InfoGroupComponent member_array first of push index', index);
161
- this.logger.log('InfoGroupComponent member_array first of push', this.member_array);
162
- if (index === -1) {
163
- this.member_array.push(
164
- {
165
- userid: user.uid,
166
- avatar: user.avatar,
167
- color: user.color,
168
- email: user.email,
169
- fullname: user.fullname,
170
- imageurl: user.imageurl,
171
- userOnline: members_isonline_array[user.uid]['isSignin']
172
- })
173
- } else {
174
- this.logger.log('InfoGroupComponent member already exist in member_array');
154
+ if(user){
155
+ this.logger.log('InfoGroupComponent group detail loadContactDetail RES', user);
156
+ // this.logger.log('InfoGroupComponent group detail this.presenceService.BSIsOnline.value()', this.presenceService.BSIsOnline.getValue);
157
+
158
+ user.imageurl = this.imageRepoService.getImagePhotoUrl(key)
159
+ // this.member_array.push({ userid: user.uid, avatar: user.avatar, color: user.color, email: user.email, fullname: user.fullname, imageurl: user.imageurl, userOnline: isOnline })
160
+ var index = this.member_array.findIndex(m => m.userid === user.uid);
161
+ this.logger.log('InfoGroupComponent member_array first of push index', index);
162
+ this.logger.log('InfoGroupComponent member_array first of push', this.member_array);
163
+ if (index === -1) {
164
+ this.member_array.push(
165
+ {
166
+ userid: user.uid,
167
+ avatar: user.avatar,
168
+ color: user.color,
169
+ email: user.email,
170
+ fullname: user.fullname,
171
+ imageurl: user.imageurl,
172
+ userOnline: members_isonline_array[user.uid]['isSignin']
173
+ })
174
+ } else {
175
+ this.logger.log('InfoGroupComponent member already exist in member_array');
176
+ }
175
177
  }
176
178
  }, (error) => {
177
179
  this.logger.error('InfoGroupComponent group detail loadContactDetail - ERROR ', error);
@@ -34,7 +34,7 @@
34
34
  <!-- <ion-icon name="file-tray-full-outline"></ion-icon> -->
35
35
  </ion-button>
36
36
 
37
- <ion-button *ngIf="writeto_btn" ion-button fill="clear" (click)="onOpenContactsDirectory($event)"
37
+ <ion-button *ngIf="writeto_btn && isVisibleCNT && roles?.[PERMISSIONS.LEADS_READ]" ion-button fill="clear" (click)="onOpenContactsDirectory($event)"
38
38
  tooltip="{{translationMap?.get('ViewContactsList')}}" placement="bottom">
39
39
  <ion-icon slot="icon-only" name="create-outline"></ion-icon>
40
40
  <!-- <ion-icon slot="icon-only" name="people-outline"></ion-icon> -->
@@ -1,3 +1,4 @@
1
+ import { PERMISSIONS } from 'src/app/utils/permissions.constants';
1
2
  import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
2
3
  import { ModalController } from '@ionic/angular'
3
4
  import { EventsService } from 'src/app/services/events-service'
@@ -17,6 +18,8 @@ export class HeaderConversationsList implements OnInit {
17
18
  @Input() sound_btn: string;
18
19
  @Input() isMobile: boolean;
19
20
  @Input() isVisibleTKT: boolean = true;
21
+ @Input() isVisibleCNT: boolean = true;;
22
+ @Input() roles: Array<string>;
20
23
  @Output() onSoundChange = new EventEmitter<string>()
21
24
  @Output() openContactsDirectory = new EventEmitter()
22
25
  @Output() openProfileInfo = new EventEmitter()
@@ -24,6 +27,7 @@ export class HeaderConversationsList implements OnInit {
24
27
  createTicketModal = null
25
28
  public translationMap: Map<string, string>;
26
29
 
30
+ PERMISSIONS = PERMISSIONS;
27
31
  constructor(
28
32
  public events: EventsService,
29
33
  public modalController: ModalController,
@@ -62,7 +66,7 @@ export class HeaderConversationsList implements OnInit {
62
66
  // }
63
67
 
64
68
  ngOnInit() {
65
- // console.log('DDP HEADER SUPPORT MODE ', this.supportMode)
69
+ console.log('DDP HEADER SUPPORT MODE ', this.roles)
66
70
  }
67
71
 
68
72
  // START @Output() //
@@ -5,7 +5,7 @@
5
5
  </div>
6
6
  <div class="navbar-right">
7
7
  <!-- test site -->
8
- <ng-container *ngIf="project">
8
+ <ng-container *ngIf="project && roles?.[PERMISSIONS.SIMULATE_CONV]">
9
9
  <button class="btn simulate-visitor-btn" (click)="testWidgetPage()">
10
10
  <i class="material-icons">play_arrow</i>
11
11
  <!-- {{translationsMap?.get('NAVBAR.SIMULATE_VISITOR')}} -->
@@ -23,7 +23,7 @@
23
23
  </ng-container>
24
24
 
25
25
  <!-- ------ PROJECTS DROPDOWN ------ -->
26
- <ng-container *ngIf="project">
26
+ <ng-container *ngIf="project && roles?.[PERMISSIONS.CHANGE_PROJECT]">
27
27
  <li>
28
28
  <button class="btn dropdown-toggle project-dropdown" (click)="toggleProjectsDropdown()">
29
29
  <span class="project-dropdown" style="text-transform: none"> {{ project?.id_project?.name }} </span>
@@ -49,7 +49,7 @@
49
49
  </li>
50
50
 
51
51
  <!-- ADD PROJECT -->
52
- <li id="navbar_create_prjct" *ngIf="MT === true" (click)="onClickDropdownOption('addProject')" class="add-project">
52
+ <li id="navbar_create_prjct" *ngIf="isVisibleMT" (click)="onClickDropdownOption('addProject')" class="add-project">
53
53
  <a>
54
54
  <i class="material-icons">add_circle_outline </i>
55
55
  {{translationsMap?.get('NAVBAR.ADD_PROJECT')}}
@@ -7,10 +7,13 @@ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service
7
7
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
8
8
  import { Project } from 'src/chat21-core/models/projects';
9
9
  import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
10
+ import { ProjectUsersService } from 'src/app/services/project_users/project-users.service';
11
+ import { ProjectUser } from 'src/chat21-core/models/projectUsers';
12
+ import { PERMISSIONS } from 'src/app/utils/permissions.constants';
13
+ import { getOSCode, hasRole } from 'src/app/utils/utils';
10
14
  import { getUserStatusFromProjectUser } from 'src/chat21-core/utils/utils';
11
15
  import { TEAMMATE_STATUS } from 'src/chat21-core/utils/constants';
12
16
  import { WebsocketService } from 'src/app/services/websocket/websocket.service';
13
- import { ProjectUser } from 'src/chat21-core/models/project_user';
14
17
 
15
18
  @Component({
16
19
  selector: 'app-navbar',
@@ -36,10 +39,14 @@ export class NavbarComponent implements OnInit {
36
39
  public TEAMMATE_STATUS = TEAMMATE_STATUS
37
40
  private public_Key: string;
38
41
  public isVisible: boolean;
39
- public MT: boolean;
42
+ public isVisibleMT: boolean;
40
43
 
44
+ public projectUser: ProjectUser;
45
+ public roles: { [key: string]: boolean }
46
+ PERMISSIONS = PERMISSIONS;
41
47
  constructor(
42
48
  private projectService: ProjectService,
49
+ public projectUsersService: ProjectUsersService,
43
50
  private tiledeskAuthService: TiledeskAuthService,
44
51
  private appConfigProvider: AppConfigProvider,
45
52
  private translateService: CustomTranslateService,
@@ -109,11 +116,14 @@ export class NavbarComponent implements OnInit {
109
116
  }
110
117
 
111
118
  getStoredProjectAndUserRole() {
112
- this.events.subscribe('storage:last_project',project =>{
119
+ this.events.subscribe('storage:last_project',async (project) =>{
113
120
  this.logger.log('[NAVBAR] stored_project ', project)
114
121
  if (project && project !== 'undefined') {
115
122
  this.project = project;
116
123
  this.USER_ROLE = project.role;
124
+ this.projectUser = await this.projectUsersService.getProjectUserByProjectId(project.id_project.id)
125
+ this.roles = this.checkRoles()
126
+ console.log('[SIDEBAR] roles ', this.roles)
117
127
  }
118
128
  })
119
129
  }
@@ -121,44 +131,24 @@ export class NavbarComponent implements OnInit {
121
131
  getOSCODE() {
122
132
  this.public_Key = this.appConfigProvider.getConfig().t2y12PruGU9wUtEGzBJfolMIgK;
123
133
  this.logger.log('[NAVBAR] AppConfigService getAppConfig public_Key', this.public_Key)
124
- this.logger.log('[NAVBAR] public_Key', this.public_Key)
125
-
126
- let keys = this.public_Key.split("-");
127
- // this.logger.log('PUBLIC-KEY (Navbar) - public_Key keys', keys)
128
-
129
- keys.forEach(key => {
130
- // this.logger.log('NavbarComponent public_Key key', key)
131
- if (key.includes("PAY")) {
132
- // this.logger.log('PUBLIC-KEY (Navbar) - key', key);
133
- let pay = key.split(":");
134
- // this.logger.log('PUBLIC-KEY (Navbar) - pay key&value', pay);
135
- if (pay[1] === "F") {
136
- this.isVisible = false;
137
- // this.logger.log('PUBLIC-KEY (Navbar) - pay isVisible', this.isVisible);
138
- } else {
139
- this.isVisible = true;
140
- // this.logger.log('PUBLIC-KEY (Navbar) - pay isVisible', this.isVisible);
141
- }
142
- }
143
-
144
- if (key.includes("MTT")) {
145
- // this.logger.log('PUBLIC-KEY (Navbar) - key', key);
146
- let mt = key.split(":");
147
- // this.logger.log('PUBLIC-KEY (Navbar) - mt key&value', mt);
148
- if (mt[1] === "F") {
149
- this.MT = false;
150
- // this.logger.log('PUBLIC-KEY (Navbar) - mt is', this.MT);
151
- } else {
152
- this.MT = true;
153
- // this.logger.log('PUBLIC-KEY (Navbar) - mt is', this.MT);
154
- }
155
- }
156
- });
134
+
135
+ this.isVisibleMT = getOSCode("MTT", this.public_Key);
136
+
137
+ }
138
+
139
+ checkRoles(): { [key: string]: boolean } {
140
+ const permissionKeys = [
141
+ 'CHANGE_PROJECT',
142
+ 'SIMULATE_CONV',
143
+ ] as const;
157
144
 
158
- if (!this.public_Key.includes("MTT")) {
159
- this.MT = false;
160
- // this.logger.log('PUBLIC-KEY (Navbar) - mt is', this.MT);
145
+ const roles: { [key: string]: boolean } = {};
146
+ for (const key of permissionKeys) {
147
+ const permission = PERMISSIONS[key];
148
+ roles[permission] = hasRole(this.projectUser, permission);
161
149
  }
150
+
151
+ return roles;
162
152
 
163
153
  }
164
154
 
@@ -15,7 +15,7 @@ import { AppConfigProvider } from 'src/app/services/app-config';
15
15
  import { ConvertRequestToConversation } from 'src/chat21-core/utils/convertRequestToConversation';
16
16
  import { compareValues, getUserStatusFromProjectUser } from 'src/chat21-core/utils/utils';
17
17
  import { ProjectService } from 'src/app/services/projects/project.service';
18
- import { ProjectUser } from 'src/chat21-core/models/project_user';
18
+ import { ProjectUser } from 'src/chat21-core/models/projectUsers';
19
19
 
20
20
  @Component({
21
21
  selector: 'app-project-item',