mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
Added API to get users for an app with view access
This commit is contained in:
parent
45d38b3f6e
commit
4b4cae5b83
6 changed files with 28 additions and 5 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { User } from '@entities/user.entity';
|
||||
|
||||
export interface IAppPermissionsService {
|
||||
fetchUsers(appId: string): Promise<any>;
|
||||
fetchUsers(appId: string, user: User): Promise<any>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
import { User } from '@entities/user.entity';
|
||||
|
||||
export interface IUtilService {
|
||||
getUsersWithViewAccess(appId: string, organizationId: string, endUserIds: string[]): Promise<User[]>;
|
||||
}
|
||||
|
|
@ -1,19 +1,23 @@
|
|||
import { getImportPath } from '@modules/app/constants';
|
||||
import { DynamicModule } from '@nestjs/common';
|
||||
import { FeatureAbilityFactory } from './ability';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { User } from '@entities/user.entity';
|
||||
import { RolesRepository } from '@modules/roles/repository';
|
||||
|
||||
export class AppPermissionsModule {
|
||||
static async register(configs: { IS_GET_CONTEXT: boolean }): Promise<DynamicModule> {
|
||||
const importPath = await getImportPath(configs.IS_GET_CONTEXT);
|
||||
const { AppPermissionsController } = await import(`${importPath}/app-permissions/controller`);
|
||||
const { AppPermissionsService } = await import(`${importPath}/app-permissions/service`);
|
||||
const { AppPermissionsUtilService } = await import(`${importPath}/app-permissions/util.service`);
|
||||
|
||||
return {
|
||||
module: AppPermissionsModule,
|
||||
imports: [],
|
||||
imports: [TypeOrmModule.forFeature([User])],
|
||||
controllers: [AppPermissionsController],
|
||||
providers: [AppPermissionsService, FeatureAbilityFactory],
|
||||
exports: [],
|
||||
providers: [AppPermissionsService, AppPermissionsUtilService, RolesRepository, FeatureAbilityFactory],
|
||||
exports: [AppPermissionsUtilService],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { IAppPermissionsService } from './interfaces/IService';
|
|||
export class AppPermissionsService implements IAppPermissionsService {
|
||||
constructor() {}
|
||||
|
||||
async fetchUsers(appId) {
|
||||
async fetchUsers(appId, user) {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
12
server/src/modules/app-permissions/util.service.ts
Normal file
12
server/src/modules/app-permissions/util.service.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { User } from '@entities/user.entity';
|
||||
import { IUtilService } from './interfaces/IUtilService';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class AppPermissionsUtilService implements IUtilService {
|
||||
constructor() {}
|
||||
|
||||
async getUsersWithViewAccess(appId: string, organizationId: string, endUserIds: string[]): Promise<User[]> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue