From 3c15cc83d465ad0387acefc6c019a6cd72ab90c3 Mon Sep 17 00:00:00 2001 From: Rahul K R Date: Tue, 30 Jan 2024 10:07:34 +0530 Subject: [PATCH 1/2] QA blocker --- src/app/core/constants/permissionsConstant.ts | 4 +- .../services/permission/permission.service.ts | 53 +++++++------------ 2 files changed, 20 insertions(+), 37 deletions(-) diff --git a/src/app/core/constants/permissionsConstant.ts b/src/app/core/constants/permissionsConstant.ts index 46340cf6..31be5e69 100644 --- a/src/app/core/constants/permissionsConstant.ts +++ b/src/app/core/constants/permissionsConstant.ts @@ -1,5 +1,5 @@ export const permissions = { - MANAGE_USER: 'mentor_listing', + MANAGE_USER: 'manage_user', MANAGE_SESSION: 'manage_session', }; export const actions = { @@ -16,7 +16,7 @@ export const manageSessionAction = { }; export const manageUserAction = { USER_ACTIONS: [ - actions.GET, + actions.POST, actions.DELETE ], }; diff --git a/src/app/core/services/permission/permission.service.ts b/src/app/core/services/permission/permission.service.ts index a7eb41d2..7948ce38 100644 --- a/src/app/core/services/permission/permission.service.ts +++ b/src/app/core/services/permission/permission.service.ts @@ -1,39 +1,22 @@ import { Injectable } from '@angular/core'; import { LocalStorageService } from '../localstorage.service'; import { localKeys } from '../../constants/localStorage.keys'; -import { CommonRoutes } from 'src/global.routes'; -import { manageSessionAction, manageUserAction, permissions } from '../../constants/permissionsConstant'; @Injectable({ providedIn: 'root', }) export class PermissionService { -public userPermissions:any[] = [ - { - title: 'MANAGE_USER', - url: CommonRoutes.ADMIN + '/' + CommonRoutes.MANAGE_USER, - icon: 'people-outline', - module: permissions.MANAGE_USER, - request_type: manageUserAction.USER_ACTIONS, - }, - { - title: 'MANAGE_SESSION', - url: CommonRoutes.ADMIN + '/' + CommonRoutes.MANAGE_SESSION, - icon: 'people-outline', - module: permissions.MANAGE_SESSION, - request_type: manageSessionAction.SESSION_ACTIONS, - }, - ]; + userPermissions:any = []; constructor(private localStorage: LocalStorageService){} async hasPermission(permissions: any): Promise { - // if(!this.userPermissions.length){ - // await this.fetchPermissions().then((res) =>{ - // this.userPermissions = res; - // }) - // } + if(!this.userPermissions.length){ + await this.fetchPermissions().then((res) =>{ + this.userPermissions = res; + }) + } for (let userPermission of this.userPermissions) { if (permissions && userPermission.request_type.length && permissions.module === userPermission.module) { if (permissions.action.every((value: any) => userPermission.request_type.includes(value))) { @@ -45,17 +28,17 @@ public userPermissions:any[] = [ } } - // async fetchPermissions():Promise { - // return new Promise((resolve, reject) => { - // try { - // this.localStorage.getLocalData(localKeys.USER_DETAILS) - // .then(async (data) => { - // if(data) { - // resolve(data?.permissions); - // } - // }) - // } catch (error) {} - // }); + async fetchPermissions():Promise { + return new Promise((resolve, reject) => { + try { + this.localStorage.getLocalData(localKeys.USER_DETAILS) + .then(async (data) => { + if(data) { + resolve(data?.permissions); + } + }) + } catch (error) {} + }); - // } + } } From ea0bf09960877e22c2eb99e6949d147c6fa3632d Mon Sep 17 00:00:00 2001 From: Rahul K R Date: Tue, 30 Jan 2024 23:00:40 +0530 Subject: [PATCH 2/2] session card --- .../components/session-card/session-card.component.html | 6 +++++- src/assets/i18n/en.json | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/shared/components/session-card/session-card.component.html b/src/app/shared/components/session-card/session-card.component.html index 76bab89b..d287d4b9 100644 --- a/src/app/shared/components/session-card/session-card.component.html +++ b/src/app/shared/components/session-card/session-card.component.html @@ -1,11 +1,15 @@ - + {{data?.status?.value| titlecase}} {{"ASSIGNED"|translate}} + + + {{"INVITED"|translate}} +
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 5804862b..4df46e52 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -245,5 +245,6 @@ "ASSIGNED_BY":"Assigned by", "INVITED_BY" : "Invited by", "MENTEE_LIST":"Mentee list", - "ASSIGNED": "Assigned" + "ASSIGNED": "Assigned", + "INVITED": "Invited" } \ No newline at end of file