diff --git a/docker-compose.yml b/docker-compose.yml index c59a43c09..75a8be4f4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -270,8 +270,10 @@ services: restart: always ports: - 1234:1234 + networks: + - fbs environment: - - FBS_ROOT_URL=https://core + - FBS_ROOT_URL=https://core:443 - NODE_TLS_REJECT_UNAUTHORIZED=0 networks: diff --git a/modules/fbs-collab/src/app.ts b/modules/fbs-collab/src/app.ts index 85ca6da65..2ed30512a 100644 --- a/modules/fbs-collab/src/app.ts +++ b/modules/fbs-collab/src/app.ts @@ -6,19 +6,24 @@ const FBS_ROOT_URL = process.env.FBS_ROOT_URL ?? 'https://feedback.mni.thm.de'; const server = new Hocuspocus({ port: 1234, async onAuthenticate(data: onAuthenticatePayload): Promise { - let userId; try { - userId = jose.decodeJwt(data.token).id; + let userId; + try { + userId = jose.decodeJwt(data.token).id; + } catch (e) { + throw new Error("Unauthorized"); + } + if (!userId) throw new Error("Unauthorized"); + const resp = await fetch(`${FBS_ROOT_URL}/api/v1/users/${userId}/groups`, {headers: {'Authorization': `Bearer ${data.token}`}}); + if (resp.status !== 200) throw new Error("Unauthorized"); + const body = await resp.json(); + const ok = Boolean(body.find(({id}: { id: string }) => id.toString() === data.documentName)); + if (!ok) throw new Error("Forbidden"); + return {user: {id: userId}}; } catch (e) { - throw new Error("Unauthorized"); + console.log(e) + throw e } - if (!userId) throw new Error("Unauthorized"); - const resp = await fetch(`${FBS_ROOT_URL}/api/v1/users/${userId}/groups`, {headers: {'Authorization': `Bearer ${data.token}`}}); - if (resp.status !== 200) throw new Error("Unauthorized"); - const body = await resp.json(); - const ok = Boolean(body.find(({id}: {id: string}) => id.toString() === data.documentName)); - if (!ok) throw new Error("Forbidden"); - return {user: {id: userId}}; }, }); diff --git a/modules/fbs-core/web/src/app/model/sql_playground/Trigger.ts b/modules/fbs-core/web/src/app/model/sql_playground/Trigger.ts index 6dd5b18df..68bc509d5 100644 --- a/modules/fbs-core/web/src/app/model/sql_playground/Trigger.ts +++ b/modules/fbs-core/web/src/app/model/sql_playground/Trigger.ts @@ -1,7 +1,5 @@ -export interface Trigger { +export interface Trigger extends TriggerEvent, TriggerAction { name: string; - event: TriggerEvent; - action: TriggerAction; } interface TriggerEvent { diff --git a/modules/fbs-core/web/src/app/page-components/sql-playground/db-scheme/db-scheme-triggers/db-scheme-triggers.component.html b/modules/fbs-core/web/src/app/page-components/sql-playground/db-scheme/db-scheme-triggers/db-scheme-triggers.component.html index 664915501..e19fe7598 100644 --- a/modules/fbs-core/web/src/app/page-components/sql-playground/db-scheme/db-scheme-triggers/db-scheme-triggers.component.html +++ b/modules/fbs-core/web/src/app/page-components/sql-playground/db-scheme/db-scheme-triggers/db-scheme-triggers.component.html @@ -5,10 +5,10 @@
- {{ trigger.action.timing }} {{ trigger.event.manipulation }} - {{ trigger.event.objecttable }} + {{ trigger.timing }} {{ trigger.manipulation }} + {{ trigger.objecttable }} - FOR EACH {{ trigger.action.orientation }} -
{{ trigger.action.statement }}
+ FOR EACH {{ trigger.orientation }} +
{{ trigger.statement }}