From 82eb0204c2bbe9435e0bee52a70cac7fe77566bd Mon Sep 17 00:00:00 2001 From: devanshu052000 Date: Wed, 21 May 2025 15:55:02 +0530 Subject: [PATCH] Made the service functions reusable for both query as well as page permissions --- server/ee | 2 +- .../modules/app-permissions/constants/index.ts | 6 ++++++ .../app-permissions/interfaces/IService.ts | 15 +++++++++++---- server/src/modules/app-permissions/service.ts | 8 ++++---- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/server/ee b/server/ee index 0f2e1e5905..c1d051b043 160000 --- a/server/ee +++ b/server/ee @@ -1 +1 @@ -Subproject commit 0f2e1e5905e4a731b45f962983aa5eff745c0b35 +Subproject commit c1d051b04364f9a2db333b3cffb77d611d50c8eb diff --git a/server/src/modules/app-permissions/constants/index.ts b/server/src/modules/app-permissions/constants/index.ts index 7d9d067af7..ff5063e948 100644 --- a/server/src/modules/app-permissions/constants/index.ts +++ b/server/src/modules/app-permissions/constants/index.ts @@ -4,6 +4,12 @@ export enum PAGE_PERMISSION_TYPE { ALL = 'ALL', } +export enum PERMISSION_ENTITY_TYPE { + PAGE = 'PAGE', + QUERY = 'QUERY', + COMPONENT = 'COMPONENT', +} + export enum FEATURE_KEY { FETCH_USERS = 'fetch_users', FETCH_USER_GROUPS = 'fetch_user_groups', diff --git a/server/src/modules/app-permissions/interfaces/IService.ts b/server/src/modules/app-permissions/interfaces/IService.ts index cad5fef726..58a64dfc68 100644 --- a/server/src/modules/app-permissions/interfaces/IService.ts +++ b/server/src/modules/app-permissions/interfaces/IService.ts @@ -1,16 +1,23 @@ import { User } from '@entities/user.entity'; import { CreatePagePermissionDto } from '../dto'; +import { PERMISSION_ENTITY_TYPE } from '../constants'; export interface IAppPermissionsService { fetchUsers(appId: string, user: User): Promise; fetchUserGroups(appId: string, user: User): Promise; - fetchPagePermissions(pageId: string): Promise; + fetchAppPermissions(type: PERMISSION_ENTITY_TYPE, pageId: string): Promise; - createPagePermissions(pageId: string, body: CreatePagePermissionDto): Promise; + createAppPermissions(type: PERMISSION_ENTITY_TYPE, pageId: string, body: CreatePagePermissionDto): Promise; - updatePagePermissions(appId: string, pageId: string, body: CreatePagePermissionDto, user: User): Promise; + updateAppPermissions( + type: PERMISSION_ENTITY_TYPE, + appId: string, + pageId: string, + body: CreatePagePermissionDto, + user: User + ): Promise; - deletePagePermissions(pageId: string): Promise; + deleteAppPermissions(type: PERMISSION_ENTITY_TYPE, pageId: string): Promise; } diff --git a/server/src/modules/app-permissions/service.ts b/server/src/modules/app-permissions/service.ts index c6b5bc640d..637e144c8e 100644 --- a/server/src/modules/app-permissions/service.ts +++ b/server/src/modules/app-permissions/service.ts @@ -13,19 +13,19 @@ export class AppPermissionsService implements IAppPermissionsService { throw new Error('Method not implemented.'); } - async fetchPagePermissions(pageId) { + async fetchAppPermissions(type, pageId) { throw new Error('Method not implemented.'); } - async createPagePermissions(pageId, body) { + async createAppPermissions(type, pageId, body) { throw new Error('Method not implemented.'); } - async updatePagePermissions(appId, pageId, body, user) { + async updateAppPermissions(type, appId, pageId, body, user) { throw new Error('Method not implemented.'); } - async deletePagePermissions(pageId) { + async deleteAppPermissions(type, pageId) { throw new Error('Method not implemented.'); } }