feat: add integration access settings (#725)

* feat: add integration access settings

* fix: typecheck and test issues

* fix: test timeout

* chore: address pull request feedback

* chore: add throw if action forbidden for integration permissions

* fix: unable to create new migrations because of duplicate prevId in sqlite snapshots

* chore: add sqlite migration for integration permissions

* test: add unit tests for integration access

* test: add permission checks to integration router tests

* test: add unit test for integration permissions

* chore: add mysql migration

* fix: format issues
This commit is contained in:
Meier Lukas
2024-07-08 00:00:37 +02:00
committed by GitHub
parent be711149f7
commit 408cdeb5c3
50 changed files with 4392 additions and 615 deletions

View File

@@ -0,0 +1,17 @@
CREATE TABLE `integrationGroupPermissions` (
`integration_id` text NOT NULL,
`group_id` text NOT NULL,
`permission` text NOT NULL,
PRIMARY KEY(`group_id`, `integration_id`, `permission`),
FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`group_id`) REFERENCES `group`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `integrationUserPermission` (
`integration_id` text NOT NULL,
`user_id` text NOT NULL,
`permission` text NOT NULL,
PRIMARY KEY(`integration_id`, `permission`, `user_id`),
FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);

View File

@@ -2,7 +2,7 @@
"version": "6",
"dialect": "sqlite",
"id": "5ad60251-8450-437d-9081-a456884120d2",
"prevId": "0575873a-9e10-4480-8d7d-c47198622c22",
"prevId": "2ed0ffc3-8612-42e7-bd8e-f5f8f3338a39",
"tables": {
"account": {
"name": "account",

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,13 @@
"when": 1716148434186,
"tag": "0003_adorable_raider",
"breakpoints": true
},
{
"idx": 4,
"version": "6",
"when": 1720036615408,
"tag": "0004_peaceful_red_ghost",
"breakpoints": true
}
]
}