Skip to content

Commit

Permalink
fix(playground): repair trigger display
Browse files Browse the repository at this point in the history
  • Loading branch information
Zitrone44 committed Jan 17, 2025
1 parent 8d7936e commit a8cb023
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 15 additions & 10 deletions modules/fbs-collab/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any> {
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}};
},
});

Expand Down
4 changes: 1 addition & 3 deletions modules/fbs-core/web/src/app/model/sql_playground/Trigger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
export interface Trigger {
export interface Trigger extends TriggerEvent, TriggerAction {
name: string;
event: TriggerEvent;
action: TriggerAction;
}

interface TriggerEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
</mat-expansion-panel-header>
<div class="trigger">
<span>
{{ trigger.action.timing }} {{ trigger.event.manipulation }}
{{ trigger.event.objecttable }}
{{ trigger.timing }} {{ trigger.manipulation }}
{{ trigger.objecttable }}
</span>
<span>FOR EACH {{ trigger.action.orientation }}</span>
<pre class="trigger-definition">{{ trigger.action.statement }}</pre>
<span>FOR EACH {{ trigger.orientation }}</span>
<pre class="trigger-definition">{{ trigger.statement }}</pre>
</div>
</mat-expansion-panel>

0 comments on commit a8cb023

Please sign in to comment.