mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
* multi org changes * Initial changes * changes * manage sso page * Multi-organization changes * Multi organization changes * multi-org changes * multi-org changes * multi-org changes * multi-org fixes * env variables app.json changes * multi-org-fix * user invitation token fix * multi-org group permission fix * multi-org app privilege * google oauth fix * Remove enable signup for form login * Multi organization fixes * multi-org user invite flow changes * multi-org sign up fix * rebase and multi-org fixes * revert testing logs * test logs revert * migration changes * migration file fix * error message changes * git login for private email fix * dropdown fix * test cases * e2e test cases added * test cases fix * documentation changes * testcases fix * testcases added * replace findOne with findOneOrFail * accept invite testcases * login page fixes * added encrypted tag * review comments * migration fixes * improvements * manage sso loading fix * review comments * migration file changes * new organization creation bug fix * added e2e testcases * added testcases * Update data_sources.controller.ts
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { Controller, Post, UseGuards, Get, ForbiddenException, Body } from '@nestjs/common';
|
|
import { LibraryAppCreationService } from '@services/library_app_creation.service';
|
|
import { User } from 'src/decorators/user.decorator';
|
|
import { App } from 'src/entities/app.entity';
|
|
import { AppsAbilityFactory } from 'src/modules/casl/abilities/apps-ability.factory';
|
|
import { JwtAuthGuard } from '../../src/modules/auth/jwt-auth.guard';
|
|
import { TemplateAppManifests } from '../../templates';
|
|
|
|
@Controller('library_apps')
|
|
export class LibraryAppsController {
|
|
constructor(
|
|
private libraryAppCreationService: LibraryAppCreationService,
|
|
private appsAbilityFactory: AppsAbilityFactory
|
|
) {}
|
|
|
|
@Post()
|
|
@UseGuards(JwtAuthGuard)
|
|
async create(@User() user, @Body('identifier') identifier) {
|
|
const ability = await this.appsAbilityFactory.appsActions(user);
|
|
|
|
if (!ability.can('createApp', App)) {
|
|
throw new ForbiddenException('You do not have permissions to perform this action');
|
|
}
|
|
const newApp = await this.libraryAppCreationService.perform(user, identifier);
|
|
|
|
return newApp;
|
|
}
|
|
|
|
@Get()
|
|
@UseGuards(JwtAuthGuard)
|
|
async index() {
|
|
return { template_app_manifests: TemplateAppManifests };
|
|
}
|
|
}
|