mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-29 17:38:07 +00:00
* revise and add specs for folders * Feature: Folder create permission (#1394) * add migration for folder create permission * add backfill migration for folder create permission on admin group * adds permission for folder creation * refactor function * select distinct folders
28 lines
872 B
TypeScript
28 lines
872 B
TypeScript
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
import { GroupPermission } from "../src/entities/group_permission.entity";
|
|
|
|
export class BackfillFolderCreatePermissionsAsTruthyForAdminGroup1636609569079
|
|
implements MigrationInterface
|
|
{
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
const entityManager = queryRunner.manager;
|
|
const GroupPermissionRepository =
|
|
entityManager.getRepository(GroupPermission);
|
|
|
|
await GroupPermissionRepository.update(
|
|
{ group: "admin" },
|
|
{ folderCreate: true }
|
|
);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
const entityManager = queryRunner.manager;
|
|
const GroupPermissionRepository =
|
|
entityManager.getRepository(GroupPermission);
|
|
|
|
await GroupPermissionRepository.update(
|
|
{ group: "admin" },
|
|
{ folderCreate: false }
|
|
);
|
|
}
|
|
}
|