Compare commits
36 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c91365f98 | ||
|
|
193a21277f | ||
|
|
8264936f21 | ||
|
|
8a9d552760 | ||
|
|
47319b9e10 | ||
|
|
4b75e06057 | ||
|
|
a7a90e8ab8 | ||
|
|
e46be87a99 | ||
|
|
58791676e5 | ||
|
|
74f79ae0b7 | ||
|
|
a716cf6852 | ||
|
|
e549d7b088 | ||
|
|
31194c8c41 | ||
|
|
4e9f7f634d | ||
|
|
bbfc07478f | ||
|
|
5afc562b18 | ||
|
|
6309422429 | ||
|
|
2683d49bba | ||
|
|
1df1fa3ac9 | ||
|
|
5ab91664ed | ||
|
|
fc228fb274 | ||
|
|
6ad47e1943 | ||
|
|
00f416a126 | ||
|
|
64652af779 | ||
|
|
9eab32d573 | ||
|
|
2cb46cd485 | ||
|
|
6f1437b55a | ||
|
|
8ddba38bd5 | ||
|
|
c5d52a7df5 | ||
|
|
b86e1b62e2 | ||
|
|
ef879bb81b | ||
|
|
54e27f2ad9 | ||
|
|
b5b5dde9e3 | ||
|
|
5de4728901 | ||
|
|
9d1fd0b55f | ||
|
|
1127130b00 |
|
|
@ -26,9 +26,7 @@
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"name": "LV Lampukistan",
|
"name": "LV Lampukistan",
|
||||||
"hue": 0.0000,
|
|
||||||
"access": {
|
"access": {
|
||||||
"public": true,
|
|
||||||
"default_level": "view",
|
"default_level": "view",
|
||||||
"attributed": [
|
"attributed": [
|
||||||
{
|
{
|
||||||
|
|
@ -49,20 +47,12 @@
|
||||||
"name": "Aufstand: Mieten",
|
"name": "Aufstand: Mieten",
|
||||||
"begin": {
|
"begin": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 9, "day": 14},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [-1]},
|
|
||||||
{"action": "shift_day", "args": [6]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 12, "minute": 0, "second": 0}
|
"time": {"hour": 12, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 9, "day": 14},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [-1]},
|
|
||||||
{"action": "shift_day", "args": [6]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 15, "minute": 0, "second": 0}
|
"time": {"hour": 15, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"location": "Porada Ninfu, Haupt-Markt",
|
"location": "Porada Ninfu, Haupt-Markt",
|
||||||
|
|
@ -72,20 +62,12 @@
|
||||||
"name": "Aufstand: Waffen",
|
"name": "Aufstand: Waffen",
|
||||||
"begin": {
|
"begin": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 9, "day": 21},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [0]},
|
|
||||||
{"action": "shift_day", "args": [6]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 12, "minute": 0, "second": 0}
|
"time": {"hour": 12, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 9, "day": 21},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [0]},
|
|
||||||
{"action": "shift_day", "args": [6]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 15, "minute": 0, "second": 0}
|
"time": {"hour": 15, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"location": "Tandreell, Stoiber-Platz",
|
"location": "Tandreell, Stoiber-Platz",
|
||||||
|
|
@ -95,20 +77,12 @@
|
||||||
"name": "Aufstand: Essen",
|
"name": "Aufstand: Essen",
|
||||||
"begin": {
|
"begin": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 10, "day": 28},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [1]},
|
|
||||||
{"action": "shift_day", "args": [6]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 12, "minute": 0, "second": 0}
|
"time": {"hour": 12, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 10, "day": 28},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [1]},
|
|
||||||
{"action": "shift_day", "args": [6]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 15, "minute": 0, "second": 0}
|
"time": {"hour": 15, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"location": "Kawanda, Nord-Bahnhof",
|
"location": "Kawanda, Nord-Bahnhof",
|
||||||
|
|
@ -121,9 +95,7 @@
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"name": "KV Zepettel-Region",
|
"name": "KV Zepettel-Region",
|
||||||
"hue": 0.3333,
|
|
||||||
"access": {
|
"access": {
|
||||||
"public": false,
|
|
||||||
"default_level": "view",
|
"default_level": "view",
|
||||||
"attributed": [
|
"attributed": [
|
||||||
{
|
{
|
||||||
|
|
@ -144,20 +116,12 @@
|
||||||
"name": "Feier: Bier",
|
"name": "Feier: Bier",
|
||||||
"begin": {
|
"begin": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 9, "day": 18},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [0]},
|
|
||||||
{"action": "shift_day", "args": [3]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 18, "minute": 0, "second": 0}
|
"time": {"hour": 18, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 9, "day": 18},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [0]},
|
|
||||||
{"action": "shift_day", "args": [3]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 23, "minute": 0, "second": 0}
|
"time": {"hour": 23, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"location": "Rudschadinedschad, Schlamm-Park",
|
"location": "Rudschadinedschad, Schlamm-Park",
|
||||||
|
|
@ -167,20 +131,12 @@
|
||||||
"name": "Feier: Schnapps",
|
"name": "Feier: Schnapps",
|
||||||
"begin": {
|
"begin": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 10, "day": 1},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [2]},
|
|
||||||
{"action": "shift_day", "args": [2]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 18, "minute": 0, "second": 0}
|
"time": {"hour": 18, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 10, "day": 1},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [2]},
|
|
||||||
{"action": "shift_day", "args": [2]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 23, "minute": 0, "second": 0}
|
"time": {"hour": 23, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"location": "Kawanda, Ratten-Platz",
|
"location": "Kawanda, Ratten-Platz",
|
||||||
|
|
@ -193,9 +149,7 @@
|
||||||
{
|
{
|
||||||
"id": 3,
|
"id": 3,
|
||||||
"name": "OV Kawanda",
|
"name": "OV Kawanda",
|
||||||
"hue": 0.6667,
|
|
||||||
"access": {
|
"access": {
|
||||||
"public": false,
|
|
||||||
"default_level": "view",
|
"default_level": "view",
|
||||||
"attributed": [
|
"attributed": [
|
||||||
{
|
{
|
||||||
|
|
@ -212,20 +166,12 @@
|
||||||
"name": "Aufräumen: Flaschen",
|
"name": "Aufräumen: Flaschen",
|
||||||
"begin": {
|
"begin": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 9, "day": 24},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [1]},
|
|
||||||
{"action": "shift_day", "args": [2]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 15, "minute": 0, "second": 0}
|
"time": {"hour": 15, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 9, "day": 24},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [1]},
|
|
||||||
{"action": "shift_day", "args": [2]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 17, "minute": 0, "second": 0}
|
"time": {"hour": 17, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"location": "Kawanda, Penner-Allee",
|
"location": "Kawanda, Penner-Allee",
|
||||||
|
|
@ -238,9 +184,7 @@
|
||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"name": "KV Zepettel-Region | intern",
|
"name": "KV Zepettel-Region | intern",
|
||||||
"hue": 0.8333,
|
|
||||||
"access": {
|
"access": {
|
||||||
"public": false,
|
|
||||||
"default_level": "none",
|
"default_level": "none",
|
||||||
"attributed": [
|
"attributed": [
|
||||||
{
|
{
|
||||||
|
|
@ -261,20 +205,12 @@
|
||||||
"name": "Infostand",
|
"name": "Infostand",
|
||||||
"begin": {
|
"begin": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 9, "day": 16},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [0]},
|
|
||||||
{"action": "shift_day", "args": [1]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 10, "minute": 0, "second": 0}
|
"time": {"hour": 10, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"timezone_shift": 2,
|
"timezone_shift": 2,
|
||||||
"date_relative": [
|
"date": {"year": 2025, "month": 9, "day": 16},
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [0]},
|
|
||||||
{"action": "shift_day", "args": [1]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 14, "minute": 0, "second": 0}
|
"time": {"hour": 14, "minute": 0, "second": 0}
|
||||||
},
|
},
|
||||||
"location": "Rudschadinedschad, Schabracken-Markt",
|
"location": "Rudschadinedschad, Schabracken-Markt",
|
||||||
94
doc/konzept.md
Normal file
94
doc/konzept.md
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
# Konzept
|
||||||
|
|
||||||
|
## Notizen
|
||||||
|
|
||||||
|
- Kalender sollen unabhängig von Nutzern bestehen können
|
||||||
|
- Zugriffs-Stufen
|
||||||
|
- `none`: kein Zugriff
|
||||||
|
- `view`: nur lesend
|
||||||
|
- `edit`: lesend und schreibend
|
||||||
|
- `admin`: kann alles (auch Kalender löschen)
|
||||||
|
- einem Kalender können beliebig viele Nutzer zugeordnet werden, die jeweils bestimmte Zugriffs-Stufen zugewiesen haben
|
||||||
|
- Veranstaltungen bilden keine eigene Domäne
|
||||||
|
- es gibt verschiedene Arten von Quellen:
|
||||||
|
- lokal
|
||||||
|
- enthält Veranstaltungen
|
||||||
|
- caldav
|
||||||
|
- enthält keine eigenen Veranstaltungen
|
||||||
|
- sollte read-only- und read/write-Modus haben
|
||||||
|
- nach dem Anmelden sieht man eine Kalender-Ansicht mit folgenden Kalendern kombiniert angezeigt:
|
||||||
|
- öffentliche Kalender
|
||||||
|
- nicht öffentliche Kalendar, bei welchen man mindestens Lese-Berechtigung hat
|
||||||
|
- öffentliche Kalendar können ohne Anmeldung betrachtet werden, jedoch nur mit einem schwer bis gar nicht erratbaren Link
|
||||||
|
|
||||||
|
|
||||||
|
## Zugriffssteuerung
|
||||||
|
|
||||||
|
Es gibt folgende Zugriffsstufen :
|
||||||
|
|
||||||
|
- `none`: kein Zugriff
|
||||||
|
- `view`: nur Lese-Zugriff
|
||||||
|
- `edit`: Lese- und Schreib-Zugriff
|
||||||
|
- `admin`: Lese- und Schreib-Zugriff + Bearbeitung von Kalender-Eigenschaften
|
||||||
|
|
||||||
|
Zur Bestimmung welche Zugriffsstufe ein Nutzer auf einen Kalender/Termin hat, werden drei Werte betrachtet:
|
||||||
|
|
||||||
|
- Öffentlichkeit des Kalenders (`public`)
|
||||||
|
- Standard-Zugriffsstufe des Kalenders (`default_level`)
|
||||||
|
- dem Nutzer zugewiesene Zugriffsstufe für den Kalender (`attributed_level`)
|
||||||
|
|
||||||
|
Diese Angaben fließen in folgende Formel ein:
|
||||||
|
|
||||||
|
```
|
||||||
|
access_level = max(
|
||||||
|
(if public then 'view' else 'none'),
|
||||||
|
(if (attributed = NULL) then default_level else attributed_level)
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
… wobei die Ordnung der Zugriffsstufen der oben ersichtlichen Reihenfolge entspricht.
|
||||||
|
|
||||||
|
Einzeln aufgeführt ergibt das:
|
||||||
|
|
||||||
|
| public | default level | attributed level | result |
|
||||||
|
|-- |-- |-- |-- |
|
||||||
|
| no | none | - | none |
|
||||||
|
| no | none | none | none |
|
||||||
|
| no | none | view | view |
|
||||||
|
| no | none | edit | edit |
|
||||||
|
| no | none | admin | admin |
|
||||||
|
| no | view | - | view |
|
||||||
|
| no | view | none | none |
|
||||||
|
| no | view | view | view |
|
||||||
|
| no | view | edit | edit |
|
||||||
|
| no | view | admin | admin |
|
||||||
|
| no | edit | - | edit |
|
||||||
|
| no | edit | none | none |
|
||||||
|
| no | edit | view | view |
|
||||||
|
| no | edit | edit | edit |
|
||||||
|
| no | edit | admin | admin |
|
||||||
|
| no | admin | - | admin |
|
||||||
|
| no | admin | none | none |
|
||||||
|
| no | admin | view | view |
|
||||||
|
| no | admin | edit | edit |
|
||||||
|
| no | admin | admin | admin |
|
||||||
|
| yes | none | - | view |
|
||||||
|
| yes | none | none | view |
|
||||||
|
| yes | none | view | view |
|
||||||
|
| yes | none | edit | edit |
|
||||||
|
| yes | none | admin | admin |
|
||||||
|
| yes | view | - | view |
|
||||||
|
| yes | view | none | view |
|
||||||
|
| yes | view | view | view |
|
||||||
|
| yes | view | edit | edit |
|
||||||
|
| yes | view | admin | admin |
|
||||||
|
| yes | edit | - | edit |
|
||||||
|
| yes | edit | none | view |
|
||||||
|
| yes | edit | view | view |
|
||||||
|
| yes | edit | edit | edit |
|
||||||
|
| yes | edit | admin | admin |
|
||||||
|
| yes | admin | - | admin |
|
||||||
|
| yes | admin | none | none |
|
||||||
|
| yes | admin | view | view |
|
||||||
|
| yes | admin | edit | edit |
|
||||||
|
| yes | admin | admin | admin |
|
||||||
121
lib/plankton/plankton.d.ts
vendored
121
lib/plankton/plankton.d.ts
vendored
|
|
@ -1,11 +1,11 @@
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
type int = number;
|
declare type int = number;
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
type float = number;
|
declare type float = number;
|
||||||
declare var process: any;
|
declare var process: any;
|
||||||
declare var require: any;
|
declare var require: any;
|
||||||
declare class Buffer {
|
declare class Buffer {
|
||||||
|
|
@ -22,7 +22,7 @@ declare namespace lib_plankton.base {
|
||||||
/**
|
/**
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
type type_pseudopointer<type_value> = {
|
declare type type_pseudopointer<type_value> = {
|
||||||
value: type_value;
|
value: type_value;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
|
@ -229,10 +229,9 @@ declare namespace lib_plankton.base {
|
||||||
function object_merge(core: Record<string, any>, mantle: Record<string, any>): Record<string, any>;
|
function object_merge(core: Record<string, any>, mantle: Record<string, any>): Record<string, any>;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function buffer_show(buffer: Buffer, { "block_size": option_block_size, "break_char": option_break_char, "render_readable_characters": render_readable_characters, }?: {
|
function buffer_show(buffer: Buffer, { "block_size": option_block_size, "break_char": option_break_char, }?: {
|
||||||
block_size?: int;
|
block_size?: int;
|
||||||
break_char?: string;
|
break_char?: string;
|
||||||
render_readable_characters?: boolean;
|
|
||||||
}): string;
|
}): string;
|
||||||
}
|
}
|
||||||
declare module lib_plankton.pod {
|
declare module lib_plankton.pod {
|
||||||
|
|
@ -587,10 +586,6 @@ declare namespace lib_plankton.call {
|
||||||
* @author fenris
|
* @author fenris
|
||||||
*/
|
*/
|
||||||
export function timeout(procedure: (() => void), delay_in_seconds: float): int;
|
export function timeout(procedure: (() => void), delay_in_seconds: float): int;
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
export function loop(procedure: (() => void), delay_in_seconds: float): int;
|
|
||||||
/**
|
/**
|
||||||
* Promise version of "setTimeout"
|
* Promise version of "setTimeout"
|
||||||
*
|
*
|
||||||
|
|
@ -658,9 +653,6 @@ declare namespace lib_plankton.call {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function sleep(seconds: float): Promise<void>;
|
export function sleep(seconds: float): Promise<void>;
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export function null_prop<type_value_from, type_value_to>(value_from: (null | type_value_from), function_: ((value: type_value_from) => type_value_to)): (null | type_value_to);
|
|
||||||
export {};
|
export {};
|
||||||
}
|
}
|
||||||
declare namespace lib_plankton.email {
|
declare namespace lib_plankton.email {
|
||||||
|
|
@ -2323,7 +2315,7 @@ declare namespace lib_plankton.storage.memory {
|
||||||
clear(): Promise<void>;
|
clear(): Promise<void>;
|
||||||
write(key: any, value: any): Promise<boolean>;
|
write(key: any, value: any): Promise<boolean>;
|
||||||
delete(key: any): Promise<void>;
|
delete(key: any): Promise<void>;
|
||||||
read(key: any): Promise<Awaited<type_item>>;
|
read(key: any): Promise<type_item>;
|
||||||
search(term: any): Promise<{
|
search(term: any): Promise<{
|
||||||
key: string;
|
key: string;
|
||||||
preview: string;
|
preview: string;
|
||||||
|
|
@ -3081,73 +3073,26 @@ declare namespace lib_plankton.session {
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function begin(name: string, { "lifetime": lifetime, "data": data, }?: {
|
function begin(name: string, options?: {
|
||||||
lifetime?: int;
|
lifetime?: int;
|
||||||
data?: any;
|
data?: any;
|
||||||
}): Promise<string>;
|
}): Promise<string>;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function get(key: string, { "prolongation": prolongation, }?: {
|
function get(key: string): Promise<type_session>;
|
||||||
prolongation?: (null | int);
|
|
||||||
}): Promise<type_session>;
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function end(key: string): Promise<void>;
|
function end(key: string): Promise<void>;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function setup({ "key_length": key_length, "key_max_attempts": key_max_attempts, "default_lifetime": default_lifetime, "default_prolongation": default_prolongation, "data_chest": data_chest, "clear": clear, }?: {
|
function setup(options?: {
|
||||||
key_length?: int;
|
key_length?: int;
|
||||||
key_max_attempts?: int;
|
key_max_attempts?: int;
|
||||||
default_lifetime?: int;
|
default_lifetime?: int;
|
||||||
default_prolongation?: (null | int);
|
|
||||||
data_chest?: lib_plankton.storage.type_chest<string, any, void, string, string>;
|
data_chest?: lib_plankton.storage.type_chest<string, any, void, string, string>;
|
||||||
clear?: boolean;
|
clear?: boolean;
|
||||||
}): Promise<void>;
|
}): Promise<void>;
|
||||||
}
|
}
|
||||||
declare namespace lib_plankton.base64 {
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
type type_source = string;
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
type type_target = string;
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
export function encode(source: type_source): type_target;
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
export function decode(target: type_target): type_source;
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
export function implementation_code(): lib_plankton.code.type_code<type_source, type_target>;
|
|
||||||
export {};
|
|
||||||
}
|
|
||||||
declare namespace lib_plankton.base64 {
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
class class_base64 implements lib_plankton.code.interface_code<string, string> {
|
|
||||||
/**
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
constructor();
|
|
||||||
/**
|
|
||||||
* @implementation
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
encode(x: string): string;
|
|
||||||
/**
|
|
||||||
* @implementation
|
|
||||||
* @author fenris
|
|
||||||
*/
|
|
||||||
decode(x: string): string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare namespace lib_plankton {
|
declare namespace lib_plankton {
|
||||||
namespace order {
|
namespace order {
|
||||||
/**
|
/**
|
||||||
|
|
@ -4132,7 +4077,7 @@ declare namespace lib_plankton.server {
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function make(handle: ((input: string, metadata?: type_metadata) => Promise<string>), { "host": host, "port": port, "threshold": threshold, }?: {
|
function make(handle: ((input: string, metadata?: type_metadata) => Promise<string>), options?: {
|
||||||
host?: string;
|
host?: string;
|
||||||
port?: int;
|
port?: int;
|
||||||
threshold?: (null | float);
|
threshold?: (null | float);
|
||||||
|
|
@ -4556,6 +4501,50 @@ declare namespace lib_plankton.map.collatemap {
|
||||||
export function implementation_map<type_key, type_value>(subject: type_subject<type_key, type_value>): type_map<type_key, type_value>;
|
export function implementation_map<type_key, type_value>(subject: type_subject<type_key, type_value>): type_map<type_key, type_value>;
|
||||||
export {};
|
export {};
|
||||||
}
|
}
|
||||||
|
declare namespace lib_plankton.base64 {
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
type type_source = string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
type type_target = string;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
export function encode(source: type_source): type_target;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
export function decode(target: type_target): type_source;
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
export function implementation_code(): lib_plankton.code.type_code<type_source, type_target>;
|
||||||
|
export {};
|
||||||
|
}
|
||||||
|
declare namespace lib_plankton.base64 {
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
class class_base64 implements lib_plankton.code.interface_code<string, string> {
|
||||||
|
/**
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
constructor();
|
||||||
|
/**
|
||||||
|
* @implementation
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
encode(x: string): string;
|
||||||
|
/**
|
||||||
|
* @implementation
|
||||||
|
* @author fenris
|
||||||
|
*/
|
||||||
|
decode(x: string): string;
|
||||||
|
}
|
||||||
|
}
|
||||||
declare namespace lib_plankton.auth {
|
declare namespace lib_plankton.auth {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
@ -4597,11 +4586,9 @@ declare namespace lib_plankton.auth.oidc {
|
||||||
type type_token = string;
|
type type_token = string;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export type type_userinfo = {
|
type type_userinfo = {
|
||||||
name: (null | string);
|
name: (null | string);
|
||||||
label: (null | string);
|
|
||||||
email: (null | string);
|
email: (null | string);
|
||||||
groups: (null | Array<string>);
|
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,14 +1,6 @@
|
||||||
{
|
{
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"log": [
|
"log": [
|
||||||
{
|
|
||||||
"kind": "file",
|
|
||||||
"data": {
|
|
||||||
"path": "/tmp/zeitbild/log.jsonl",
|
|
||||||
"threshold": "info",
|
|
||||||
"format": "jsonl_structured"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"kind": "stdout",
|
"kind": "stdout",
|
||||||
"data": {
|
"data": {
|
||||||
|
|
@ -33,17 +25,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"caldav": {
|
"caldav": {
|
||||||
"address": "http://localhost:8000/calendars/-/demo",
|
"address": "http://localhost:8000/calendars/-/lampukistan",
|
||||||
"username": "demo-{{username}}",
|
"username": "lampukistan-{{username}}",
|
||||||
"password": "{{password}}",
|
"password": "{{password}}",
|
||||||
"setup_hints": [
|
"setup_hints": [
|
||||||
{
|
|
||||||
"label": "Liste von Clients",
|
|
||||||
"link": "https://devguide.calconnect.org/CalDAV/Client-Implementations/"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "Android",
|
"label": "Android",
|
||||||
"link": "https://goneuland.de/davx5-android-kalender-per-caldav-integrieren-z-b-nextcloud/",
|
"link": "https://www.android-user.de/caldavcarddav-kalender-und-adressbuecher-ohne-google-synchronisieren/",
|
||||||
"remark": null
|
"remark": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -62,8 +50,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "MS Outlook",
|
"label": "MS Outlook",
|
||||||
"link": "https://all-inkl.com/wichtig/anleitungen/programme/e-mail/caldav-kalenderfunktion/outlook-2019_468.html",
|
"link": "https://www.united-domains.de/help/faq-article/wie-synchronisiere-ich-meinen-kalender-caldav-mit-ms-outlook/",
|
||||||
"remark": "eigentlich für Server 'all-inkl.com' — Zugangsdaten müssen entsprechend geändert werden"
|
"remark": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,328 +0,0 @@
|
||||||
{
|
|
||||||
"groups": [
|
|
||||||
{
|
|
||||||
"id": 1,
|
|
||||||
"name": "gaertner",
|
|
||||||
"label": "Gärtner"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 2,
|
|
||||||
"name": "bewohner",
|
|
||||||
"label": "Bewohner"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"id": 1,
|
|
||||||
"name": "alice",
|
|
||||||
"groups": [1],
|
|
||||||
"email_address": "alice@example.org",
|
|
||||||
"dav_token": null,
|
|
||||||
"password": "alice"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 2,
|
|
||||||
"name": "bob",
|
|
||||||
"groups": [2],
|
|
||||||
"email_address": "bob@example.org",
|
|
||||||
"dav_token": null,
|
|
||||||
"password": "bob"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 3,
|
|
||||||
"name": "charlie",
|
|
||||||
"groups": [1, 2],
|
|
||||||
"email_address": "charlie@example.org",
|
|
||||||
"dav_token": "charlie_dav",
|
|
||||||
"password": "charlie"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"calendars": [
|
|
||||||
{
|
|
||||||
"id": 1,
|
|
||||||
"name": "Feiertage",
|
|
||||||
"hue": 0.0000,
|
|
||||||
"access": {
|
|
||||||
"public": true,
|
|
||||||
"default_level": "view",
|
|
||||||
"attributed_group": [
|
|
||||||
],
|
|
||||||
"attributed_user": [
|
|
||||||
{
|
|
||||||
"user_id": 3,
|
|
||||||
"level": "admin"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"resource": {
|
|
||||||
"kind": "local",
|
|
||||||
"data": {
|
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"name": "Tag des Wassers",
|
|
||||||
"begin": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": [0]},
|
|
||||||
{"action": "shift_week", "args": [-1]},
|
|
||||||
{"action": "shift_day", "args": [1]}
|
|
||||||
],
|
|
||||||
"time": null
|
|
||||||
},
|
|
||||||
"end": null,
|
|
||||||
"location": null,
|
|
||||||
"description": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Tag der Erde",
|
|
||||||
"begin": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": [0]},
|
|
||||||
{"action": "shift_week", "args": [0]},
|
|
||||||
{"action": "shift_day", "args": [6]}
|
|
||||||
],
|
|
||||||
"time": null
|
|
||||||
},
|
|
||||||
"end": null,
|
|
||||||
"location": null,
|
|
||||||
"description": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Tag der Luft",
|
|
||||||
"begin": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": [0]},
|
|
||||||
{"action": "shift_week", "args": [2]},
|
|
||||||
{"action": "shift_day", "args": [4]}
|
|
||||||
],
|
|
||||||
"time": null
|
|
||||||
},
|
|
||||||
"end": null,
|
|
||||||
"location": null,
|
|
||||||
"description": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 2,
|
|
||||||
"name": "Garten",
|
|
||||||
"hue": 0.3333,
|
|
||||||
"access": {
|
|
||||||
"public": false,
|
|
||||||
"default_level": "none",
|
|
||||||
"attributed_group": [
|
|
||||||
{
|
|
||||||
"group_id": 1,
|
|
||||||
"level": "view"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attributed_user": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"level": "admin"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"resource": {
|
|
||||||
"kind": "local",
|
|
||||||
"data": {
|
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"name": "Unkraut jähten",
|
|
||||||
"begin": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [-1]},
|
|
||||||
{"action": "shift_day", "args": [3]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 10, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [-1]},
|
|
||||||
{"action": "shift_day", "args": [3]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 11, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"location": "Drosselweg 7",
|
|
||||||
"description": "Giersch und Rainkohl haben wider gewuchert"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Holz hacken",
|
|
||||||
"begin": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [0]},
|
|
||||||
{"action": "shift_day", "args": [0]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 13, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [0]},
|
|
||||||
{"action": "shift_day", "args": [0]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 14, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"location": "Drosselweg 7",
|
|
||||||
"description": "die alte Birke ist bereits in Segmente geschnitten und muss nun noch in handliche Scheite zerlegt werden"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Blumen gießen",
|
|
||||||
"begin": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [1]},
|
|
||||||
{"action": "shift_day", "args": [2]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 18, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [1]},
|
|
||||||
{"action": "shift_day", "args": [2]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 19, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"location": "Drosselweg 7",
|
|
||||||
"description": "erst in der Abendzeit, damit die Sonne tief steht und das Gießen sich lohnt"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Grill-Fete",
|
|
||||||
"begin": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [1]},
|
|
||||||
{"action": "shift_day", "args": [5]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 18, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [1]},
|
|
||||||
{"action": "shift_day", "args": [5]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 23, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"location": "Drosselweg 7",
|
|
||||||
"description": "Grillgut ist selbst mitzubringen; Getränke sind bereits vor Ort"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 3,
|
|
||||||
"name": "Haus",
|
|
||||||
"hue": 0.6667,
|
|
||||||
"access": {
|
|
||||||
"public": false,
|
|
||||||
"default_level": "none",
|
|
||||||
"attributed_group": [
|
|
||||||
{
|
|
||||||
"group_id": 2,
|
|
||||||
"level": "view"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attributed_user": [
|
|
||||||
{
|
|
||||||
"user_id": 2,
|
|
||||||
"level": "admin"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"resource": {
|
|
||||||
"kind": "local",
|
|
||||||
"data": {
|
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"name": "Bad putzen",
|
|
||||||
"begin": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [-1]},
|
|
||||||
{"action": "shift_day", "args": [4]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 8, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [-1]},
|
|
||||||
{"action": "shift_day", "args": [4]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 9, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"location": "Eschenhain 11",
|
|
||||||
"description": "das Waschbecken sollte unbedingt von Keimen befreit werden"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Abstellkammer aufräumen",
|
|
||||||
"begin": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [1]},
|
|
||||||
{"action": "shift_day", "args": [0]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 12, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [1]},
|
|
||||||
{"action": "shift_day", "args": [0]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 13, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"location": "Eschenhain 11",
|
|
||||||
"description": "einiges davon kann vermutlich gleich entsorgt werden"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Treppe wischen",
|
|
||||||
"begin": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [2]},
|
|
||||||
{"action": "shift_day", "args": [1]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 14, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"timezone_shift": 0,
|
|
||||||
"date_relative": [
|
|
||||||
{"action": "trunc_week", "args": []},
|
|
||||||
{"action": "shift_week", "args": [2]},
|
|
||||||
{"action": "shift_day", "args": [1]}
|
|
||||||
],
|
|
||||||
"time": {"hour": 15, "minute": 0, "second": 0}
|
|
||||||
},
|
|
||||||
"location": "Eschenhain 11",
|
|
||||||
"description": "die dreckigen Schuhe haben ihre Spuren hinterlassen"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"id": 1,
|
|
||||||
"name": "user",
|
|
||||||
"email_address": "user@example.org",
|
|
||||||
"dav_token": null,
|
|
||||||
"password": "user"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"calendars": [
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## Beschreibung
|
## Beschreibung
|
||||||
|
|
||||||
- Hintergrund-Dienst für [zeitbild](/zeitbild/meta)
|
- Hintergrund-Dienst für Kalendar-Erstellung und -Darstellung
|
||||||
|
|
||||||
|
|
||||||
## Erstellung
|
## Erstellung
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
@ -33,13 +14,7 @@ namespace _zeitbild.api
|
||||||
access : {
|
access : {
|
||||||
public : boolean;
|
public : boolean;
|
||||||
default_level : string;
|
default_level : string;
|
||||||
attributed_group : Array<
|
attributed : Array<
|
||||||
{
|
|
||||||
group_id : int;
|
|
||||||
level : string;
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
attributed_user : Array<
|
|
||||||
{
|
{
|
||||||
user_id : int;
|
user_id : int;
|
||||||
level : string;
|
level : string;
|
||||||
|
|
@ -61,7 +36,6 @@ namespace _zeitbild.api
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
hue : float;
|
|
||||||
},
|
},
|
||||||
int
|
int
|
||||||
>(
|
>(
|
||||||
|
|
@ -118,33 +92,17 @@ namespace _zeitbild.api
|
||||||
"name": stuff.input.name,
|
"name": stuff.input.name,
|
||||||
"access": {
|
"access": {
|
||||||
"public": stuff.input.access.public,
|
"public": stuff.input.access.public,
|
||||||
"default_level": _zeitbild.access_level_from_string(stuff.input.access.default_level),
|
"default_level": _zeitbild.value_object.access_level.from_string(stuff.input.access.default_level),
|
||||||
"attributed_group": lib_plankton.map.hashmap.implementation_map(
|
"attributed": lib_plankton.map.hashmap.implementation_map(
|
||||||
lib_plankton.map.hashmap.make(
|
lib_plankton.map.hashmap.make(
|
||||||
x => x.toFixed(0),
|
x => x.toFixed(0),
|
||||||
{
|
{
|
||||||
"pairs": (
|
"pairs": (
|
||||||
stuff.input.access.attributed_group
|
stuff.input.access.attributed
|
||||||
.map(
|
|
||||||
(entry) => ({
|
|
||||||
"key": entry.group_id,
|
|
||||||
"value": _zeitbild.access_level_from_string(entry.level),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
),
|
|
||||||
"attributed_user": lib_plankton.map.hashmap.implementation_map(
|
|
||||||
lib_plankton.map.hashmap.make(
|
|
||||||
x => x.toFixed(0),
|
|
||||||
{
|
|
||||||
"pairs": (
|
|
||||||
stuff.input.access.attributed_user
|
|
||||||
.map(
|
.map(
|
||||||
(entry) => ({
|
(entry) => ({
|
||||||
"key": entry.user_id,
|
"key": entry.user_id,
|
||||||
"value": _zeitbild.access_level_from_string(entry.level),
|
"value": _zeitbild.value_object.access_level.from_string(entry.level),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.concat(
|
.concat(
|
||||||
|
|
@ -160,8 +118,7 @@ namespace _zeitbild.api
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
"resource_id": resource_id,
|
"resource_id": resource_id
|
||||||
"hue": stuff.input.hue,
|
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
_zeitbild.service.calendar.add(calendar_object)
|
_zeitbild.service.calendar.add(calendar_object)
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
@ -30,20 +11,13 @@ namespace _zeitbild.api
|
||||||
register<
|
register<
|
||||||
{
|
{
|
||||||
name : string;
|
name : string;
|
||||||
hue : float;
|
|
||||||
access : {
|
access : {
|
||||||
public : boolean;
|
public : boolean;
|
||||||
default_level : string;
|
default_level : ("none" | "view" | "edit" | "admin");
|
||||||
attributed_group : Array<
|
attributed : Array<
|
||||||
{
|
|
||||||
group_id : int;
|
|
||||||
level : string;
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
attributed_user : Array<
|
|
||||||
{
|
{
|
||||||
user_id : int;
|
user_id : int;
|
||||||
level : string;
|
level : ("none" | "view" | "edit" | "admin");
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
};
|
};
|
||||||
|
|
@ -80,36 +54,19 @@ namespace _zeitbild.api
|
||||||
);
|
);
|
||||||
const calendar_object_new : _zeitbild.type_calendar_object = {
|
const calendar_object_new : _zeitbild.type_calendar_object = {
|
||||||
"name": stuff.input.name,
|
"name": stuff.input.name,
|
||||||
"hue": stuff.input.hue,
|
|
||||||
"access": {
|
"access": {
|
||||||
"public": stuff.input.access.public,
|
"public": stuff.input.access.public,
|
||||||
"default_level": _zeitbild.access_level_from_string(stuff.input.access.default_level),
|
"default_level": _zeitbild.value_object.access_level.from_string(stuff.input.access.default_level),
|
||||||
"attributed_group": lib_plankton.map.hashmap.implementation_map(
|
"attributed": lib_plankton.map.hashmap.implementation_map(
|
||||||
lib_plankton.map.hashmap.make(
|
lib_plankton.map.hashmap.make(
|
||||||
x => x.toFixed(0),
|
x => x.toFixed(0),
|
||||||
{
|
{
|
||||||
"pairs": (
|
"pairs": (
|
||||||
stuff.input.access.attributed_group
|
stuff.input.access.attributed
|
||||||
.map(
|
|
||||||
(entry) => ({
|
|
||||||
"key": entry.group_id,
|
|
||||||
"value": _zeitbild.access_level_from_string(entry.level),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
),
|
|
||||||
"attributed_user": lib_plankton.map.hashmap.implementation_map(
|
|
||||||
lib_plankton.map.hashmap.make(
|
|
||||||
x => x.toFixed(0),
|
|
||||||
{
|
|
||||||
"pairs": (
|
|
||||||
stuff.input.access.attributed_user
|
|
||||||
.map(
|
.map(
|
||||||
(entry) => ({
|
(entry) => ({
|
||||||
"key": entry.user_id,
|
"key": entry.user_id,
|
||||||
"value": _zeitbild.access_level_from_string(entry.level),
|
"value": _zeitbild.value_object.access_level.from_string(entry.level),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
@ -117,7 +74,7 @@ namespace _zeitbild.api
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
"resource_id": calendar_object_old.resource_id,
|
"resource_id": calendar_object_old.resource_id
|
||||||
};
|
};
|
||||||
await _zeitbild.service.calendar.change(
|
await _zeitbild.service.calendar.change(
|
||||||
calendar_id,
|
calendar_id,
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
@ -30,10 +11,7 @@ namespace _zeitbild.api
|
||||||
register<
|
register<
|
||||||
_zeitbild.type_event_object, // TODO aufdröseln
|
_zeitbild.type_event_object, // TODO aufdröseln
|
||||||
(
|
(
|
||||||
{
|
null
|
||||||
local_resource_event_id : (null | int);
|
|
||||||
hash : string;
|
|
||||||
}
|
|
||||||
|
|
|
|
||||||
string
|
string
|
||||||
)
|
)
|
||||||
|
|
@ -91,12 +69,10 @@ namespace _zeitbild.api
|
||||||
const session : {key : string; value : lib_plankton.session.type_session;} = await session_from_stuff(stuff);
|
const session : {key : string; value : lib_plankton.session.type_session;} = await session_from_stuff(stuff);
|
||||||
const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.identify(session.value.name);
|
const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.identify(session.value.name);
|
||||||
|
|
||||||
if (stuff.input === null)
|
if (stuff.input === null) {
|
||||||
{
|
|
||||||
return Promise.reject(new Error("impossible"));
|
return Promise.reject(new Error("impossible"));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return (
|
return (
|
||||||
_zeitbild.service.calendar.event_add(
|
_zeitbild.service.calendar.event_add(
|
||||||
parseInt(stuff.path_parameters["calendar_id"]),
|
parseInt(stuff.path_parameters["calendar_id"]),
|
||||||
|
|
@ -104,9 +80,9 @@ namespace _zeitbild.api
|
||||||
user_id
|
user_id
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
(data) => Promise.resolve({
|
() => Promise.resolve({
|
||||||
"status_code": 200,
|
"status_code": 200,
|
||||||
"data": data,
|
"data": null,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
// TODO distinguish
|
// TODO distinguish
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
@ -88,12 +69,10 @@ namespace _zeitbild.api
|
||||||
const session : {key : string; value : lib_plankton.session.type_session;} = await session_from_stuff(stuff);
|
const session : {key : string; value : lib_plankton.session.type_session;} = await session_from_stuff(stuff);
|
||||||
const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.identify(session.value.name);
|
const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.identify(session.value.name);
|
||||||
|
|
||||||
if (stuff.input === null)
|
if (stuff.input === null) {
|
||||||
{
|
|
||||||
return Promise.reject(new Error("impossible"));
|
return Promise.reject(new Error("impossible"));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return (
|
return (
|
||||||
_zeitbild.service.calendar.event_change(
|
_zeitbild.service.calendar.event_change(
|
||||||
parseInt(stuff.path_parameters["calendar_id"]),
|
parseInt(stuff.path_parameters["calendar_id"]),
|
||||||
|
|
@ -102,21 +81,17 @@ namespace _zeitbild.api
|
||||||
user_id
|
user_id
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
() => Promise.resolve(
|
() => Promise.resolve({
|
||||||
{
|
|
||||||
"status_code": 200,
|
"status_code": 200,
|
||||||
"data": null,
|
"data": null,
|
||||||
}
|
})
|
||||||
)
|
|
||||||
)
|
)
|
||||||
// TODO distinguish
|
// TODO distinguish
|
||||||
.catch(
|
.catch(
|
||||||
(reason) => Promise.resolve(
|
(reason) => Promise.resolve({
|
||||||
{
|
|
||||||
"status_code": 403,
|
"status_code": 403,
|
||||||
"data": String(reason),
|
"data": String(reason),
|
||||||
}
|
})
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
@ -31,22 +12,14 @@ namespace _zeitbild.api
|
||||||
null,
|
null,
|
||||||
{
|
{
|
||||||
name : string;
|
name : string;
|
||||||
hue : float;
|
|
||||||
access : {
|
access : {
|
||||||
public : boolean;
|
|
||||||
default_level : string;
|
default_level : string;
|
||||||
attributed_group : Array<
|
attributed : Array<
|
||||||
{
|
|
||||||
group_id : int;
|
|
||||||
level : string;
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
attributed_user : Array<
|
|
||||||
{
|
{
|
||||||
user_id : int;
|
user_id : int;
|
||||||
level : string;
|
level : string;
|
||||||
}
|
}
|
||||||
>;
|
>
|
||||||
};
|
};
|
||||||
resource_id : int;
|
resource_id : int;
|
||||||
}
|
}
|
||||||
|
|
@ -71,27 +44,11 @@ namespace _zeitbild.api
|
||||||
);
|
);
|
||||||
const result = {
|
const result = {
|
||||||
"name": calendar_object.name,
|
"name": calendar_object.name,
|
||||||
"hue": calendar_object.hue,
|
|
||||||
"access": {
|
"access": {
|
||||||
"public": calendar_object.access.public,
|
"public": calendar_object.access.public,
|
||||||
"default_level": _zeitbild.api.access_level_encode(calendar_object.access.default_level),
|
"default_level": _zeitbild.api.access_level_encode(calendar_object.access.default_level),
|
||||||
"attributed_group": lib_plankton.call.convey(
|
"attributed": lib_plankton.call.convey(
|
||||||
calendar_object.access.attributed_group,
|
calendar_object.access.attributed,
|
||||||
[
|
|
||||||
lib_plankton.map.dump,
|
|
||||||
(pairs : Array<{key : _zeitbild.type_group_id; value : _zeitbild.enum_access_level;}>) => (
|
|
||||||
pairs
|
|
||||||
.map(
|
|
||||||
(pair : {key : _zeitbild.type_group_id; value : _zeitbild.enum_access_level;}) => ({
|
|
||||||
"group_id": pair.key,
|
|
||||||
"level": _zeitbild.api.access_level_encode(pair.value)
|
|
||||||
})
|
|
||||||
)
|
|
||||||
)
|
|
||||||
]
|
|
||||||
),
|
|
||||||
"attributed_user": lib_plankton.call.convey(
|
|
||||||
calendar_object.access.attributed_user,
|
|
||||||
[
|
[
|
||||||
lib_plankton.map.dump,
|
lib_plankton.map.dump,
|
||||||
(pairs : Array<{key : _zeitbild.type_user_id; value : _zeitbild.enum_access_level;}>) => (
|
(pairs : Array<{key : _zeitbild.type_user_id; value : _zeitbild.enum_access_level;}>) => (
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
@ -33,7 +14,6 @@ namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
id : int;
|
id : int;
|
||||||
name : string;
|
name : string;
|
||||||
hue : float;
|
|
||||||
access_level : string;
|
access_level : string;
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
@ -60,10 +40,6 @@ namespace _zeitbild.api
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
},
|
},
|
||||||
"hue": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"access_level": {
|
"access_level": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"nullable": true,
|
"nullable": true,
|
||||||
|
|
@ -73,8 +49,8 @@ namespace _zeitbild.api
|
||||||
"required": [
|
"required": [
|
||||||
"id",
|
"id",
|
||||||
"name",
|
"name",
|
||||||
"hue",
|
"public",
|
||||||
"access_level",
|
"role",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
@ -100,8 +76,7 @@ namespace _zeitbild.api
|
||||||
(entry) => ({
|
(entry) => ({
|
||||||
"id": entry.id,
|
"id": entry.id,
|
||||||
"name": entry.name,
|
"name": entry.name,
|
||||||
"hue": entry.hue,
|
"access_level": _zeitbild.value_object.access_level.to_string(entry.access_level),
|
||||||
"access_level": _zeitbild.access_level_to_string(entry.access_level),
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
@ -32,10 +13,8 @@ namespace _zeitbild.api
|
||||||
(
|
(
|
||||||
Array<
|
Array<
|
||||||
{
|
{
|
||||||
hash : _zeitbild.type_event_hash;
|
|
||||||
calendar_id : int;
|
calendar_id : int;
|
||||||
calendar_name : string;
|
calendar_name : string;
|
||||||
hue : float;
|
|
||||||
access_level : string;
|
access_level : string;
|
||||||
event_id : (null | int);
|
event_id : (null | int);
|
||||||
event_object : _zeitbild.type_event_object;
|
event_object : _zeitbild.type_event_object;
|
||||||
|
|
@ -74,10 +53,6 @@ namespace _zeitbild.api
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
"hash": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "string",
|
|
||||||
},
|
|
||||||
"calendar_id": {
|
"calendar_id": {
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
"type": "number",
|
"type": "number",
|
||||||
|
|
@ -86,10 +61,6 @@ namespace _zeitbild.api
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"hue": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"access_level": {
|
"access_level": {
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
@ -196,11 +167,8 @@ namespace _zeitbild.api
|
||||||
data
|
data
|
||||||
.map(
|
.map(
|
||||||
(entry) => ({
|
(entry) => ({
|
||||||
// todo
|
|
||||||
"hash": entry.hash,
|
|
||||||
"calendar_id": entry.calendar_id,
|
"calendar_id": entry.calendar_id,
|
||||||
"calendar_name": entry.calendar_name,
|
"calendar_name": entry.calendar_name,
|
||||||
"hue": entry.hue,
|
|
||||||
"access_level": _zeitbild.api.access_level_encode(entry.access_level),
|
"access_level": _zeitbild.api.access_level_encode(entry.access_level),
|
||||||
"event_id": entry.event_id,
|
"event_id": entry.event_id,
|
||||||
"event_object": entry.event_object,
|
"event_object": entry.event_object,
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export function register_group_list(
|
|
||||||
rest_subject : lib_plankton.rest_http.type_rest
|
|
||||||
) : void
|
|
||||||
{
|
|
||||||
register<
|
|
||||||
null,
|
|
||||||
Array<
|
|
||||||
{
|
|
||||||
id : int;
|
|
||||||
name : string;
|
|
||||||
label : string;
|
|
||||||
}
|
|
||||||
>
|
|
||||||
>(
|
|
||||||
rest_subject,
|
|
||||||
lib_plankton.http.enum_method.get,
|
|
||||||
"/groups",
|
|
||||||
{
|
|
||||||
"description": "listet alle Gruppen auf",
|
|
||||||
"query_parameters": () => ([
|
|
||||||
{
|
|
||||||
"name": "term",
|
|
||||||
"required": false,
|
|
||||||
"description": "search term",
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
"output_schema": () => ({
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "number",
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "string",
|
|
||||||
},
|
|
||||||
"label": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "string",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"id",
|
|
||||||
"name",
|
|
||||||
"label",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
"restriction": restriction_logged_in,
|
|
||||||
"execution": async (stuff) => {
|
|
||||||
const result : Array<
|
|
||||||
{
|
|
||||||
id : _zeitbild.type_group_id;
|
|
||||||
name : string;
|
|
||||||
label : string;
|
|
||||||
}
|
|
||||||
> = (
|
|
||||||
(await _zeitbild.service.group.list())
|
|
||||||
.map(
|
|
||||||
entry => (
|
|
||||||
{
|
|
||||||
"id": entry.id,
|
|
||||||
"name": entry.object.name,
|
|
||||||
"label": entry.object.label,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
return Promise.resolve(
|
|
||||||
{
|
|
||||||
"status_code": 200,
|
|
||||||
"data": result,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
@ -65,30 +46,23 @@ namespace _zeitbild.api
|
||||||
}),
|
}),
|
||||||
"restriction": () => restriction_none,
|
"restriction": () => restriction_none,
|
||||||
"execution": () => async ({"input": input}) => {
|
"execution": () => async ({"input": input}) => {
|
||||||
if (input === null)
|
if (input === null) {
|
||||||
{
|
|
||||||
return Promise.reject(new Error("impossible"));
|
return Promise.reject(new Error("impossible"));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
const passed : boolean = await _zeitbild.service.auth_internal.check(input.name, input.password);
|
const passed : boolean = await _zeitbild.service.auth_internal.check(input.name, input.password);
|
||||||
if (! passed)
|
if (! passed) {
|
||||||
{
|
return Promise.resolve({
|
||||||
return Promise.resolve(
|
|
||||||
{
|
|
||||||
"status_code": 403,
|
"status_code": 403,
|
||||||
"data": null,
|
"data": null,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const session_key : string = await lib_plankton.session.begin(input.name);
|
const session_key : string = await lib_plankton.session.begin(input.name);
|
||||||
return Promise.resolve(
|
return Promise.resolve({
|
||||||
{
|
|
||||||
"status_code": 201,
|
"status_code": 201,
|
||||||
"data": session_key,
|
"data": session_key,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
@ -43,12 +24,10 @@ namespace _zeitbild.api
|
||||||
"execution": async (stuff) => {
|
"execution": async (stuff) => {
|
||||||
const session : {key : string; value : lib_plankton.session.type_session} = await session_from_stuff(stuff);
|
const session : {key : string; value : lib_plankton.session.type_session} = await session_from_stuff(stuff);
|
||||||
await lib_plankton.session.end(session.key);
|
await lib_plankton.session.end(session.key);
|
||||||
return Promise.resolve(
|
return Promise.resolve({
|
||||||
{
|
|
||||||
"status_code": 200,
|
"status_code": 200,
|
||||||
"data": null,
|
"data": null,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
@ -71,17 +52,43 @@ namespace _zeitbild.api
|
||||||
"execution": async (stuff) => {
|
"execution": async (stuff) => {
|
||||||
const data : {
|
const data : {
|
||||||
token : string;
|
token : string;
|
||||||
userinfo : lib_plankton.auth.oidc.type_userinfo;
|
userinfo : {
|
||||||
|
name : (null | string);
|
||||||
|
email : (null | string);
|
||||||
|
};
|
||||||
redirect_uri_template : string;
|
redirect_uri_template : string;
|
||||||
} = await _zeitbild.auth.oidc_handle_authorization_callback(
|
} = await _zeitbild.auth.oidc_handle_authorization_callback(
|
||||||
(stuff.headers["Cookie"] ?? stuff.headers["cookie"] ?? null),
|
(stuff.headers["Cookie"] ?? stuff.headers["cookie"] ?? null),
|
||||||
stuff.query_parameters
|
stuff.query_parameters
|
||||||
);
|
);
|
||||||
|
if (data.userinfo.name === null) {
|
||||||
const user = await _zeitbild.auth.oidc_adapt_user(data.userinfo);
|
return Promise.reject(
|
||||||
|
new Error(
|
||||||
|
"IDP did not return user name"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
await _zeitbild.service.user.add(
|
||||||
|
{
|
||||||
|
"name": data.userinfo.name,
|
||||||
|
"email_address": data.userinfo.email,
|
||||||
|
"dav_token": null,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
lib_plankton.log.info(
|
||||||
|
"user_provisioned",
|
||||||
|
{
|
||||||
|
"name": data.userinfo.name,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
const session_key : string = await lib_plankton.session.begin(
|
const session_key : string = await lib_plankton.session.begin(
|
||||||
user.object.name,
|
data.userinfo.name,
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"oidc_token": data.token,
|
"oidc_token": data.token,
|
||||||
|
|
@ -104,6 +111,7 @@ namespace _zeitbild.api
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,94 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export function register_session_status(
|
|
||||||
rest_subject : lib_plankton.rest_http.type_rest
|
|
||||||
) : void
|
|
||||||
{
|
|
||||||
register<
|
|
||||||
null,
|
|
||||||
{
|
|
||||||
logged_in : boolean;
|
|
||||||
name : (null | string);
|
|
||||||
}
|
|
||||||
>(
|
|
||||||
rest_subject,
|
|
||||||
lib_plankton.http.enum_method.get,
|
|
||||||
"/session/status",
|
|
||||||
{
|
|
||||||
"description": "gibt Information über den Nutzer aus",
|
|
||||||
"output_schema": () => ({
|
|
||||||
"nullable": false,
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"logged_in": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "boolean",
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"nullable": true,
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"logged_in",
|
|
||||||
"name",
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
"restriction": restriction_none,
|
|
||||||
"execution": async (stuff) => {
|
|
||||||
const user_id : (null | _zeitbild.type_user_id) = await (
|
|
||||||
session_from_stuff(stuff)
|
|
||||||
.then(
|
|
||||||
(session : {key : string; value : lib_plankton.session.type_session;}) => (
|
|
||||||
_zeitbild.service.user.identify(session.value.name)
|
|
||||||
.catch(x => Promise.resolve(null))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.catch(x => Promise.resolve(null))
|
|
||||||
);
|
|
||||||
const user_object : (null | _zeitbild.type_user_object) = (
|
|
||||||
(user_id === null)
|
|
||||||
?
|
|
||||||
null
|
|
||||||
:
|
|
||||||
(await _zeitbild.service.user.get(user_id))
|
|
||||||
);
|
|
||||||
return Promise.resolve(
|
|
||||||
{
|
|
||||||
"status_code": 200,
|
|
||||||
"data": {
|
|
||||||
"logged_in": (user_id !== null),
|
|
||||||
"name": ((user_object === null) ? null : user_object.name),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
@ -49,11 +30,6 @@ namespace _zeitbild.api
|
||||||
_zeitbild.api.register_session_begin(rest_subject);
|
_zeitbild.api.register_session_begin(rest_subject);
|
||||||
_zeitbild.api.register_session_end(rest_subject);
|
_zeitbild.api.register_session_end(rest_subject);
|
||||||
_zeitbild.api.register_session_oidc(rest_subject);
|
_zeitbild.api.register_session_oidc(rest_subject);
|
||||||
_zeitbild.api.register_session_status(rest_subject);
|
|
||||||
}
|
|
||||||
// groups
|
|
||||||
{
|
|
||||||
_zeitbild.api.register_group_list(rest_subject);
|
|
||||||
}
|
}
|
||||||
// user
|
// user
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.api
|
namespace _zeitbild.api
|
||||||
{
|
{
|
||||||
|
|
|
||||||
217
source/auth.ts
217
source/auth.ts
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.auth
|
namespace _zeitbild.auth
|
||||||
{
|
{
|
||||||
|
|
@ -52,12 +33,10 @@ namespace _zeitbild.auth
|
||||||
key : string
|
key : string
|
||||||
) : string
|
) : string
|
||||||
{
|
{
|
||||||
if (_oidc_redict_uri_template_map === null)
|
if (_oidc_redict_uri_template_map === null) {
|
||||||
{
|
|
||||||
throw (new Error("apparently not initialized yet"));
|
throw (new Error("apparently not initialized yet"));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return _oidc_redict_uri_template_map.get(key);
|
return _oidc_redict_uri_template_map.get(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -69,8 +48,7 @@ namespace _zeitbild.auth
|
||||||
) : Promise<void>
|
) : Promise<void>
|
||||||
{
|
{
|
||||||
switch (_zeitbild.conf.get().authentication.kind) {
|
switch (_zeitbild.conf.get().authentication.kind) {
|
||||||
case "internal":
|
case "internal": {
|
||||||
{
|
|
||||||
_subject = lib_plankton.auth.internal.implementation_auth(
|
_subject = lib_plankton.auth.internal.implementation_auth(
|
||||||
{
|
{
|
||||||
"password_image_chest": {
|
"password_image_chest": {
|
||||||
|
|
@ -86,8 +64,7 @@ namespace _zeitbild.auth
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "oidc":
|
case "oidc": {
|
||||||
{
|
|
||||||
_subject_oidc = lib_plankton.auth.oidc.make(
|
_subject_oidc = lib_plankton.auth.oidc.make(
|
||||||
{
|
{
|
||||||
"url_authorization": _zeitbild.conf.get().authentication.data.url_authorization,
|
"url_authorization": _zeitbild.conf.get().authentication.data.url_authorization,
|
||||||
|
|
@ -100,7 +77,6 @@ namespace _zeitbild.auth
|
||||||
"openid",
|
"openid",
|
||||||
"profile",
|
"profile",
|
||||||
"email",
|
"email",
|
||||||
"groups",
|
|
||||||
],
|
],
|
||||||
"label": _zeitbild.conf.get().authentication.data.label,
|
"label": _zeitbild.conf.get().authentication.data.label,
|
||||||
}
|
}
|
||||||
|
|
@ -113,8 +89,7 @@ namespace _zeitbild.auth
|
||||||
return Promise.resolve(undefined);
|
return Promise.resolve(undefined);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
// do nothing
|
// do nothing
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -129,16 +104,12 @@ namespace _zeitbild.auth
|
||||||
input : any
|
input : any
|
||||||
) : Promise<{kind : string; data : any;}>
|
) : Promise<{kind : string; data : any;}>
|
||||||
{
|
{
|
||||||
switch (_zeitbild.conf.get().authentication.kind)
|
switch (_zeitbild.conf.get().authentication.kind) {
|
||||||
{
|
case "oidc": {
|
||||||
case "oidc":
|
if ((_subject_oidc === null) || (_oidc_redict_uri_template_map === null)) {
|
||||||
{
|
|
||||||
if ((_subject_oidc === null) || (_oidc_redict_uri_template_map === null))
|
|
||||||
{
|
|
||||||
throw (new Error("not initialized yet"));
|
throw (new Error("not initialized yet"));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
const stuff : {state : string; authorization_url : string;} = lib_plankton.auth.oidc.prepare_login(_subject_oidc);
|
const stuff : {state : string; authorization_url : string;} = lib_plankton.auth.oidc.prepare_login(_subject_oidc);
|
||||||
_oidc_redict_uri_template_map.set(
|
_oidc_redict_uri_template_map.set(
|
||||||
stuff.state,
|
stuff.state,
|
||||||
|
|
@ -156,14 +127,11 @@ namespace _zeitbild.auth
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
if (_subject === null) {
|
||||||
if (_subject === null)
|
|
||||||
{
|
|
||||||
return Promise.reject(new Error("not initialized yet"));
|
return Promise.reject(new Error("not initialized yet"));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return (
|
return (
|
||||||
_subject.login_prepare()
|
_subject.login_prepare()
|
||||||
.then(
|
.then(
|
||||||
|
|
@ -188,21 +156,25 @@ namespace _zeitbild.auth
|
||||||
) : Promise<
|
) : Promise<
|
||||||
{
|
{
|
||||||
token : string;
|
token : string;
|
||||||
userinfo : lib_plankton.auth.oidc.type_userinfo;
|
userinfo : {
|
||||||
|
name : (null | string);
|
||||||
|
email : (null | string);
|
||||||
|
};
|
||||||
redirect_uri_template : string;
|
redirect_uri_template : string;
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
if ((_subject_oidc === null) || (_oidc_redict_uri_template_map === null))
|
if ((_subject_oidc === null) || (_oidc_redict_uri_template_map === null)) {
|
||||||
{
|
|
||||||
throw (new Error("not initialized yet"));
|
throw (new Error("not initialized yet"));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
const state : string = data["state"];
|
const state : string = data["state"];
|
||||||
const result : {
|
const result : {
|
||||||
token : string;
|
token : string;
|
||||||
userinfo : lib_plankton.auth.oidc.type_userinfo;
|
userinfo : {
|
||||||
|
name : (null | string);
|
||||||
|
email : (null | string);
|
||||||
|
};
|
||||||
} = await lib_plankton.auth.oidc.handle_authorization_callback(
|
} = await lib_plankton.auth.oidc.handle_authorization_callback(
|
||||||
_subject_oidc,
|
_subject_oidc,
|
||||||
cookie,
|
cookie,
|
||||||
|
|
@ -211,7 +183,10 @@ namespace _zeitbild.auth
|
||||||
return Promise.resolve<
|
return Promise.resolve<
|
||||||
{
|
{
|
||||||
token : string;
|
token : string;
|
||||||
userinfo : lib_plankton.auth.oidc.type_userinfo;
|
userinfo : {
|
||||||
|
name : (null | string);
|
||||||
|
email : (null | string);
|
||||||
|
};
|
||||||
redirect_uri_template : string;
|
redirect_uri_template : string;
|
||||||
}
|
}
|
||||||
>(
|
>(
|
||||||
|
|
@ -224,144 +199,4 @@ namespace _zeitbild.auth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo switch for enabling/disabling auto provisioning
|
|
||||||
*/
|
|
||||||
export async function oidc_adapt_user(
|
|
||||||
userinfo : lib_plankton.auth.oidc.type_userinfo
|
|
||||||
)
|
|
||||||
: Promise<
|
|
||||||
{
|
|
||||||
id : _zeitbild.type_user_id;
|
|
||||||
object : _zeitbild.type_user_object;
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
if (userinfo.name === null)
|
|
||||||
{
|
|
||||||
return Promise.reject(new Error("IDP did not return user name"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// groups
|
|
||||||
const group_ids : Array<_zeitbild.type_group_id> = await (async () => {
|
|
||||||
const derive_name : ((group_name_raw : string) => string) = (
|
|
||||||
(group_name_raw) => lib_plankton.string.coin(
|
|
||||||
"auto-{{name_raw}}",
|
|
||||||
{
|
|
||||||
"name_raw": group_name_raw,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const derive_label : ((group_name_raw : string) => string) = (
|
|
||||||
(group_name_raw) => lib_plankton.string.coin(
|
|
||||||
"{{name_raw}}",
|
|
||||||
{
|
|
||||||
"name_raw": group_name_raw,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
return Promise.all<_zeitbild.type_group_id>(
|
|
||||||
(userinfo.groups ?? [])
|
|
||||||
.map(
|
|
||||||
async (group_name_raw) => {
|
|
||||||
const group_name : string = derive_name(group_name_raw);
|
|
||||||
const group_id_raw : (null | _zeitbild.type_group_id) = await (
|
|
||||||
_zeitbild.repository.group.identify(group_name)
|
|
||||||
.catch(() => Promise.resolve(null))
|
|
||||||
);
|
|
||||||
if (group_id_raw === null)
|
|
||||||
{
|
|
||||||
// create
|
|
||||||
const group_id : _zeitbild.type_group_id = await _zeitbild.service.group.add(
|
|
||||||
{
|
|
||||||
"name": group_name,
|
|
||||||
"label": derive_label(group_name_raw),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
lib_plankton.log.info(
|
|
||||||
"zeitbild.oidc_adapt_user.auto_provisioned_group",
|
|
||||||
{
|
|
||||||
"id": group_id,
|
|
||||||
"name": group_name,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return group_id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// update
|
|
||||||
const group_id : _zeitbild.type_group_id = group_id_raw;
|
|
||||||
await _zeitbild.service.group.change(
|
|
||||||
group_id,
|
|
||||||
{
|
|
||||||
"name": group_name,
|
|
||||||
"label": derive_label(group_name_raw),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return group_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}) ();
|
|
||||||
|
|
||||||
// user
|
|
||||||
const user : {
|
|
||||||
id : _zeitbild.type_user_id;
|
|
||||||
object : _zeitbild.type_user_object;
|
|
||||||
} = await (async () => {
|
|
||||||
const user_id_raw : (null | _zeitbild.type_user_id) = await (
|
|
||||||
_zeitbild.service.user.identify(userinfo.name as string)
|
|
||||||
.catch(() => Promise.resolve(null))
|
|
||||||
);
|
|
||||||
if (user_id_raw === null)
|
|
||||||
{
|
|
||||||
// provision
|
|
||||||
const user_object : _zeitbild.type_user_object = {
|
|
||||||
"name": (userinfo.name as string),
|
|
||||||
"groups": group_ids,
|
|
||||||
"email_address": userinfo.email,
|
|
||||||
"dav_token": null,
|
|
||||||
};
|
|
||||||
const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.add(
|
|
||||||
user_object
|
|
||||||
);
|
|
||||||
lib_plankton.log.info(
|
|
||||||
"user_provisioned",
|
|
||||||
{
|
|
||||||
"id": user_id,
|
|
||||||
"name": user_object.name,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return {"id": user_id, "object": user_object};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// update
|
|
||||||
const user_id : _zeitbild.type_user_id = user_id_raw;
|
|
||||||
const user_object : _zeitbild.type_user_object = await _zeitbild.service.user.get(user_id);
|
|
||||||
user_object.name = (userinfo.name as string);
|
|
||||||
user_object.groups = group_ids;
|
|
||||||
user_object.email_address = userinfo.email;
|
|
||||||
await _zeitbild.service.user.change(
|
|
||||||
user_id,
|
|
||||||
user_object
|
|
||||||
);
|
|
||||||
lib_plankton.log.info(
|
|
||||||
"user_updated",
|
|
||||||
{
|
|
||||||
"id": user_id,
|
|
||||||
"name": user_object.name,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return {"id": user_id, "object": user_object};
|
|
||||||
}
|
|
||||||
}) ();
|
|
||||||
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild
|
namespace _zeitbild
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.conf
|
namespace _zeitbild.conf
|
||||||
{
|
{
|
||||||
|
|
@ -76,51 +57,7 @@ namespace _zeitbild.conf
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"kind": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "string",
|
|
||||||
"enum": ["file"]
|
|
||||||
},
|
|
||||||
"data": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"path": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"threshold": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"debug",
|
|
||||||
"info",
|
|
||||||
"notice",
|
|
||||||
"warning",
|
|
||||||
"error"
|
|
||||||
],
|
|
||||||
"default": "info"
|
|
||||||
},
|
|
||||||
"format": {
|
|
||||||
"nullable": false,
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"human_readable",
|
|
||||||
"jsonl",
|
|
||||||
"jsonl_structured",
|
|
||||||
],
|
|
||||||
"default": "human_readable",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"default": [
|
"default": [
|
||||||
|
|
@ -251,13 +188,8 @@ namespace _zeitbild.conf
|
||||||
"lifetime": {
|
"lifetime": {
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"default": 3600,
|
"default": 900
|
||||||
},
|
}
|
||||||
"prolongation": {
|
|
||||||
"nullable": true,
|
|
||||||
"type": "integer",
|
|
||||||
"default": 300,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
],
|
],
|
||||||
|
|
@ -335,8 +267,7 @@ namespace _zeitbild.conf
|
||||||
"url_token",
|
"url_token",
|
||||||
"url_userinfo",
|
"url_userinfo",
|
||||||
"client_id",
|
"client_id",
|
||||||
"client_secret",
|
"client_secret"
|
||||||
"backend_url_base"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.database
|
namespace _zeitbild.database
|
||||||
{
|
{
|
||||||
|
|
@ -24,7 +5,7 @@ namespace _zeitbild.database
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
const _compatible_revisions : Array<string> = [
|
const _compatible_revisions : Array<string> = [
|
||||||
"r6",
|
"r4",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
@ -78,35 +59,30 @@ namespace _zeitbild.helpers
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @todo timezone
|
||||||
*/
|
*/
|
||||||
export function icalendar_dt_from_own_datetime(
|
export function icalendar_dt_from_own_datetime(
|
||||||
datetime : lib_plankton.pit.type_datetime
|
datetime : lib_plankton.pit.type_datetime
|
||||||
) : lib_plankton.ical.type_dt
|
) : lib_plankton.ical.type_dt
|
||||||
{
|
{
|
||||||
const datetime_normalized : lib_plankton.pit.type_datetime = lib_plankton.pit.to_datetime(
|
|
||||||
lib_plankton.pit.from_datetime(datetime),
|
|
||||||
{
|
|
||||||
"timezone_shift": 0,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return {
|
return {
|
||||||
"tzid": "UTC",
|
"tzid": "Europe/Berlin",
|
||||||
"value": {
|
"value": {
|
||||||
"date": {
|
"date": {
|
||||||
"year": datetime_normalized.date.year,
|
"year": datetime.date.year,
|
||||||
"month": datetime_normalized.date.month,
|
"month": datetime.date.month,
|
||||||
"day": datetime_normalized.date.day,
|
"day": datetime.date.day,
|
||||||
},
|
},
|
||||||
"time": (
|
"time": (
|
||||||
(datetime_normalized.time === null)
|
(datetime.time === null)
|
||||||
?
|
?
|
||||||
null
|
null
|
||||||
:
|
:
|
||||||
{
|
{
|
||||||
"utc": true,
|
"utc": true,
|
||||||
"hour": datetime_normalized.time.hour,
|
"hour": datetime.time.hour,
|
||||||
"minute": datetime_normalized.time.minute,
|
"minute": datetime.time.minute,
|
||||||
"second": datetime_normalized.time.second,
|
"second": datetime.time.second,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
199
source/logic.ts
199
source/logic.ts
|
|
@ -1,199 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
namespace _zeitbild
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export function access_level_to_string(
|
|
||||||
access_level : _zeitbild.enum_access_level
|
|
||||||
)
|
|
||||||
: string
|
|
||||||
{
|
|
||||||
switch (access_level)
|
|
||||||
{
|
|
||||||
case _zeitbild.enum_access_level.none: {return "none";}
|
|
||||||
case _zeitbild.enum_access_level.view: {return "view";}
|
|
||||||
case _zeitbild.enum_access_level.edit: {return "edit";}
|
|
||||||
case _zeitbild.enum_access_level.admin: {return "admin";}
|
|
||||||
default: {throw (new Error("invalid access level: " + String(access_level)));}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export function access_level_from_string(
|
|
||||||
representation : string
|
|
||||||
)
|
|
||||||
: _zeitbild.enum_access_level
|
|
||||||
{
|
|
||||||
switch (representation)
|
|
||||||
{
|
|
||||||
case "none": {return _zeitbild.enum_access_level.none;}
|
|
||||||
case "view": {return _zeitbild.enum_access_level.view;}
|
|
||||||
case "edit": {return _zeitbild.enum_access_level.edit;}
|
|
||||||
case "admin": {return _zeitbild.enum_access_level.admin;}
|
|
||||||
default: {throw (new Error("invalid encoded access level: " + String(representation)));}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export function access_level_order(
|
|
||||||
x : _zeitbild.enum_access_level,
|
|
||||||
y : _zeitbild.enum_access_level
|
|
||||||
)
|
|
||||||
: boolean
|
|
||||||
{
|
|
||||||
const list : Array<_zeitbild.enum_access_level> = [
|
|
||||||
_zeitbild.enum_access_level.none,
|
|
||||||
_zeitbild.enum_access_level.view,
|
|
||||||
_zeitbild.enum_access_level.edit,
|
|
||||||
_zeitbild.enum_access_level.admin,
|
|
||||||
];
|
|
||||||
return (list.indexOf(x) <= list.indexOf(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export function access_level_determine_raw(
|
|
||||||
public_ : boolean,
|
|
||||||
access_level_attributed : (
|
|
||||||
null
|
|
||||||
|
|
|
||||||
{
|
|
||||||
default : _zeitbild.enum_access_level,
|
|
||||||
group : Array<_zeitbild.enum_access_level>;
|
|
||||||
user : (null | _zeitbild.enum_access_level);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
: _zeitbild.enum_access_level
|
|
||||||
{
|
|
||||||
return lib_plankton.call.convey(
|
|
||||||
_zeitbild.enum_access_level.none,
|
|
||||||
[
|
|
||||||
// if public
|
|
||||||
(x : _zeitbild.enum_access_level) => (
|
|
||||||
public_
|
|
||||||
?
|
|
||||||
_zeitbild.enum_access_level.view
|
|
||||||
:
|
|
||||||
x
|
|
||||||
),
|
|
||||||
// if logged in
|
|
||||||
(x : _zeitbild.enum_access_level) => (
|
|
||||||
(access_level_attributed === null)
|
|
||||||
?
|
|
||||||
x
|
|
||||||
:
|
|
||||||
lib_plankton.call.convey(
|
|
||||||
x,
|
|
||||||
[
|
|
||||||
// default
|
|
||||||
(y : _zeitbild.enum_access_level) => access_level_attributed.default,
|
|
||||||
// group
|
|
||||||
(y : _zeitbild.enum_access_level) => (
|
|
||||||
lib_plankton.call.null_prop(
|
|
||||||
lib_plankton.list.max<_zeitbild.enum_access_level, _zeitbild.enum_access_level>(
|
|
||||||
access_level_attributed.group,
|
|
||||||
z => z,
|
|
||||||
{
|
|
||||||
"compare_value": _zeitbild.access_level_order,
|
|
||||||
}
|
|
||||||
),
|
|
||||||
z => z.value
|
|
||||||
)
|
|
||||||
??
|
|
||||||
y
|
|
||||||
),
|
|
||||||
// user
|
|
||||||
(y : _zeitbild.enum_access_level) => (
|
|
||||||
(access_level_attributed.user === null)
|
|
||||||
?
|
|
||||||
y
|
|
||||||
:
|
|
||||||
access_level_attributed.user
|
|
||||||
),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export function access_level_determine(
|
|
||||||
calendar_object : _zeitbild.type_calendar_object,
|
|
||||||
user : (
|
|
||||||
null
|
|
||||||
|
|
|
||||||
{
|
|
||||||
id : _zeitbild.type_user_id;
|
|
||||||
object : _zeitbild.type_user_object;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
: _zeitbild.enum_access_level
|
|
||||||
{
|
|
||||||
return access_level_determine_raw(
|
|
||||||
calendar_object.access.public,
|
|
||||||
(
|
|
||||||
(user === null)
|
|
||||||
?
|
|
||||||
null
|
|
||||||
:
|
|
||||||
{
|
|
||||||
"default": calendar_object.access.default_level,
|
|
||||||
"group": (
|
|
||||||
user.object.groups
|
|
||||||
.map<(null | _zeitbild.enum_access_level)>(
|
|
||||||
group_id => (
|
|
||||||
calendar_object.access.attributed_group.has(group_id)
|
|
||||||
?
|
|
||||||
calendar_object.access.attributed_group.get(group_id)
|
|
||||||
:
|
|
||||||
null
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.filter(
|
|
||||||
x => (x !== null)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
"user": (
|
|
||||||
lib_plankton.call.try_catch_wrap<_zeitbild.enum_access_level>(
|
|
||||||
() => calendar_object.access.attributed_user.get(user.id)
|
|
||||||
).value
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
247
source/main.ts
247
source/main.ts
|
|
@ -1,23 +1,162 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
/**
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
type type_data = {
|
||||||
|
users : Array<
|
||||||
|
{
|
||||||
|
id : int;
|
||||||
|
name : string;
|
||||||
|
email_address : string;
|
||||||
|
dav_token : (null | string);
|
||||||
|
password : string;
|
||||||
|
}
|
||||||
|
>;
|
||||||
|
calendars : Array<
|
||||||
|
{
|
||||||
|
id : int;
|
||||||
|
name : string;
|
||||||
|
access : {
|
||||||
|
public ?: boolean;
|
||||||
|
default_level : ("none" | "view" | "edit" | "admin");
|
||||||
|
attributed : Array<
|
||||||
|
{
|
||||||
|
user_id : int;
|
||||||
|
level : ("none" | "view" | "edit" | "admin");
|
||||||
|
}
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
resource : (
|
||||||
|
{
|
||||||
|
kind : "local";
|
||||||
|
data : {
|
||||||
|
events : Array<
|
||||||
|
_zeitbild.type_event_object
|
||||||
|
>
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
||||||
|
{
|
||||||
|
kind : "ics_feed";
|
||||||
|
data : {
|
||||||
|
url : string;
|
||||||
|
from_fucked_up_wordpress ?: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
async function data_init(
|
||||||
|
data : type_data
|
||||||
|
) : Promise<void>
|
||||||
|
{
|
||||||
|
let track : {
|
||||||
|
user : Record<
|
||||||
|
int,
|
||||||
|
_zeitbild.type_user_id
|
||||||
|
>;
|
||||||
|
calendar : Record<
|
||||||
|
int,
|
||||||
|
_zeitbild.type_user_id
|
||||||
|
>;
|
||||||
|
} = {
|
||||||
|
"user": {},
|
||||||
|
"calendar": {},
|
||||||
|
};
|
||||||
|
for await (const user_raw of data.users)
|
||||||
|
{
|
||||||
|
const user_object : _zeitbild.type_user_object = {
|
||||||
|
"name": user_raw.name,
|
||||||
|
"email_address": user_raw.email_address,
|
||||||
|
"dav_token": user_raw.dav_token,
|
||||||
|
};
|
||||||
|
const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.add(
|
||||||
|
user_object
|
||||||
|
);
|
||||||
|
await _zeitbild.service.auth_internal.set(
|
||||||
|
user_raw.name,
|
||||||
|
user_raw.password
|
||||||
|
);
|
||||||
|
track.user[user_raw.id] = user_id;
|
||||||
|
}
|
||||||
|
for await (const calendar_raw of data.calendars)
|
||||||
|
{
|
||||||
|
let resource_object : _zeitbild.type_resource_object;
|
||||||
|
let resource_id : _zeitbild.type_resource_id;
|
||||||
|
switch (calendar_raw.resource.kind)
|
||||||
|
{
|
||||||
|
case "local":
|
||||||
|
{
|
||||||
|
resource_object = {
|
||||||
|
"kind": "local",
|
||||||
|
"data": {
|
||||||
|
"event_ids": [],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
resource_id = await _zeitbild.service.resource.add(
|
||||||
|
resource_object
|
||||||
|
);
|
||||||
|
/*const event_ids : Array<_zeitbild.type_local_resource_event_id> = */await Promise.all(
|
||||||
|
calendar_raw.resource.data.events
|
||||||
|
.map(
|
||||||
|
(event_raw : _zeitbild.type_event_object) => _zeitbild.service.resource.event_add(resource_id, event_raw)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "ics_feed":
|
||||||
|
{
|
||||||
|
resource_object = {
|
||||||
|
"kind": "ics_feed",
|
||||||
|
"data": {
|
||||||
|
"url": calendar_raw.resource.data.url,
|
||||||
|
"from_fucked_up_wordpress": (calendar_raw.resource.data.from_fucked_up_wordpress ?? false),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
resource_id = await _zeitbild.service.resource.add(
|
||||||
|
resource_object
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const calendar_object : _zeitbild.type_calendar_object =
|
||||||
|
{
|
||||||
|
"name": calendar_raw.name,
|
||||||
|
"access": {
|
||||||
|
"public": (calendar_raw.access.public ?? false),
|
||||||
|
"default_level": _zeitbild.value_object.access_level.from_string(calendar_raw.access.default_level),
|
||||||
|
"attributed": lib_plankton.map.hashmap.implementation_map(
|
||||||
|
lib_plankton.map.hashmap.make(
|
||||||
|
x => x.toFixed(0),
|
||||||
|
{
|
||||||
|
"pairs": (
|
||||||
|
calendar_raw.access.attributed
|
||||||
|
.map(
|
||||||
|
(entry) => ({
|
||||||
|
"key": track.user[entry.user_id],
|
||||||
|
"value": _zeitbild.value_object.access_level.from_string(entry.level),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
},
|
||||||
|
"resource_id": resource_id,
|
||||||
|
};
|
||||||
|
const calendar_id : _zeitbild.type_calendar_id = await _zeitbild.service.calendar.add(
|
||||||
|
calendar_object
|
||||||
|
);
|
||||||
|
track.calendar[calendar_raw.id] = calendar_id;
|
||||||
|
}
|
||||||
|
return Promise.resolve<void>(undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
@ -69,8 +208,8 @@ async function main(
|
||||||
"description": "conf-expose"
|
"description": "conf-expose"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sample",
|
"name": "fill",
|
||||||
"description": "sample"
|
"description": "fill"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "help",
|
"name": "help",
|
||||||
|
|
@ -172,46 +311,6 @@ async function main(
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "file": {
|
|
||||||
return {
|
|
||||||
"kind": "minlevel",
|
|
||||||
"data": {
|
|
||||||
"core": {
|
|
||||||
"kind": "file",
|
|
||||||
"data": {
|
|
||||||
"path": log_output.data.path,
|
|
||||||
"format": lib_plankton.call.distinguish(
|
|
||||||
{
|
|
||||||
"kind": log_output.data.format,
|
|
||||||
"data": null,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"jsonl": () => ({
|
|
||||||
"kind": "jsonl",
|
|
||||||
"data": {
|
|
||||||
"structured": false,
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
"jsonl_structured": () => ({
|
|
||||||
"kind": "jsonl",
|
|
||||||
"data": {
|
|
||||||
"structured": true,
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
"human_readable": () => ({
|
|
||||||
"kind": "human_readable",
|
|
||||||
"data": {
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"threshold": log_output.data.threshold,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
default: {
|
||||||
throw (new Error("unhandled"));
|
throw (new Error("unhandled"));
|
||||||
break;
|
break;
|
||||||
|
|
@ -248,10 +347,8 @@ async function main(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch (args["action"])
|
switch (args["action"]) {
|
||||||
{
|
default: {
|
||||||
default:
|
|
||||||
{
|
|
||||||
lib_plankton.log.error(
|
lib_plankton.log.error(
|
||||||
"main_invalid_action",
|
"main_invalid_action",
|
||||||
{
|
{
|
||||||
|
|
@ -260,8 +357,7 @@ async function main(
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "conf-schema":
|
case "conf-schema": {
|
||||||
{
|
|
||||||
process.stdout.write(
|
process.stdout.write(
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
_zeitbild.conf.schema(),
|
_zeitbild.conf.schema(),
|
||||||
|
|
@ -273,8 +369,7 @@ async function main(
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "conf-expose":
|
case "conf-expose": {
|
||||||
{
|
|
||||||
process.stdout.write(
|
process.stdout.write(
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
_zeitbild.conf.get(),
|
_zeitbild.conf.get(),
|
||||||
|
|
@ -286,8 +381,7 @@ async function main(
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "api-doc":
|
case "api-doc": {
|
||||||
{
|
|
||||||
lib_plankton.log.set_main_logger([]);
|
lib_plankton.log.set_main_logger([]);
|
||||||
const rest_subject : lib_plankton.rest_http.type_rest = _zeitbild.api.make();
|
const rest_subject : lib_plankton.rest_http.type_rest = _zeitbild.api.make();
|
||||||
process.stdout.write(
|
process.stdout.write(
|
||||||
|
|
@ -299,9 +393,8 @@ async function main(
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "sample":
|
case "fill": {
|
||||||
{
|
await data_init(
|
||||||
await _zeitbild.sample.init(
|
|
||||||
lib_plankton.json.decode(
|
lib_plankton.json.decode(
|
||||||
await lib_plankton.file.read(args.data_path)
|
await lib_plankton.file.read(args.data_path)
|
||||||
)
|
)
|
||||||
|
|
@ -309,23 +402,16 @@ async function main(
|
||||||
process.stdout.write("-- done\n");
|
process.stdout.write("-- done\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "serve":
|
case "serve": {
|
||||||
{
|
|
||||||
// prepare database
|
// prepare database
|
||||||
await _zeitbild.database.check();
|
await _zeitbild.database.check();
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo clear old sessions
|
|
||||||
*/
|
|
||||||
|
|
||||||
await lib_plankton.session.setup(
|
await lib_plankton.session.setup(
|
||||||
{
|
{
|
||||||
"data_chest": (
|
"data_chest": (
|
||||||
_zeitbild.conf.get().session_management.in_memory
|
_zeitbild.conf.get().session_management.in_memory
|
||||||
?
|
? lib_plankton.storage.memory.implementation_chest<lib_plankton.session.type_session>({})
|
||||||
lib_plankton.storage.memory.implementation_chest<lib_plankton.session.type_session>({})
|
: lib_plankton.call.convey(
|
||||||
:
|
|
||||||
lib_plankton.call.convey(
|
|
||||||
lib_plankton.storage.sql_table_common.chest(
|
lib_plankton.storage.sql_table_common.chest(
|
||||||
{
|
{
|
||||||
"database_implementation": _zeitbild.database.get_implementation(),
|
"database_implementation": _zeitbild.database.get_implementation(),
|
||||||
|
|
@ -347,7 +433,6 @@ async function main(
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
"default_lifetime": _zeitbild.conf.get().session_management.lifetime,
|
"default_lifetime": _zeitbild.conf.get().session_management.lifetime,
|
||||||
"default_prolongation": _zeitbild.conf.get().session_management.prolongation,
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.repository.auth_internal
|
namespace _zeitbild.repository.auth_internal
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,85 +1,23 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.repository.calendar
|
namespace _zeitbild.repository.calendar
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_core_row = {
|
|
||||||
name : string;
|
|
||||||
hue : int;
|
|
||||||
access_public : boolean;
|
|
||||||
access_level_default : int;
|
|
||||||
resource_id : int;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_access_attributed_group_row = {
|
|
||||||
// calendar_id : int;
|
|
||||||
group_id : int;
|
|
||||||
level : int;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_access_attributed_group_preview = {
|
|
||||||
group_id : int;
|
|
||||||
level : int;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_access_attributed_user_row = {
|
|
||||||
// calendar_id : int;
|
|
||||||
user_id : int;
|
|
||||||
level : int;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_access_attributed_user_preview = {
|
|
||||||
user_id : int;
|
|
||||||
level : int;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
type type_dispersal = {
|
type type_dispersal = {
|
||||||
core_row : type_core_row;
|
core_row : Record<
|
||||||
access_attributed_group_rows : Array<type_access_attributed_group_row>;
|
string,
|
||||||
access_attributed_user_rows : Array<type_access_attributed_user_row>;
|
any
|
||||||
|
>;
|
||||||
|
access_attributed_rows : Array<
|
||||||
|
Record<
|
||||||
|
string,
|
||||||
|
any
|
||||||
|
>
|
||||||
|
>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
const hue_scaling : int = 0xFFFF;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
var _core_store : (
|
var _core_store : (
|
||||||
|
|
@ -97,22 +35,7 @@ namespace _zeitbild.repository.calendar
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
var _access_attributed_group_chest : (
|
var _access_attributed_chest : (
|
||||||
null
|
|
||||||
|
|
|
||||||
lib_plankton.storage.type_chest<
|
|
||||||
Array<any>,
|
|
||||||
Record<string, any>,
|
|
||||||
lib_plankton.database.type_description_create_table,
|
|
||||||
lib_plankton.storage.sql_table_common.type_sql_table_common_search_term,
|
|
||||||
Record<string, any>
|
|
||||||
>
|
|
||||||
) = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
var _access_attributed_user_chest : (
|
|
||||||
null
|
null
|
||||||
|
|
|
|
||||||
lib_plankton.storage.type_chest<
|
lib_plankton.storage.type_chest<
|
||||||
|
|
@ -128,8 +51,7 @@ namespace _zeitbild.repository.calendar
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function get_core_store(
|
function get_core_store(
|
||||||
)
|
) : lib_plankton.storage.type_store<
|
||||||
: lib_plankton.storage.type_store<
|
|
||||||
_zeitbild.type_calendar_id,
|
_zeitbild.type_calendar_id,
|
||||||
Record<string, any>,
|
Record<string, any>,
|
||||||
{},
|
{},
|
||||||
|
|
@ -137,8 +59,7 @@ namespace _zeitbild.repository.calendar
|
||||||
Record<string, any>
|
Record<string, any>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
if (_core_store === null)
|
if (_core_store === null) {
|
||||||
{
|
|
||||||
_core_store = lib_plankton.storage.sql_table_autokey_store(
|
_core_store = lib_plankton.storage.sql_table_autokey_store(
|
||||||
{
|
{
|
||||||
"database_implementation": _zeitbild.database.get_implementation(),
|
"database_implementation": _zeitbild.database.get_implementation(),
|
||||||
|
|
@ -147,8 +68,7 @@ namespace _zeitbild.repository.calendar
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
return _core_store;
|
return _core_store;
|
||||||
|
|
@ -157,7 +77,7 @@ namespace _zeitbild.repository.calendar
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function get_access_attributed_group_chest(
|
function get_access_attributed_chest(
|
||||||
) : lib_plankton.storage.type_chest<
|
) : lib_plankton.storage.type_chest<
|
||||||
Array<any>,
|
Array<any>,
|
||||||
Record<string, any>,
|
Record<string, any>,
|
||||||
|
|
@ -166,51 +86,19 @@ namespace _zeitbild.repository.calendar
|
||||||
Record<string, any>
|
Record<string, any>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
if (_access_attributed_group_chest === null)
|
if (_access_attributed_chest === null) {
|
||||||
{
|
_access_attributed_chest = lib_plankton.storage.sql_table_common.chest(
|
||||||
_access_attributed_group_chest = lib_plankton.storage.sql_table_common.chest(
|
|
||||||
{
|
{
|
||||||
"database_implementation": _zeitbild.database.get_implementation(),
|
"database_implementation": _zeitbild.database.get_implementation(),
|
||||||
"table_name": "calendar_access_attributed_group",
|
"table_name": "calendar_access_attributed",
|
||||||
"key_names": ["calendar_id","group_id"],
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
return _access_attributed_group_chest;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function get_access_attributed_user_chest(
|
|
||||||
)
|
|
||||||
: lib_plankton.storage.type_chest<
|
|
||||||
Array<any>,
|
|
||||||
Record<string, any>,
|
|
||||||
lib_plankton.database.type_description_create_table,
|
|
||||||
lib_plankton.storage.sql_table_common.type_sql_table_common_search_term,
|
|
||||||
Record<string, any>
|
|
||||||
>
|
|
||||||
{
|
|
||||||
if (_access_attributed_user_chest === null)
|
|
||||||
{
|
|
||||||
_access_attributed_user_chest = lib_plankton.storage.sql_table_common.chest(
|
|
||||||
{
|
|
||||||
"database_implementation": _zeitbild.database.get_implementation(),
|
|
||||||
"table_name": "calendar_access_attributed_user",
|
|
||||||
"key_names": ["calendar_id","user_id"],
|
"key_names": ["calendar_id","user_id"],
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
return _access_attributed_user_chest;
|
return _access_attributed_chest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -252,29 +140,17 @@ namespace _zeitbild.repository.calendar
|
||||||
*/
|
*/
|
||||||
function encode(
|
function encode(
|
||||||
object : _zeitbild.type_calendar_object
|
object : _zeitbild.type_calendar_object
|
||||||
)
|
) : type_dispersal
|
||||||
: type_dispersal
|
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"core_row": {
|
"core_row": {
|
||||||
"name": object.name,
|
"name": object.name,
|
||||||
"hue": Math.floor(object.hue * hue_scaling),
|
|
||||||
"access_public": object.access.public,
|
"access_public": object.access.public,
|
||||||
"access_level_default": encode_access_level(object.access.default_level),
|
"access_level_default": encode_access_level(object.access.default_level),
|
||||||
"resource_id": object.resource_id,
|
"resource_id": object.resource_id,
|
||||||
},
|
},
|
||||||
"access_attributed_group_rows": (
|
"access_attributed_rows": (
|
||||||
lib_plankton.map.dump(object.access.attributed_group)
|
lib_plankton.map.dump(object.access.attributed)
|
||||||
.map(
|
|
||||||
({"key": group_id, "value": level}) => ({
|
|
||||||
// "calendar_id": calendar_id,
|
|
||||||
"group_id": group_id,
|
|
||||||
"level": encode_access_level(level),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
),
|
|
||||||
"access_attributed_user_rows": (
|
|
||||||
lib_plankton.map.dump(object.access.attributed_user)
|
|
||||||
.map(
|
.map(
|
||||||
({"key": user_id, "value": level}) => ({
|
({"key": user_id, "value": level}) => ({
|
||||||
// "calendar_id": calendar_id,
|
// "calendar_id": calendar_id,
|
||||||
|
|
@ -291,47 +167,24 @@ namespace _zeitbild.repository.calendar
|
||||||
*/
|
*/
|
||||||
function decode(
|
function decode(
|
||||||
dispersal : type_dispersal
|
dispersal : type_dispersal
|
||||||
)
|
) : _zeitbild.type_calendar_object
|
||||||
: _zeitbild.type_calendar_object
|
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"name": dispersal.core_row.name,
|
"name": dispersal.core_row["name"],
|
||||||
"hue": (dispersal.core_row.hue / hue_scaling),
|
|
||||||
"access": {
|
"access": {
|
||||||
"public": dispersal.core_row.access_public,
|
"public": dispersal.core_row["access_public"],
|
||||||
"default_level": decode_access_level(dispersal.core_row.access_level_default),
|
"default_level": decode_access_level(dispersal.core_row["access_level_default"]),
|
||||||
"attributed_group": lib_plankton.map.hashmap.implementation_map(
|
"attributed": lib_plankton.map.hashmap.implementation_map(
|
||||||
lib_plankton.map.hashmap.make<_zeitbild.type_group_id, _zeitbild.enum_access_level>(
|
|
||||||
x => x.toFixed(0),
|
|
||||||
{
|
|
||||||
"pairs": (
|
|
||||||
dispersal.access_attributed_group_rows
|
|
||||||
.map(
|
|
||||||
(access_attributed_group_row) => ({
|
|
||||||
// "calendar_id": access_attributed_group_row["calendar_id"],
|
|
||||||
// "key": access_attributed_group_row["preview"]["user_id"],
|
|
||||||
"key": access_attributed_group_row.group_id,
|
|
||||||
// "value": decode_access_level(access_attributed_group_row["preview"]["level"]),
|
|
||||||
"value": decode_access_level(access_attributed_group_row.level),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
),
|
|
||||||
"attributed_user": lib_plankton.map.hashmap.implementation_map(
|
|
||||||
lib_plankton.map.hashmap.make<_zeitbild.type_user_id, _zeitbild.enum_access_level>(
|
lib_plankton.map.hashmap.make<_zeitbild.type_user_id, _zeitbild.enum_access_level>(
|
||||||
x => x.toFixed(0),
|
x => x.toFixed(0),
|
||||||
{
|
{
|
||||||
"pairs": (
|
"pairs": (
|
||||||
dispersal.access_attributed_user_rows
|
dispersal.access_attributed_rows
|
||||||
.map(
|
.map(
|
||||||
(access_attributed_user_row) => ({
|
(access_attributed_row) => ({
|
||||||
// "calendar_id": access_attributed_user_row["calendar_id"],
|
// "calendar_id": access_attributed_row["calendar_id"],
|
||||||
// "key": access_attributed_user_row["preview"]["user_id"],
|
"key": access_attributed_row["preview"]["user_id"],
|
||||||
"key": access_attributed_user_row.user_id,
|
"value": decode_access_level(access_attributed_row["preview"]["level"]),
|
||||||
// "value": decode_access_level(access_attributed_user_row["preview"]["level"]),
|
|
||||||
"value": decode_access_level(access_attributed_user_row.level),
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
@ -339,21 +192,22 @@ namespace _zeitbild.repository.calendar
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
"resource_id": dispersal.core_row.resource_id,
|
"resource_id": dispersal.core_row["resource_id"],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export async function read(
|
export function read(
|
||||||
id : _zeitbild.type_calendar_id
|
id : _zeitbild.type_calendar_id
|
||||||
)
|
) : Promise<_zeitbild.type_calendar_object>
|
||||||
: Promise<_zeitbild.type_calendar_object>
|
|
||||||
{
|
{
|
||||||
const core_row : type_core_row = ((await get_core_store().read(id)) as type_core_row);
|
return (
|
||||||
const access_attributed_group_rows : Array<type_access_attributed_group_row> = await (
|
get_core_store().read(id)
|
||||||
get_access_attributed_group_chest().search(
|
.then(
|
||||||
|
(core_row) => (
|
||||||
|
get_access_attributed_chest().search(
|
||||||
{
|
{
|
||||||
"expression": "(calendar_id = $calendar_id)",
|
"expression": "(calendar_id = $calendar_id)",
|
||||||
"arguments": {
|
"arguments": {
|
||||||
|
|
@ -362,51 +216,21 @@ namespace _zeitbild.repository.calendar
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
(hits) => Promise.resolve<Array<type_access_attributed_group_row>>(
|
(access_attributed_rows) => Promise.resolve<type_dispersal>(
|
||||||
hits
|
|
||||||
.map(
|
|
||||||
hit => (
|
|
||||||
{
|
{
|
||||||
// "calendar_id": null,
|
|
||||||
"group_id": hit.preview.group_id,
|
|
||||||
"level": hit.preview.level,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const access_attributed_user_rows : Array<type_access_attributed_user_row> = await (
|
|
||||||
get_access_attributed_user_chest().search(
|
|
||||||
{
|
|
||||||
"expression": "(calendar_id = $calendar_id)",
|
|
||||||
"arguments": {
|
|
||||||
"calendar_id": id,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.then(
|
|
||||||
(hits) => Promise.resolve<Array<type_access_attributed_user_row>>(
|
|
||||||
hits
|
|
||||||
.map(
|
|
||||||
hit => (
|
|
||||||
{
|
|
||||||
// "calendar_id": null,
|
|
||||||
"user_id": hit.preview.user_id,
|
|
||||||
"level": hit.preview.level,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const dispersal : type_dispersal = {
|
|
||||||
"core_row": core_row,
|
"core_row": core_row,
|
||||||
"access_attributed_group_rows": access_attributed_group_rows,
|
"access_attributed_rows": access_attributed_rows,
|
||||||
"access_attributed_user_rows": access_attributed_user_rows,
|
}
|
||||||
};
|
)
|
||||||
const calendar_object : _zeitbild.type_calendar_object = decode(dispersal);
|
)
|
||||||
return calendar_object;
|
.then(
|
||||||
|
(dispersal) => Promise.resolve<_zeitbild.type_calendar_object>(
|
||||||
|
decode(dispersal)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -421,18 +245,10 @@ namespace _zeitbild.repository.calendar
|
||||||
const calendar_id : _zeitbild.type_calendar_id = await core_store.create(
|
const calendar_id : _zeitbild.type_calendar_id = await core_store.create(
|
||||||
dispersal.core_row
|
dispersal.core_row
|
||||||
);
|
);
|
||||||
for await (const access_attributed_group_row of dispersal.access_attributed_group_rows)
|
for await (const access_attributed_row of dispersal.access_attributed_rows) {
|
||||||
{
|
get_access_attributed_chest().write(
|
||||||
get_access_attributed_group_chest().write(
|
[calendar_id, access_attributed_row["user_id"]],
|
||||||
[calendar_id, access_attributed_group_row.group_id],
|
{"level": access_attributed_row["level"]}
|
||||||
{"level": access_attributed_group_row.level}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
for await (const access_attributed_user_row of dispersal.access_attributed_user_rows)
|
|
||||||
{
|
|
||||||
get_access_attributed_user_chest().write(
|
|
||||||
[calendar_id, access_attributed_user_row.user_id],
|
|
||||||
{"level": access_attributed_user_row.level}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await lib_plankton.cache.clear(_zeitbild.cache_regular);
|
await lib_plankton.cache.clear(_zeitbild.cache_regular);
|
||||||
|
|
@ -456,117 +272,44 @@ namespace _zeitbild.repository.calendar
|
||||||
dispersal.core_row
|
dispersal.core_row
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// attributed:group
|
// attributed access
|
||||||
{
|
{
|
||||||
const access_attributed_group_chest = get_access_attributed_group_chest();
|
const access_attributed_chest = get_access_attributed_chest();
|
||||||
const hits : Array<{key : Array<any>; preview : type_access_attributed_group_row;}> = (
|
const hits : Array<Record<string, any>> = await access_attributed_chest.search(
|
||||||
(await access_attributed_group_chest.search(
|
|
||||||
{
|
{
|
||||||
"expression": "(calendar_id = $calendar_id)",
|
"expression": "(calendar_id = $calendar_id)",
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"calendar_id": calendar_id,
|
"calendar_id": calendar_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
))
|
|
||||||
.map(
|
|
||||||
hit => (
|
|
||||||
{
|
|
||||||
"key": hit.key,
|
|
||||||
"preview": {
|
|
||||||
"group_id": hit.preview["group_id"],
|
|
||||||
"level": hit.preview["level"],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
const contrast = lib_plankton.list.contrast<
|
const contrast = lib_plankton.list.contrast<
|
||||||
{key : Array<any>; preview : type_access_attributed_group_row;},
|
Record<string, any>,
|
||||||
type_access_attributed_group_row
|
Record<string, any>
|
||||||
>(
|
>(
|
||||||
hits,
|
hits,
|
||||||
hit => hit.preview.group_id.toFixed(0),
|
hit => hit["user_id"],
|
||||||
dispersal.access_attributed_group_rows,
|
dispersal.access_attributed_rows,
|
||||||
row => row.group_id.toFixed(0)
|
row => row["user_id"]
|
||||||
);
|
);
|
||||||
// delete
|
// delete
|
||||||
for await (const entry of contrast.only_left)
|
for await (const entry of contrast.only_left) {
|
||||||
{
|
await access_attributed_chest.delete(
|
||||||
await access_attributed_group_chest.delete(
|
[calendar_id, entry.left["user_id"]]
|
||||||
[calendar_id, entry.left.preview.group_id]
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// update
|
// update
|
||||||
for await (const entry of contrast.both)
|
for await (const entry of contrast.both) {
|
||||||
{
|
await access_attributed_chest.write(
|
||||||
await access_attributed_group_chest.write(
|
[calendar_id, entry.right["user_id"]],
|
||||||
[calendar_id, entry.right.group_id],
|
{"level": entry.right["level"]}
|
||||||
{"level": entry.right.level}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// create
|
// create
|
||||||
for await (const entry of contrast.only_right)
|
for await (const entry of contrast.only_right) {
|
||||||
{
|
await access_attributed_chest.write(
|
||||||
await access_attributed_group_chest.write(
|
[calendar_id, entry.right["user_id"]],
|
||||||
[calendar_id, entry.right.group_id],
|
{"level": entry.right["level"]}
|
||||||
{"level": entry.right.level}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// attributed:user
|
|
||||||
{
|
|
||||||
const access_attributed_user_chest = get_access_attributed_user_chest();
|
|
||||||
const hits : Array<{key : Array<any>; preview : type_access_attributed_user_row;}> = (
|
|
||||||
(await access_attributed_user_chest.search(
|
|
||||||
{
|
|
||||||
"expression": "(calendar_id = $calendar_id)",
|
|
||||||
"arguments": {
|
|
||||||
"calendar_id": calendar_id,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
))
|
|
||||||
.map(
|
|
||||||
hit => (
|
|
||||||
{
|
|
||||||
"key": hit.key,
|
|
||||||
"preview": {
|
|
||||||
"user_id": hit.preview["user_id"],
|
|
||||||
"level": hit.preview["level"],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const contrast = lib_plankton.list.contrast<
|
|
||||||
{key : Array<any>; preview : type_access_attributed_user_row;},
|
|
||||||
type_access_attributed_user_row
|
|
||||||
>(
|
|
||||||
hits,
|
|
||||||
hit => hit.preview.user_id.toFixed(0),
|
|
||||||
dispersal.access_attributed_user_rows,
|
|
||||||
row => row.user_id.toFixed(0)
|
|
||||||
);
|
|
||||||
// delete
|
|
||||||
for await (const entry of contrast.only_left)
|
|
||||||
{
|
|
||||||
await access_attributed_user_chest.delete(
|
|
||||||
[calendar_id, entry.left.preview.user_id]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// update
|
|
||||||
for await (const entry of contrast.both)
|
|
||||||
{
|
|
||||||
await access_attributed_user_chest.write(
|
|
||||||
[calendar_id, entry.right.user_id],
|
|
||||||
{"level": entry.right.level}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// create
|
|
||||||
for await (const entry of contrast.only_right)
|
|
||||||
{
|
|
||||||
await access_attributed_user_chest.write(
|
|
||||||
[calendar_id, entry.right.user_id],
|
|
||||||
{"level": entry.right.level}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -577,25 +320,17 @@ namespace _zeitbild.repository.calendar
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo remove events from resource?
|
* @todo remove events from resource?
|
||||||
* @todo remove resource
|
|
||||||
*/
|
*/
|
||||||
export async function delete_(
|
export async function delete_(
|
||||||
calendar_id : _zeitbild.type_calendar_id
|
calendar_id : _zeitbild.type_calendar_id
|
||||||
)
|
) : Promise<void>
|
||||||
: Promise<void>
|
|
||||||
{
|
{
|
||||||
await lib_plankton.cache.clear(_zeitbild.cache_regular);
|
await lib_plankton.cache.clear(_zeitbild.cache_regular);
|
||||||
const core_store = get_core_store();
|
const core_store = get_core_store();
|
||||||
const access_attributed_user_chest = get_access_attributed_user_chest();
|
const access_attributed_chest = get_access_attributed_chest();
|
||||||
// attributed:user
|
// attributed access
|
||||||
{
|
{
|
||||||
const chest = get_access_attributed_user_chest();
|
const hits : Array<Record<string, any>> = await access_attributed_chest.search(
|
||||||
const hits : Array<
|
|
||||||
{
|
|
||||||
key : Array<any>;
|
|
||||||
preview : Record<string, any>;
|
|
||||||
}
|
|
||||||
> = await chest.search(
|
|
||||||
{
|
{
|
||||||
"expression": "(calendar_id = $calendar_id)",
|
"expression": "(calendar_id = $calendar_id)",
|
||||||
"arguments": {
|
"arguments": {
|
||||||
|
|
@ -603,30 +338,10 @@ namespace _zeitbild.repository.calendar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
for (const hit of hits)
|
for await (const hit of hits) {
|
||||||
{
|
await access_attributed_chest.delete(
|
||||||
await chest.delete(hit.key);
|
[calendar_id, hit["user_id"]]
|
||||||
}
|
|
||||||
}
|
|
||||||
// attributed:group
|
|
||||||
{
|
|
||||||
const chest = get_access_attributed_group_chest();
|
|
||||||
const hits : Array<
|
|
||||||
{
|
|
||||||
key : Array<any>;
|
|
||||||
preview : Record<string, any>;
|
|
||||||
}
|
|
||||||
> = await chest.search(
|
|
||||||
{
|
|
||||||
"expression": "(calendar_id = $calendar_id)",
|
|
||||||
"arguments": {
|
|
||||||
"calendar_id": calendar_id,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
for (const hit of hits)
|
|
||||||
{
|
|
||||||
await chest.delete(hit.key);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// core
|
// core
|
||||||
|
|
@ -644,151 +359,74 @@ namespace _zeitbild.repository.calendar
|
||||||
type type_overview_entry = {
|
type type_overview_entry = {
|
||||||
id : _zeitbild.type_calendar_id;
|
id : _zeitbild.type_calendar_id;
|
||||||
name : string;
|
name : string;
|
||||||
hue : float;
|
|
||||||
access_level : _zeitbild.enum_access_level;
|
access_level : _zeitbild.enum_access_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @todo caching
|
||||||
*/
|
*/
|
||||||
export async function overview(
|
export async function overview(
|
||||||
user_id : (null | _zeitbild.type_user_id)
|
user_id : (null | _zeitbild.type_user_id)
|
||||||
)
|
) : Promise<
|
||||||
: Promise<
|
|
||||||
Array<
|
Array<
|
||||||
type_overview_entry
|
type_overview_entry
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
type type_data = {
|
|
||||||
hits_core : Array<
|
|
||||||
{
|
|
||||||
key : int;
|
|
||||||
preview : Record<string, any>;
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
hits_access_attributed_group : Array<
|
|
||||||
{
|
|
||||||
key : int;
|
|
||||||
preview : Record<string, any>;
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
hits_access_attributed_user : Array<
|
|
||||||
{
|
|
||||||
key : int;
|
|
||||||
preview : Record<string, any>;
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
};
|
|
||||||
return lib_plankton.cache.get_complex<any, Array<type_overview_entry>>(
|
return lib_plankton.cache.get_complex<any, Array<type_overview_entry>>(
|
||||||
_zeitbild.cache_regular,
|
_zeitbild.cache_regular,
|
||||||
"calendar_overview",
|
"calendar_overview",
|
||||||
{
|
{
|
||||||
"user_id": user_id,
|
"user_id": user_id,
|
||||||
},
|
},
|
||||||
60,
|
null,
|
||||||
async () => lib_plankton.call.convey(
|
() => (
|
||||||
|
lib_plankton.file.read("sql/calendar_overview.sql")
|
||||||
|
.then(
|
||||||
|
(template) => _zeitbild.database.get_implementation().query_free_get(
|
||||||
{
|
{
|
||||||
"hits_core": await get_core_store().search(
|
"template": template,
|
||||||
{
|
"arguments": {
|
||||||
"expression": "TRUE",
|
"user_id": user_id,
|
||||||
"arguments": {}
|
|
||||||
}
|
}
|
||||||
),
|
|
||||||
"hits_access_attributed_group": await get_access_attributed_group_chest().search(
|
|
||||||
(user_id === null)
|
|
||||||
?
|
|
||||||
{
|
|
||||||
"expression": "TRUE",
|
|
||||||
"arguments": {}
|
|
||||||
}
|
}
|
||||||
:
|
)
|
||||||
{
|
)
|
||||||
"expression": "(group_id IN (SELECT group_id FROM user_groups WHERE (user_id = $user_id)))",
|
.then(
|
||||||
"arguments": {"user_id": user_id}
|
(rows) => Promise.resolve(
|
||||||
}
|
lib_plankton.call.convey(
|
||||||
),
|
rows,
|
||||||
"hits_access_attributed_user": await get_access_attributed_user_chest().search(
|
|
||||||
(user_id === null)
|
|
||||||
?
|
|
||||||
{
|
|
||||||
"expression": "TRUE",
|
|
||||||
"arguments": {}
|
|
||||||
}
|
|
||||||
:
|
|
||||||
{
|
|
||||||
"expression": "(user_id = $user_id)",
|
|
||||||
"arguments": {"user_id": user_id}
|
|
||||||
}
|
|
||||||
),
|
|
||||||
},
|
|
||||||
[
|
[
|
||||||
// transform
|
(x : Array<Record<string, any>>) => x.map(
|
||||||
(data : type_data) => data.hits_core.map(
|
(row : Record<string, any>) => ({
|
||||||
(hit_core) => {
|
"id": row["id"],
|
||||||
const calendar_id : _zeitbild.type_calendar_id = hit_core.key;
|
"name": row["name"],
|
||||||
return {
|
/**
|
||||||
"id": calendar_id,
|
* @todo unite with _zeitbild.service.calendar.get_access_level
|
||||||
"name": hit_core.preview["name"],
|
*/
|
||||||
"hue": (hit_core.preview["hue"] / hue_scaling),
|
"access_level": decode_access_level(
|
||||||
"access_level": _zeitbild.access_level_determine_raw(
|
Math.max(
|
||||||
hit_core.preview["access_public"],
|
(row["access_public"] ? 1 : 0),
|
||||||
(
|
(
|
||||||
(user_id === null)
|
(user_id === null)
|
||||||
?
|
?
|
||||||
null
|
0
|
||||||
:
|
:
|
||||||
{
|
(row["access_level_attributed"] ?? row["access_level_default"])
|
||||||
"default": decode_access_level(hit_core.preview["access_level_default"]),
|
)
|
||||||
"group": lib_plankton.call.convey(
|
|
||||||
data.hits_access_attributed_group,
|
|
||||||
[
|
|
||||||
(x : Array<{key : int; preview : Record<string, any>}>) => x.filter(
|
|
||||||
hit_access_attributed_group => (
|
|
||||||
(hit_access_attributed_group.preview.calendar_id === calendar_id)
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
(x : Array<{key : int; preview : Record<string, any>}>) => x.map(
|
})
|
||||||
hit_access_attributed_group => hit_access_attributed_group.preview.level
|
|
||||||
),
|
),
|
||||||
(x : Array<int>) => x.map(
|
|
||||||
decode_access_level
|
|
||||||
),
|
|
||||||
]
|
|
||||||
),
|
|
||||||
"user": lib_plankton.call.convey(
|
|
||||||
data.hits_access_attributed_user,
|
|
||||||
[
|
|
||||||
(x : Array<{key : int; preview : Record<string, any>}>) => x.filter(
|
|
||||||
hits_access_attributed_user => (
|
|
||||||
(hits_access_attributed_user.preview.calendar_id === calendar_id)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
(x : Array<{key : int; preview : Record<string, any>}>) => x.map(
|
|
||||||
hits_access_attributed_user => hits_access_attributed_user.preview.level
|
|
||||||
),
|
|
||||||
(x : Array<int>) => x.map(
|
|
||||||
decode_access_level
|
|
||||||
),
|
|
||||||
(x : Array<_zeitbild.enum_access_level>) => (x[0] ?? null),
|
|
||||||
]
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
),
|
|
||||||
// only keep visible calendars
|
|
||||||
(x : Array<type_overview_entry>) => x.filter(
|
(x : Array<type_overview_entry>) => x.filter(
|
||||||
(row) => (
|
(row) => (
|
||||||
! _zeitbild.access_level_order(
|
! _zeitbild.value_object.access_level.order(
|
||||||
row.access_level,
|
row.access_level,
|
||||||
_zeitbild.enum_access_level.none
|
_zeitbild.enum_access_level.none
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
// sort by access level and name
|
|
||||||
(x : Array<type_overview_entry>) => lib_plankton.list.sorted<type_overview_entry>(
|
(x : Array<type_overview_entry>) => lib_plankton.list.sorted<type_overview_entry>(
|
||||||
x,
|
x,
|
||||||
{
|
{
|
||||||
|
|
@ -796,7 +434,7 @@ namespace _zeitbild.repository.calendar
|
||||||
row => row.access_level,
|
row => row.access_level,
|
||||||
row => row.id,
|
row => row.id,
|
||||||
{
|
{
|
||||||
"order_first": (a, b) => _zeitbild.access_level_order(b, a),
|
"order_first": (a, b) => _zeitbild.value_object.access_level.order(b, a),
|
||||||
"order_second": (a, b) => (a <= b)
|
"order_second": (a, b) => (a <= b)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
@ -804,8 +442,10 @@ namespace _zeitbild.repository.calendar
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,207 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.repository.group
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_row = {
|
|
||||||
name : string;
|
|
||||||
label : string;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_preview = {
|
|
||||||
name : string;
|
|
||||||
label : string;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
var _store : (
|
|
||||||
null
|
|
||||||
|
|
|
||||||
lib_plankton.storage.type_store<
|
|
||||||
_zeitbild.type_user_id,
|
|
||||||
/*type_row*/Record<string, any>,
|
|
||||||
{},
|
|
||||||
lib_plankton.storage.type_sql_table_autokey_search_term,
|
|
||||||
/*type_preview*/Record<string, any>
|
|
||||||
>
|
|
||||||
) = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function get_store(
|
|
||||||
)
|
|
||||||
: lib_plankton.storage.type_store<
|
|
||||||
_zeitbild.type_user_id,
|
|
||||||
/*type_row*/Record<string, any>,
|
|
||||||
{},
|
|
||||||
lib_plankton.storage.type_sql_table_autokey_search_term,
|
|
||||||
/*type_preview*/Record<string, any>
|
|
||||||
>
|
|
||||||
{
|
|
||||||
if (_store === null)
|
|
||||||
{
|
|
||||||
_store = lib_plankton.storage.sql_table_autokey_store(
|
|
||||||
{
|
|
||||||
"database_implementation": _zeitbild.database.get_implementation(),
|
|
||||||
"table_name": "groups",
|
|
||||||
"key_name": "id",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
return _store;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function encode(
|
|
||||||
group_object : _zeitbild.type_group_object
|
|
||||||
)
|
|
||||||
: type_row
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"name": group_object.name,
|
|
||||||
"label": group_object.label,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function decode(
|
|
||||||
row : type_row
|
|
||||||
)
|
|
||||||
: _zeitbild.type_group_object
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"name": row.name,
|
|
||||||
"label": row.label,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export async function list(
|
|
||||||
)
|
|
||||||
: Promise<
|
|
||||||
Array<
|
|
||||||
{
|
|
||||||
id : _zeitbild.type_group_id;
|
|
||||||
object : _zeitbild.type_group_object;
|
|
||||||
}
|
|
||||||
>
|
|
||||||
>
|
|
||||||
{
|
|
||||||
const hits : Array<{key : int; preview : /*type_preview*/Record<string, any>;}> = await get_store().search({"expression": "TRUE", "arguments": {}});
|
|
||||||
return Promise.resolve(
|
|
||||||
hits
|
|
||||||
.map(
|
|
||||||
(hit) => ({
|
|
||||||
"id": hit.key,
|
|
||||||
"object": {
|
|
||||||
"name": hit.preview.name,
|
|
||||||
"label": hit.preview.label,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export async function read(
|
|
||||||
group_id : _zeitbild.type_group_id
|
|
||||||
)
|
|
||||||
: Promise<_zeitbild.type_group_object>
|
|
||||||
{
|
|
||||||
const row : type_row = ((await get_store().read(group_id)) as type_row);
|
|
||||||
const group_object : _zeitbild.type_group_object = decode(row);
|
|
||||||
return Promise.resolve<_zeitbild.type_group_object>(group_object);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export async function create(
|
|
||||||
group_object : _zeitbild.type_group_object
|
|
||||||
)
|
|
||||||
: Promise<_zeitbild.type_group_id>
|
|
||||||
{
|
|
||||||
const row : type_row = encode(group_object);
|
|
||||||
const group_id : _zeitbild.type_group_id = await get_store().create(row);
|
|
||||||
return Promise.resolve<_zeitbild.type_group_id>(group_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export async function update(
|
|
||||||
group_id : _zeitbild.type_group_id,
|
|
||||||
group_object : _zeitbild.type_group_object
|
|
||||||
)
|
|
||||||
: Promise<void>
|
|
||||||
{
|
|
||||||
const row : type_row = encode(group_object);
|
|
||||||
await get_store().update(group_id, row);
|
|
||||||
return Promise.resolve<void>(undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export async function identify(
|
|
||||||
name : string
|
|
||||||
)
|
|
||||||
: Promise<_zeitbild.type_group_id>
|
|
||||||
{
|
|
||||||
const hits : Array<{key : _zeitbild.type_group_id; preview : /*type_preview*/Record<string, any>;}> = await get_store().search(
|
|
||||||
{
|
|
||||||
"expression": "(name = $name)",
|
|
||||||
"arguments": {
|
|
||||||
"name": name,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (hits.length <= 0)
|
|
||||||
{
|
|
||||||
return Promise.reject<_zeitbild.type_group_id>(new Error("not found"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Promise.resolve<_zeitbild.type_group_id>(hits[0].key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +1,7 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.repository.resource
|
namespace _zeitbild.repository.resource
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_row = {
|
|
||||||
kind : string;
|
|
||||||
sub_id : int;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_preview = {
|
|
||||||
kind : string;
|
|
||||||
sub_id : int;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
type type_local_resource_event_stuff = {
|
type type_local_resource_event_stuff = {
|
||||||
|
|
@ -97,10 +62,10 @@ namespace _zeitbild.repository.resource
|
||||||
|
|
|
|
||||||
lib_plankton.storage.type_store<
|
lib_plankton.storage.type_store<
|
||||||
_zeitbild.type_resource_id,
|
_zeitbild.type_resource_id,
|
||||||
/*type_row*/Record<string, any>,
|
Record<string, any>,
|
||||||
{},
|
{},
|
||||||
lib_plankton.storage.type_sql_table_autokey_search_term,
|
lib_plankton.storage.type_sql_table_autokey_search_term,
|
||||||
/*type_preview*/Record<string, any>
|
Record<string, any>
|
||||||
>
|
>
|
||||||
) = null;
|
) = null;
|
||||||
|
|
||||||
|
|
|
||||||
14
source/repositories/sql/calendar_overview.sql
Normal file
14
source/repositories/sql/calendar_overview.sql
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
-- Für gewöhnlich würde man hier gruppieren. Aufgrund des UNIQUE-constraints in "calendar_access_attributed" ist das
|
||||||
|
-- jedoch nicht nötig, da dadurch für jeden Eintrag in "calendar" mit gegebener "user_id" höchstens ein Eintrag in
|
||||||
|
-- "calendar_access_attributed" passt und da es ein LEFT OUTER JOIN ist, wird es _genau_ ein Eintrag sein
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
x.id AS id,
|
||||||
|
x.name AS name,
|
||||||
|
x.access_public AS access_public,
|
||||||
|
x.access_level_default AS access_level_default,
|
||||||
|
y.level AS access_level_attributed
|
||||||
|
FROM
|
||||||
|
calendars AS x
|
||||||
|
LEFT OUTER JOIN calendar_access_attributed AS y ON ((x.id = y.calendar_id) AND (y.user_id = $user_id))
|
||||||
|
;
|
||||||
|
|
@ -1,88 +1,15 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.repository.user
|
namespace _zeitbild.repository.user
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
type type_core_row = {
|
var _store : (
|
||||||
name : string;
|
|
||||||
email_address : (null | string);
|
|
||||||
dav_token : (null | string);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_group_row_slim = {
|
|
||||||
group_id : int;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_group_row_fat = {
|
|
||||||
user_id : int;
|
|
||||||
group_id : int;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_preview = {
|
|
||||||
name : string;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_dispersal = {
|
|
||||||
core : type_core_row;
|
|
||||||
groups : Array<type_group_row_slim>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
var _store_core : (
|
|
||||||
null
|
null
|
||||||
|
|
|
|
||||||
lib_plankton.storage.type_store<
|
lib_plankton.storage.type_store<
|
||||||
_zeitbild.type_user_id,
|
_zeitbild.type_user_id,
|
||||||
/*type_core_row*/Record<string, any>,
|
Record<string, any>,
|
||||||
{},
|
|
||||||
lib_plankton.storage.type_sql_table_autokey_search_term,
|
|
||||||
/*type_preview*/Record<string, any>
|
|
||||||
>
|
|
||||||
) = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
var _store_groups : (
|
|
||||||
null
|
|
||||||
|
|
|
||||||
lib_plankton.storage.type_store<
|
|
||||||
int,
|
|
||||||
/*type_group_row_fat*/Record<string, any>,
|
|
||||||
{},
|
{},
|
||||||
lib_plankton.storage.type_sql_table_autokey_search_term,
|
lib_plankton.storage.type_sql_table_autokey_search_term,
|
||||||
Record<string, any>
|
Record<string, any>
|
||||||
|
|
@ -92,19 +19,17 @@ namespace _zeitbild.repository.user
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function get_store_core(
|
function get_store(
|
||||||
)
|
) : lib_plankton.storage.type_store<
|
||||||
: lib_plankton.storage.type_store<
|
|
||||||
_zeitbild.type_user_id,
|
_zeitbild.type_user_id,
|
||||||
/*type_core_row*/Record<string, any>,
|
Record<string, any>,
|
||||||
{},
|
{},
|
||||||
lib_plankton.storage.type_sql_table_autokey_search_term,
|
lib_plankton.storage.type_sql_table_autokey_search_term,
|
||||||
/*type_preview*/Record<string, any>
|
Record<string, any>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
if (_store_core === null)
|
if (_store === null) {
|
||||||
{
|
_store = lib_plankton.storage.sql_table_autokey_store(
|
||||||
_store_core = lib_plankton.storage.sql_table_autokey_store(
|
|
||||||
{
|
{
|
||||||
"database_implementation": _zeitbild.database.get_implementation(),
|
"database_implementation": _zeitbild.database.get_implementation(),
|
||||||
"table_name": "users",
|
"table_name": "users",
|
||||||
|
|
@ -112,41 +37,10 @@ namespace _zeitbild.repository.user
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
return _store_core;
|
return _store;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function get_store_groups(
|
|
||||||
)
|
|
||||||
: lib_plankton.storage.type_store<
|
|
||||||
int,
|
|
||||||
/*type_group_row_fat*/Record<string, any>,
|
|
||||||
{},
|
|
||||||
lib_plankton.storage.type_sql_table_autokey_search_term,
|
|
||||||
Record<string, any>
|
|
||||||
>
|
|
||||||
{
|
|
||||||
if (_store_groups === null)
|
|
||||||
{
|
|
||||||
_store_groups = lib_plankton.storage.sql_table_autokey_store(
|
|
||||||
{
|
|
||||||
"database_implementation": _zeitbild.database.get_implementation(),
|
|
||||||
"table_name": "user_groups",
|
|
||||||
"key_name": "id",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
return _store_groups;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -154,24 +48,12 @@ namespace _zeitbild.repository.user
|
||||||
*/
|
*/
|
||||||
function encode(
|
function encode(
|
||||||
user_object : _zeitbild.type_user_object
|
user_object : _zeitbild.type_user_object
|
||||||
)
|
) : Record<string, any>
|
||||||
: type_dispersal
|
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"core": {
|
|
||||||
"name": user_object.name,
|
"name": user_object.name,
|
||||||
"email_address": user_object.email_address,
|
"email_address": user_object.email_address,
|
||||||
"dav_token": user_object.dav_token,
|
"dav_token": user_object.dav_token,
|
||||||
},
|
|
||||||
"groups": (
|
|
||||||
user_object.groups.map(
|
|
||||||
group_id => (
|
|
||||||
{
|
|
||||||
"group_id": group_id,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -179,19 +61,13 @@ namespace _zeitbild.repository.user
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function decode(
|
function decode(
|
||||||
dispersal : type_dispersal
|
row : Record<string, any>
|
||||||
)
|
) : _zeitbild.type_user_object
|
||||||
: _zeitbild.type_user_object
|
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"name": dispersal.core.name,
|
"name": row["name"],
|
||||||
"groups": (
|
"email_address": row["email_address"],
|
||||||
dispersal.groups.map(
|
"dav_token": row["dav_token"],
|
||||||
group_row => group_row.group_id,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
"email_address": dispersal.core.email_address,
|
|
||||||
"dav_token": dispersal.core.dav_token,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -199,8 +75,7 @@ namespace _zeitbild.repository.user
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export async function list(
|
export async function list(
|
||||||
)
|
) : Promise<
|
||||||
: Promise<
|
|
||||||
Array<
|
Array<
|
||||||
{
|
{
|
||||||
id : _zeitbild.type_user_id;
|
id : _zeitbild.type_user_id;
|
||||||
|
|
@ -209,12 +84,7 @@ namespace _zeitbild.repository.user
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
const hits : Array<{key : int; preview : /*type_preview*/Record<string, any>;}> = await get_store_core().search(
|
const hits : Array<{key : int; preview : Record<string, any>;}> = await get_store().search({"expression": "TRUE", "arguments": {}});
|
||||||
{
|
|
||||||
"expression": "TRUE",
|
|
||||||
"arguments": {}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return Promise.resolve(
|
return Promise.resolve(
|
||||||
hits
|
hits
|
||||||
.map(
|
.map(
|
||||||
|
|
@ -231,43 +101,10 @@ namespace _zeitbild.repository.user
|
||||||
*/
|
*/
|
||||||
export async function read(
|
export async function read(
|
||||||
user_id : _zeitbild.type_user_id
|
user_id : _zeitbild.type_user_id
|
||||||
)
|
) : Promise<_zeitbild.type_user_object>
|
||||||
: Promise<_zeitbild.type_user_object>
|
|
||||||
{
|
{
|
||||||
const core_row : type_core_row = ((await get_store_core().read(user_id)) as type_core_row);
|
const row : Record<string, any> = await get_store().read(user_id);
|
||||||
const group_rows : Array<type_group_row_fat> = (
|
const user_object : _zeitbild.type_user_object = decode(row);
|
||||||
(
|
|
||||||
await get_store_groups().search(
|
|
||||||
{
|
|
||||||
"expression": "(user_id = $user_id)",
|
|
||||||
"arguments": {
|
|
||||||
"user_id": user_id,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.map(
|
|
||||||
hit => (
|
|
||||||
{
|
|
||||||
"user_id": hit.preview.user_id,
|
|
||||||
"group_id": hit.preview.group_id,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const dispersal : type_dispersal = {
|
|
||||||
"core": core_row,
|
|
||||||
"groups": (
|
|
||||||
group_rows.map(
|
|
||||||
group_row_fat => (
|
|
||||||
{
|
|
||||||
"group_id": group_row_fat.group_id,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
};
|
|
||||||
const user_object : _zeitbild.type_user_object = decode(dispersal);
|
|
||||||
return Promise.resolve<_zeitbild.type_user_object>(user_object);
|
return Promise.resolve<_zeitbild.type_user_object>(user_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -276,25 +113,10 @@ namespace _zeitbild.repository.user
|
||||||
*/
|
*/
|
||||||
export async function create(
|
export async function create(
|
||||||
user_object : _zeitbild.type_user_object
|
user_object : _zeitbild.type_user_object
|
||||||
)
|
) : Promise<_zeitbild.type_user_id>
|
||||||
: Promise<_zeitbild.type_user_id>
|
|
||||||
{
|
{
|
||||||
const dispersal : type_dispersal = encode(user_object);
|
const row : Record<string, any> = encode(user_object);
|
||||||
// core
|
const user_id : _zeitbild.type_user_id = await get_store().create(row);
|
||||||
const user_id : _zeitbild.type_user_id = await (() => {
|
|
||||||
return get_store_core().create(dispersal.core);
|
|
||||||
}) ();
|
|
||||||
// groups
|
|
||||||
{
|
|
||||||
for (const group_row_slim of dispersal.groups)
|
|
||||||
{
|
|
||||||
const group_row_fat : type_group_row_fat = {
|
|
||||||
"user_id": user_id,
|
|
||||||
"group_id": group_row_slim.group_id,
|
|
||||||
};
|
|
||||||
await get_store_groups().create(group_row_fat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Promise.resolve<_zeitbild.type_user_id>(user_id);
|
return Promise.resolve<_zeitbild.type_user_id>(user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -304,60 +126,10 @@ namespace _zeitbild.repository.user
|
||||||
export async function update(
|
export async function update(
|
||||||
user_id : _zeitbild.type_user_id,
|
user_id : _zeitbild.type_user_id,
|
||||||
user_object : _zeitbild.type_user_object
|
user_object : _zeitbild.type_user_object
|
||||||
)
|
) : Promise<void>
|
||||||
: Promise<void>
|
|
||||||
{
|
{
|
||||||
const dispersal : type_dispersal = encode(user_object);
|
const dispersal : Record<string, any> = encode(user_object);
|
||||||
// core
|
await get_store().update(user_id, dispersal);
|
||||||
{
|
|
||||||
await get_store_core().update(user_id, dispersal.core);
|
|
||||||
}
|
|
||||||
// groups
|
|
||||||
{
|
|
||||||
const hits : Array<{key : int; preview : Record<string, any>;}> = await get_store_groups().search(
|
|
||||||
{
|
|
||||||
"expression": "(user_id = $user_id)",
|
|
||||||
"arguments": {
|
|
||||||
"user_id": user_id,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
const contrast = lib_plankton.list.contrast(
|
|
||||||
hits,
|
|
||||||
hit => hit.preview.group_id.toFixed(0),
|
|
||||||
dispersal.groups,
|
|
||||||
group_row_slim => group_row_slim.group_id.toFixed(0)
|
|
||||||
);
|
|
||||||
// delete
|
|
||||||
{
|
|
||||||
for (const entry of contrast.only_left)
|
|
||||||
{
|
|
||||||
await get_store_groups().delete(entry.left.key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// update
|
|
||||||
{
|
|
||||||
for (const entry of contrast.both)
|
|
||||||
{
|
|
||||||
const row_group_fat : type_group_row_fat = {
|
|
||||||
"user_id": user_id,
|
|
||||||
"group_id": entry.right.group_id,
|
|
||||||
};
|
|
||||||
await get_store_groups().update(entry.left.key, row_group_fat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// create
|
|
||||||
{
|
|
||||||
for (const entry of contrast.only_right)
|
|
||||||
{
|
|
||||||
const row_group_fat : type_group_row_fat = {
|
|
||||||
"user_id": user_id,
|
|
||||||
"group_id": entry.right.group_id,
|
|
||||||
};
|
|
||||||
await get_store_groups().create(row_group_fat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Promise.resolve<void>(undefined);
|
return Promise.resolve<void>(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -366,10 +138,9 @@ namespace _zeitbild.repository.user
|
||||||
*/
|
*/
|
||||||
export async function identify(
|
export async function identify(
|
||||||
name : string
|
name : string
|
||||||
)
|
) : Promise<_zeitbild.type_user_id>
|
||||||
: Promise<_zeitbild.type_user_id>
|
|
||||||
{
|
{
|
||||||
const hits : Array<{key : _zeitbild.type_user_id; preview : /*type_preview*/Record<string, any>;}> = await get_store_core().search(
|
const hits : Array<{key : _zeitbild.type_user_id; preview : any;}> = await get_store().search(
|
||||||
{
|
{
|
||||||
"expression": "(name = $name)",
|
"expression": "(name = $name)",
|
||||||
"arguments": {
|
"arguments": {
|
||||||
|
|
@ -377,12 +148,10 @@ namespace _zeitbild.repository.user
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (hits.length <= 0)
|
if (hits.length <= 0) {
|
||||||
{
|
|
||||||
return Promise.reject<_zeitbild.type_user_id>(new Error("not found"));
|
return Promise.reject<_zeitbild.type_user_id>(new Error("not found"));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return Promise.resolve<_zeitbild.type_user_id>(hits[0].key);
|
return Promise.resolve<_zeitbild.type_user_id>(hits[0].key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
403
source/sample.ts
403
source/sample.ts
|
|
@ -1,403 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.sample
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_date_absolute = {
|
|
||||||
year : int;
|
|
||||||
month : int;
|
|
||||||
day : int;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_date_relative = Array<
|
|
||||||
{
|
|
||||||
action : "trunc_week";
|
|
||||||
args : [int];
|
|
||||||
}
|
|
||||||
|
|
|
||||||
{
|
|
||||||
action : "shift_week";
|
|
||||||
args : [int];
|
|
||||||
}
|
|
||||||
|
|
|
||||||
{
|
|
||||||
action : "shift_day";
|
|
||||||
args : [int];
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_ywd = {
|
|
||||||
year : int;
|
|
||||||
week : int;
|
|
||||||
day : int;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_time = {
|
|
||||||
hour : int;
|
|
||||||
minute : int;
|
|
||||||
second : int;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_datetime = (
|
|
||||||
{
|
|
||||||
timezone_shift : int;
|
|
||||||
time : (null | type_time);
|
|
||||||
}
|
|
||||||
&
|
|
||||||
(
|
|
||||||
{
|
|
||||||
date_absolute : type_date_absolute;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
{
|
|
||||||
date_relative : type_date_relative;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
type type_data = {
|
|
||||||
groups : Array<
|
|
||||||
{
|
|
||||||
id : int;
|
|
||||||
name : string;
|
|
||||||
label ?: string;
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
users : Array<
|
|
||||||
{
|
|
||||||
id : int;
|
|
||||||
name : string;
|
|
||||||
groups ?: Array<int>;
|
|
||||||
email_address : string;
|
|
||||||
dav_token ?: (null | string);
|
|
||||||
password : string;
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
calendars : Array<
|
|
||||||
{
|
|
||||||
id : int;
|
|
||||||
name : string;
|
|
||||||
access : {
|
|
||||||
public ?: boolean;
|
|
||||||
default_level : ("none" | "view" | "edit" | "admin");
|
|
||||||
attributed_group ?: Array<
|
|
||||||
{
|
|
||||||
group_id : int;
|
|
||||||
level : ("none" | "view" | "edit" | "admin");
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
attributed_user ?: Array<
|
|
||||||
{
|
|
||||||
user_id : int;
|
|
||||||
level : ("none" | "view" | "edit" | "admin");
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
};
|
|
||||||
resource : (
|
|
||||||
{
|
|
||||||
kind : "local";
|
|
||||||
data : {
|
|
||||||
events : Array<
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @todo rename to "title"
|
|
||||||
*/
|
|
||||||
name : string;
|
|
||||||
begin : type_datetime;
|
|
||||||
end : (
|
|
||||||
null
|
|
||||||
|
|
|
||||||
type_datetime
|
|
||||||
);
|
|
||||||
location : (
|
|
||||||
null
|
|
||||||
|
|
|
||||||
string
|
|
||||||
);
|
|
||||||
link : (
|
|
||||||
null
|
|
||||||
|
|
|
||||||
string
|
|
||||||
);
|
|
||||||
description : (
|
|
||||||
null
|
|
||||||
|
|
|
||||||
string
|
|
||||||
);
|
|
||||||
}
|
|
||||||
>
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
||||||
{
|
|
||||||
kind : "ics_feed";
|
|
||||||
data : {
|
|
||||||
url : string;
|
|
||||||
from_fucked_up_wordpress ?: boolean;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
hue ?: (null | float);
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
const phi : float = ((Math.sqrt(5) - 1) / 2);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function decode_datetime(
|
|
||||||
datetime : type_datetime
|
|
||||||
) : lib_plankton.pit.type_datetime
|
|
||||||
{
|
|
||||||
if ("date_relative" in datetime)
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"timezone_shift": datetime.timezone_shift,
|
|
||||||
"date": lib_plankton.call.convey(
|
|
||||||
lib_plankton.pit.now(),
|
|
||||||
(
|
|
||||||
datetime.date_relative.map<(x : any) => any>(
|
|
||||||
entry => {
|
|
||||||
switch (entry.action)
|
|
||||||
{
|
|
||||||
// default: {throw (new Error("unhandled action: " + entry.action));}
|
|
||||||
case "trunc_week": {return (x => lib_plankton.pit.trunc_week(x));}
|
|
||||||
case "shift_week": {return (x => lib_plankton.pit.shift_week(x, entry.args[0]));}
|
|
||||||
case "shift_day": {return (x => lib_plankton.pit.shift_day(x, entry.args[0]));}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.concat(
|
|
||||||
[
|
|
||||||
lib_plankton.pit.to_datetime,
|
|
||||||
x => x.date,
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
"time": datetime.time,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"timezone_shift": datetime.timezone_shift,
|
|
||||||
"date": datetime.date_absolute,
|
|
||||||
"time": datetime.time,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export async function init(
|
|
||||||
data : type_data
|
|
||||||
) : Promise<void>
|
|
||||||
{
|
|
||||||
let track : {
|
|
||||||
group : Record<
|
|
||||||
int,
|
|
||||||
_zeitbild.type_group_id
|
|
||||||
>;
|
|
||||||
user : Record<
|
|
||||||
int,
|
|
||||||
_zeitbild.type_user_id
|
|
||||||
>;
|
|
||||||
calendar : Record<
|
|
||||||
int,
|
|
||||||
_zeitbild.type_user_id
|
|
||||||
>;
|
|
||||||
} = {
|
|
||||||
"group": {},
|
|
||||||
"user": {},
|
|
||||||
"calendar": {},
|
|
||||||
};
|
|
||||||
// groups
|
|
||||||
{
|
|
||||||
for await (const group_raw of data.groups)
|
|
||||||
{
|
|
||||||
const group_object : _zeitbild.type_group_object = {
|
|
||||||
"name": group_raw.name,
|
|
||||||
"label": (group_raw.label ?? group_raw.name),
|
|
||||||
};
|
|
||||||
const group_id : _zeitbild.type_group_id = await _zeitbild.service.group.add(
|
|
||||||
group_object
|
|
||||||
);
|
|
||||||
track.group[group_raw.id] = group_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// users
|
|
||||||
{
|
|
||||||
for await (const user_raw of data.users)
|
|
||||||
{
|
|
||||||
const user_object : _zeitbild.type_user_object = {
|
|
||||||
"name": user_raw.name,
|
|
||||||
"groups": (user_raw.groups ?? []),
|
|
||||||
"email_address": user_raw.email_address,
|
|
||||||
"dav_token": (user_raw.dav_token ?? null),
|
|
||||||
};
|
|
||||||
const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.add(
|
|
||||||
user_object
|
|
||||||
);
|
|
||||||
await _zeitbild.service.auth_internal.set(
|
|
||||||
user_raw.name,
|
|
||||||
user_raw.password
|
|
||||||
);
|
|
||||||
track.user[user_raw.id] = user_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// calendars
|
|
||||||
{
|
|
||||||
for await (const calendar_raw of data.calendars)
|
|
||||||
{
|
|
||||||
let resource_object : _zeitbild.type_resource_object;
|
|
||||||
let resource_id : _zeitbild.type_resource_id;
|
|
||||||
switch (calendar_raw.resource.kind)
|
|
||||||
{
|
|
||||||
case "local":
|
|
||||||
{
|
|
||||||
resource_object = {
|
|
||||||
"kind": "local",
|
|
||||||
"data": {
|
|
||||||
"event_ids": [],
|
|
||||||
}
|
|
||||||
};
|
|
||||||
resource_id = await _zeitbild.service.resource.add(
|
|
||||||
resource_object
|
|
||||||
);
|
|
||||||
/*const event_ids : Array<_zeitbild.type_local_resource_event_id> = */await Promise.all(
|
|
||||||
calendar_raw.resource.data.events
|
|
||||||
.map(
|
|
||||||
(event_raw) => {
|
|
||||||
const event : _zeitbild.type_event_object = {
|
|
||||||
"name": event_raw.name,
|
|
||||||
"begin": decode_datetime(event_raw.begin),
|
|
||||||
"end": (
|
|
||||||
(event_raw.end === null)
|
|
||||||
?
|
|
||||||
null
|
|
||||||
:
|
|
||||||
decode_datetime(event_raw.end)
|
|
||||||
),
|
|
||||||
"location": event_raw.location,
|
|
||||||
"link": event_raw.link,
|
|
||||||
"description": event_raw.description,
|
|
||||||
};
|
|
||||||
return _zeitbild.service.resource.event_add(resource_id, event);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "ics_feed":
|
|
||||||
{
|
|
||||||
resource_object = {
|
|
||||||
"kind": "ics_feed",
|
|
||||||
"data": {
|
|
||||||
"url": calendar_raw.resource.data.url,
|
|
||||||
"from_fucked_up_wordpress": (calendar_raw.resource.data.from_fucked_up_wordpress ?? false),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
resource_id = await _zeitbild.service.resource.add(
|
|
||||||
resource_object
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const calendar_object : _zeitbild.type_calendar_object =
|
|
||||||
{
|
|
||||||
"name": calendar_raw.name,
|
|
||||||
"hue": (
|
|
||||||
calendar_raw.hue
|
|
||||||
??
|
|
||||||
((calendar_raw.id * phi) % 1)
|
|
||||||
),
|
|
||||||
"access": {
|
|
||||||
"public": (calendar_raw.access.public ?? false),
|
|
||||||
"default_level": _zeitbild.access_level_from_string(calendar_raw.access.default_level),
|
|
||||||
"attributed_group": lib_plankton.map.hashmap.implementation_map(
|
|
||||||
lib_plankton.map.hashmap.make(
|
|
||||||
x => x.toFixed(0),
|
|
||||||
{
|
|
||||||
"pairs": (
|
|
||||||
(calendar_raw.access.attributed_group ?? [])
|
|
||||||
.map(
|
|
||||||
(entry) => ({
|
|
||||||
"key": track.user[entry.group_id],
|
|
||||||
"value": _zeitbild.access_level_from_string(entry.level),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
),
|
|
||||||
"attributed_user": lib_plankton.map.hashmap.implementation_map(
|
|
||||||
lib_plankton.map.hashmap.make(
|
|
||||||
x => x.toFixed(0),
|
|
||||||
{
|
|
||||||
"pairs": (
|
|
||||||
(calendar_raw.access.attributed_user ?? [])
|
|
||||||
.map(
|
|
||||||
(entry) => ({
|
|
||||||
"key": track.user[entry.user_id],
|
|
||||||
"value": _zeitbild.access_level_from_string(entry.level),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
),
|
|
||||||
},
|
|
||||||
"resource_id": resource_id,
|
|
||||||
};
|
|
||||||
const calendar_id : _zeitbild.type_calendar_id = await _zeitbild.service.calendar.add(
|
|
||||||
calendar_object
|
|
||||||
);
|
|
||||||
track.calendar[calendar_raw.id] = calendar_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Promise.resolve<void>(undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.service.auth_internal
|
namespace _zeitbild.service.auth_internal
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,44 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.service.calendar
|
namespace _zeitbild.service.calendar
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
async function get_access_level(
|
function get_access_level(
|
||||||
calendar_object : _zeitbild.type_calendar_object,
|
calendar_object : _zeitbild.type_calendar_object,
|
||||||
user_id : (null | _zeitbild.type_user_id)
|
user_id : (null | _zeitbild.type_user_id)
|
||||||
)
|
) : _zeitbild.enum_access_level
|
||||||
: Promise<_zeitbild.enum_access_level>
|
|
||||||
{
|
{
|
||||||
return _zeitbild.access_level_determine(
|
return (
|
||||||
calendar_object,
|
lib_plankton.list.max<_zeitbild.enum_access_level, _zeitbild.enum_access_level>(
|
||||||
|
[
|
||||||
|
(
|
||||||
|
calendar_object.access.public
|
||||||
|
?
|
||||||
|
_zeitbild.enum_access_level.view
|
||||||
|
:
|
||||||
|
_zeitbild.enum_access_level.none
|
||||||
|
),
|
||||||
(
|
(
|
||||||
(user_id === null)
|
(user_id === null)
|
||||||
?
|
?
|
||||||
null
|
_zeitbild.enum_access_level.none
|
||||||
:
|
:
|
||||||
{
|
calendar_object.access.attributed.get(
|
||||||
"id": user_id,
|
user_id,
|
||||||
"object": (await _zeitbild.service.user.get(user_id)),
|
lib_plankton.pod.make_filled<_zeitbild.enum_access_level>(
|
||||||
}
|
calendar_object.access.default_level
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
],
|
||||||
|
x => x,
|
||||||
|
{
|
||||||
|
"compare_value": _zeitbild.value_object.access_level.order,
|
||||||
|
}
|
||||||
|
)?.value
|
||||||
|
??
|
||||||
|
_zeitbild.enum_access_level.none
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,7 +46,7 @@ namespace _zeitbild.service.calendar
|
||||||
/**
|
/**
|
||||||
* checks if a user has a sufficient access level
|
* checks if a user has a sufficient access level
|
||||||
*/
|
*/
|
||||||
async function wrap_check_access_level<type_result>(
|
function wrap_check_access_level<type_result>(
|
||||||
calendar_object : _zeitbild.type_calendar_object,
|
calendar_object : _zeitbild.type_calendar_object,
|
||||||
user_id : (null | _zeitbild.type_user_id),
|
user_id : (null | _zeitbild.type_user_id),
|
||||||
threshold : _zeitbild.enum_access_level,
|
threshold : _zeitbild.enum_access_level,
|
||||||
|
|
@ -57,29 +55,26 @@ namespace _zeitbild.service.calendar
|
||||||
=>
|
=>
|
||||||
Promise<type_result>
|
Promise<type_result>
|
||||||
)
|
)
|
||||||
)
|
) : Promise<type_result>
|
||||||
: Promise<type_result>
|
|
||||||
{
|
{
|
||||||
const access_level : _zeitbild.enum_access_level = await get_access_level(
|
const access_level : _zeitbild.enum_access_level = get_access_level(
|
||||||
calendar_object,
|
calendar_object,
|
||||||
user_id
|
user_id
|
||||||
);
|
);
|
||||||
if (! _zeitbild.access_level_order(threshold, access_level))
|
if (! _zeitbild.value_object.access_level.order(threshold, access_level)) {
|
||||||
{
|
|
||||||
return Promise.reject<type_result>(
|
return Promise.reject<type_result>(
|
||||||
new Error(
|
new Error(
|
||||||
lib_plankton.string.coin(
|
lib_plankton.string.coin(
|
||||||
"insufficient access level; at least required: {{threshold}}, actual: {{actual}}",
|
"insufficient access level; at least required: {{threshold}}, actual: {{actual}}",
|
||||||
{
|
{
|
||||||
"threshold": _zeitbild.access_level_to_string(threshold),
|
"threshold": _zeitbild.value_object.access_level.to_string(threshold),
|
||||||
"actual": _zeitbild.access_level_to_string(access_level),
|
"actual": _zeitbild.value_object.access_level.to_string(access_level),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return success_handler(access_level);
|
return success_handler(access_level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +90,6 @@ namespace _zeitbild.service.calendar
|
||||||
id : _zeitbild.type_calendar_id;
|
id : _zeitbild.type_calendar_id;
|
||||||
name : string;
|
name : string;
|
||||||
access_level : _zeitbild.enum_access_level;
|
access_level : _zeitbild.enum_access_level;
|
||||||
hue : float;
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
|
|
@ -198,31 +192,21 @@ namespace _zeitbild.service.calendar
|
||||||
calendar_id : _zeitbild.type_calendar_id,
|
calendar_id : _zeitbild.type_calendar_id,
|
||||||
event_object : _zeitbild.type_event_object,
|
event_object : _zeitbild.type_event_object,
|
||||||
user_id : _zeitbild.type_user_id
|
user_id : _zeitbild.type_user_id
|
||||||
) : Promise<
|
) : Promise<void>
|
||||||
{
|
|
||||||
local_resource_event_id : (null | type_local_resource_event_id);
|
|
||||||
hash : type_event_hash;
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{
|
{
|
||||||
const calendar_object : _zeitbild.type_calendar_object = await _zeitbild.repository.calendar.read(
|
const calendar_object : _zeitbild.type_calendar_object = await _zeitbild.repository.calendar.read(
|
||||||
calendar_id
|
calendar_id
|
||||||
);
|
);
|
||||||
return wrap_check_access_level(
|
return wrap_check_access_level<void>(
|
||||||
calendar_object,
|
calendar_object,
|
||||||
user_id,
|
user_id,
|
||||||
_zeitbild.enum_access_level.edit,
|
_zeitbild.enum_access_level.edit,
|
||||||
async () => {
|
async () => {
|
||||||
const local_resource_event_id : _zeitbild.type_local_resource_event_id = await _zeitbild.service.resource.event_add(
|
/*const event_id : _zeitbild.type_local_resource_event_id = */await _zeitbild.service.resource.event_add(
|
||||||
calendar_object.resource_id,
|
calendar_object.resource_id,
|
||||||
event_object
|
event_object
|
||||||
);
|
);
|
||||||
return Promise.resolve(
|
return Promise.resolve<void>(undefined);
|
||||||
{
|
|
||||||
"local_resource_event_id": local_resource_event_id,
|
|
||||||
"hash": get_event_hash_local(calendar_id, local_resource_event_id),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -282,45 +266,6 @@ namespace _zeitbild.service.calendar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function get_event_hash_local(
|
|
||||||
calendar_id : _zeitbild.type_calendar_id,
|
|
||||||
local_resource_event_id : _zeitbild.type_local_resource_event_id
|
|
||||||
) : string
|
|
||||||
{
|
|
||||||
return lib_plankton.string.coin(
|
|
||||||
"{{calendar_id}}:{{event_id}}",
|
|
||||||
{
|
|
||||||
"calendar_id": calendar_id.toFixed(0),
|
|
||||||
"event_id": local_resource_event_id.toFixed(0),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
function get_event_hash_ics_feed(
|
|
||||||
calendar_id : _zeitbild.type_calendar_id,
|
|
||||||
event_object : _zeitbild.type_event_object
|
|
||||||
) : string
|
|
||||||
{
|
|
||||||
return lib_plankton.string.coin(
|
|
||||||
"{{calendar_id}}~{{hash}}",
|
|
||||||
{
|
|
||||||
"calendar_id": calendar_id.toFixed(0),
|
|
||||||
"hash": lib_plankton.call.convey(
|
|
||||||
event_object,
|
|
||||||
[
|
|
||||||
(x : any) => lib_plankton.json.encode(x),
|
|
||||||
(x : string) => lib_plankton.base64.encode(x),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo optimize by reducing the number of database queries
|
* @todo optimize by reducing the number of database queries
|
||||||
*/
|
*/
|
||||||
|
|
@ -333,14 +278,13 @@ namespace _zeitbild.service.calendar
|
||||||
Array<
|
Array<
|
||||||
{
|
{
|
||||||
id : (null | _zeitbild.type_local_resource_event_id);
|
id : (null | _zeitbild.type_local_resource_event_id);
|
||||||
hash : _zeitbild.type_event_hash;
|
|
||||||
object : _zeitbild.type_event_object;
|
object : _zeitbild.type_event_object;
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
const calendar_object : _zeitbild.type_calendar_object = await _zeitbild.repository.calendar.read(calendar_id);
|
const calendar_object : _zeitbild.type_calendar_object = await _zeitbild.repository.calendar.read(calendar_id);
|
||||||
return wrap_check_access_level<Array<{id : (null | _zeitbild.type_local_resource_event_id); hash : _zeitbild.type_event_hash; object : _zeitbild.type_event_object;}>>(
|
return wrap_check_access_level<Array<{id : (null | _zeitbild.type_local_resource_event_id); object : _zeitbild.type_event_object;}>>(
|
||||||
calendar_object,
|
calendar_object,
|
||||||
user_id,
|
user_id,
|
||||||
_zeitbild.enum_access_level.view,
|
_zeitbild.enum_access_level.view,
|
||||||
|
|
@ -361,10 +305,6 @@ namespace _zeitbild.service.calendar
|
||||||
(event_object) => Promise.resolve(
|
(event_object) => Promise.resolve(
|
||||||
{
|
{
|
||||||
"id": event_id,
|
"id": event_id,
|
||||||
"hash": get_event_hash_local(
|
|
||||||
calendar_id,
|
|
||||||
event_id,
|
|
||||||
),
|
|
||||||
"object": event_object,
|
"object": event_object,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -489,7 +429,6 @@ namespace _zeitbild.service.calendar
|
||||||
.map(
|
.map(
|
||||||
(event) => ({
|
(event) => ({
|
||||||
"id": null,
|
"id": null,
|
||||||
"hash": get_event_hash_ics_feed(calendar_id, event),
|
|
||||||
"object": event,
|
"object": event,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
@ -565,14 +504,13 @@ namespace _zeitbild.service.calendar
|
||||||
const calendar_object : _zeitbild.type_calendar_object = await _zeitbild.repository.calendar.read(
|
const calendar_object : _zeitbild.type_calendar_object = await _zeitbild.repository.calendar.read(
|
||||||
calendar_id
|
calendar_id
|
||||||
);
|
);
|
||||||
const access_level : _zeitbild.enum_access_level = await get_access_level(
|
const access_level : _zeitbild.enum_access_level = get_access_level(
|
||||||
calendar_object,
|
calendar_object,
|
||||||
user_id
|
user_id
|
||||||
);
|
);
|
||||||
const events : Array<
|
const events : Array<
|
||||||
{
|
{
|
||||||
id : (null | _zeitbild.type_local_resource_event_id);
|
id : (null | _zeitbild.type_local_resource_event_id);
|
||||||
hash : _zeitbild.type_event_hash;
|
|
||||||
object : _zeitbild.type_event_object;
|
object : _zeitbild.type_event_object;
|
||||||
}
|
}
|
||||||
> = await get_events(
|
> = await get_events(
|
||||||
|
|
@ -585,10 +523,8 @@ namespace _zeitbild.service.calendar
|
||||||
events
|
events
|
||||||
.map(
|
.map(
|
||||||
(event_entry) => ({
|
(event_entry) => ({
|
||||||
"hash": event_entry.hash,
|
|
||||||
"calendar_id": calendar_id,
|
"calendar_id": calendar_id,
|
||||||
"calendar_name": calendar_object.name,
|
"calendar_name": calendar_object.name,
|
||||||
"hue": calendar_object.hue,
|
|
||||||
"access_level": access_level,
|
"access_level": access_level,
|
||||||
"event_id": event_entry.id,
|
"event_id": event_entry.id,
|
||||||
"event_object": event_entry.object,
|
"event_object": event_entry.object,
|
||||||
|
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.service.group
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export function list(
|
|
||||||
)
|
|
||||||
: Promise<
|
|
||||||
Array<
|
|
||||||
{
|
|
||||||
id : _zeitbild.type_group_id;
|
|
||||||
object : _zeitbild.type_group_object;
|
|
||||||
}
|
|
||||||
>
|
|
||||||
>
|
|
||||||
{
|
|
||||||
return _zeitbild.repository.group.list();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export function add(
|
|
||||||
group_object : _zeitbild.type_group_object
|
|
||||||
)
|
|
||||||
: Promise<_zeitbild.type_group_id>
|
|
||||||
{
|
|
||||||
return _zeitbild.repository.group.create(group_object);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export function change(
|
|
||||||
group_id : _zeitbild.type_group_id,
|
|
||||||
group_object : _zeitbild.type_group_object
|
|
||||||
)
|
|
||||||
: Promise<void>
|
|
||||||
{
|
|
||||||
return _zeitbild.repository.group.update(group_id, group_object);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.service.resource
|
namespace _zeitbild.service.resource
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace _zeitbild.service.user
|
namespace _zeitbild.service.user
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,3 @@
|
||||||
/*
|
|
||||||
This file is part of »zeitbild«.
|
|
||||||
|
|
||||||
Copyright 2025 'kcf' <fenris@folksprak.org>
|
|
||||||
|
|
||||||
»zeitbild« is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
»zeitbild« is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
@ -33,19 +14,6 @@ namespace _zeitbild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export type type_group_id = int;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export type type_group_object = {
|
|
||||||
name : string;
|
|
||||||
label : string;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export type type_user_id = int;
|
export type type_user_id = int;
|
||||||
|
|
@ -55,9 +23,6 @@ namespace _zeitbild
|
||||||
*/
|
*/
|
||||||
export type type_user_object = {
|
export type type_user_object = {
|
||||||
name : string;
|
name : string;
|
||||||
groups : Array<
|
|
||||||
type_group_id
|
|
||||||
>;
|
|
||||||
email_address : (
|
email_address : (
|
||||||
null
|
null
|
||||||
|
|
|
|
||||||
|
|
@ -74,9 +39,6 @@ namespace _zeitbild
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export type type_event_object = {
|
export type type_event_object = {
|
||||||
/**
|
|
||||||
* @todo rename to "title"
|
|
||||||
*/
|
|
||||||
name : string;
|
name : string;
|
||||||
begin : lib_plankton.pit.type_datetime;
|
begin : lib_plankton.pit.type_datetime;
|
||||||
end : (
|
end : (
|
||||||
|
|
@ -143,15 +105,10 @@ namespace _zeitbild
|
||||||
*/
|
*/
|
||||||
export type type_calendar_object = {
|
export type type_calendar_object = {
|
||||||
name : string;
|
name : string;
|
||||||
hue : float;
|
|
||||||
access : {
|
access : {
|
||||||
public : boolean;
|
public : boolean;
|
||||||
default_level : enum_access_level;
|
default_level : enum_access_level;
|
||||||
attributed_group : lib_plankton.map.type_map<
|
attributed : lib_plankton.map.type_map<
|
||||||
type_group_id,
|
|
||||||
enum_access_level
|
|
||||||
>;
|
|
||||||
attributed_user : lib_plankton.map.type_map<
|
|
||||||
type_user_id,
|
type_user_id,
|
||||||
enum_access_level
|
enum_access_level
|
||||||
>;
|
>;
|
||||||
|
|
@ -160,18 +117,11 @@ namespace _zeitbild
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export type type_event_hash = string;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export type type_event_extended = {
|
export type type_event_extended = {
|
||||||
hash : type_event_hash;
|
|
||||||
calendar_id : type_calendar_id;
|
calendar_id : type_calendar_id;
|
||||||
calendar_name : string;
|
calendar_name : string;
|
||||||
hue : float;
|
|
||||||
access_level : enum_access_level;
|
access_level : enum_access_level;
|
||||||
event_id : (null | type_local_resource_event_id);
|
event_id : (null | type_local_resource_event_id);
|
||||||
event_object : type_event_object;
|
event_object : type_event_object;
|
||||||
|
|
|
||||||
55
source/value_objects/access_level.ts
Normal file
55
source/value_objects/access_level.ts
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
namespace _zeitbild.value_object.access_level
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function to_string(
|
||||||
|
access_level : _zeitbild.enum_access_level
|
||||||
|
) : string
|
||||||
|
{
|
||||||
|
switch (access_level) {
|
||||||
|
case _zeitbild.enum_access_level.none: {return "none";}
|
||||||
|
case _zeitbild.enum_access_level.view: {return "view";}
|
||||||
|
case _zeitbild.enum_access_level.edit: {return "edit";}
|
||||||
|
case _zeitbild.enum_access_level.admin: {return "admin";}
|
||||||
|
default: {throw (new Error("invalid access level: " + String(access_level)));}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function from_string(
|
||||||
|
access_level_ : string
|
||||||
|
) : _zeitbild.enum_access_level
|
||||||
|
{
|
||||||
|
switch (access_level_) {
|
||||||
|
case "none": {return _zeitbild.enum_access_level.none;}
|
||||||
|
case "view": {return _zeitbild.enum_access_level.view;}
|
||||||
|
case "edit": {return _zeitbild.enum_access_level.edit;}
|
||||||
|
case "admin": {return _zeitbild.enum_access_level.admin;}
|
||||||
|
default: {throw (new Error("invalid encoded access level: " + String(access_level_)));}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function order(
|
||||||
|
x : _zeitbild.enum_access_level,
|
||||||
|
y : _zeitbild.enum_access_level
|
||||||
|
) : boolean
|
||||||
|
{
|
||||||
|
const list : Array<_zeitbild.enum_access_level> = [
|
||||||
|
_zeitbild.enum_access_level.none,
|
||||||
|
_zeitbild.enum_access_level.view,
|
||||||
|
_zeitbild.enum_access_level.edit,
|
||||||
|
_zeitbild.enum_access_level.admin,
|
||||||
|
];
|
||||||
|
return (list.indexOf(x) <= list.indexOf(y));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -47,7 +47,6 @@ def main():
|
||||||
"--verbose",
|
"--verbose",
|
||||||
"--exclude='conf.json'",
|
"--exclude='conf.json'",
|
||||||
"--exclude='data.sqlite'",
|
"--exclude='data.sqlite'",
|
||||||
"--exclude='log.jsonl'",
|
|
||||||
("%s/" % args.build_directory),
|
("%s/" % args.build_directory),
|
||||||
(
|
(
|
||||||
("%s" % args.target_directory)
|
("%s" % args.target_directory)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ cmd_tsc := ${dir_tools}/typescript/node_modules/.bin/tsc
|
||||||
## rules
|
## rules
|
||||||
|
|
||||||
.PHONY: default
|
.PHONY: default
|
||||||
default: node_modules ${dir_build}/zeitbild node_modules
|
default: node_modules sql ${dir_build}/zeitbild node_modules
|
||||||
|
|
||||||
.PHONY: node_modules
|
.PHONY: node_modules
|
||||||
node_modules:
|
node_modules:
|
||||||
|
|
@ -26,6 +26,13 @@ node_modules:
|
||||||
@ ${cmd_log} "node modules …"
|
@ ${cmd_log} "node modules …"
|
||||||
@ ${cmd_cp} -r -u ${dir_lib}/node/node_modules/* ${dir_build}/node_modules/
|
@ ${cmd_cp} -r -u ${dir_lib}/node/node_modules/* ${dir_build}/node_modules/
|
||||||
|
|
||||||
|
.PHONY: sql
|
||||||
|
sql: \
|
||||||
|
$(wildcard ${dir_source}/repositories/sql/*)
|
||||||
|
@ ${cmd_log} "sql …"
|
||||||
|
@ ${cmd_mkdir} ${dir_build}/sql
|
||||||
|
@ ${cmd_cp} -r -u $^ ${dir_build}/sql/
|
||||||
|
|
||||||
${dir_temp}/conf.ts: \
|
${dir_temp}/conf.ts: \
|
||||||
${dir_source}/conf.ts.tpl \
|
${dir_source}/conf.ts.tpl \
|
||||||
${dir_source}/conf.schema.json
|
${dir_source}/conf.schema.json
|
||||||
|
|
@ -40,14 +47,12 @@ ${dir_temp}/zeitbild-unlinked.js: \
|
||||||
${dir_source}/database.ts \
|
${dir_source}/database.ts \
|
||||||
${dir_source}/auth.ts \
|
${dir_source}/auth.ts \
|
||||||
${dir_source}/types.ts \
|
${dir_source}/types.ts \
|
||||||
${dir_source}/logic.ts \
|
${dir_source}/value_objects/access_level.ts \
|
||||||
${dir_source}/repositories/auth_internal.ts \
|
${dir_source}/repositories/auth_internal.ts \
|
||||||
${dir_source}/repositories/group.ts \
|
|
||||||
${dir_source}/repositories/user.ts \
|
${dir_source}/repositories/user.ts \
|
||||||
${dir_source}/repositories/resource.ts \
|
${dir_source}/repositories/resource.ts \
|
||||||
${dir_source}/repositories/calendar.ts \
|
${dir_source}/repositories/calendar.ts \
|
||||||
${dir_source}/services/auth_internal.ts \
|
${dir_source}/services/auth_internal.ts \
|
||||||
${dir_source}/services/group.ts \
|
|
||||||
${dir_source}/services/user.ts \
|
${dir_source}/services/user.ts \
|
||||||
${dir_source}/services/resource.ts \
|
${dir_source}/services/resource.ts \
|
||||||
${dir_source}/services/calendar.ts \
|
${dir_source}/services/calendar.ts \
|
||||||
|
|
@ -59,8 +64,6 @@ ${dir_temp}/zeitbild-unlinked.js: \
|
||||||
${dir_source}/api/actions/session_begin.ts \
|
${dir_source}/api/actions/session_begin.ts \
|
||||||
${dir_source}/api/actions/session_oidc.ts \
|
${dir_source}/api/actions/session_oidc.ts \
|
||||||
${dir_source}/api/actions/session_end.ts \
|
${dir_source}/api/actions/session_end.ts \
|
||||||
${dir_source}/api/actions/session_status.ts \
|
|
||||||
${dir_source}/api/actions/group_list.ts \
|
|
||||||
${dir_source}/api/actions/users.ts \
|
${dir_source}/api/actions/users.ts \
|
||||||
${dir_source}/api/actions/user_dav_conf.ts \
|
${dir_source}/api/actions/user_dav_conf.ts \
|
||||||
${dir_source}/api/actions/user_dav_token.ts \
|
${dir_source}/api/actions/user_dav_token.ts \
|
||||||
|
|
@ -76,7 +79,6 @@ ${dir_temp}/zeitbild-unlinked.js: \
|
||||||
${dir_source}/api/actions/events.ts \
|
${dir_source}/api/actions/events.ts \
|
||||||
${dir_source}/api/actions/export_ics.ts \
|
${dir_source}/api/actions/export_ics.ts \
|
||||||
${dir_source}/api/functions.ts \
|
${dir_source}/api/functions.ts \
|
||||||
${dir_source}/sample.ts \
|
|
||||||
${dir_source}/main.ts
|
${dir_source}/main.ts
|
||||||
@ ${cmd_log} "compile …"
|
@ ${cmd_log} "compile …"
|
||||||
@ ${cmd_mkdir} $(dir $@)
|
@ ${cmd_mkdir} $(dir $@)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ modules="${modules} session"
|
||||||
modules="${modules} file"
|
modules="${modules} file"
|
||||||
modules="${modules} string"
|
modules="${modules} string"
|
||||||
modules="${modules} json"
|
modules="${modules} json"
|
||||||
modules="${modules} base64"
|
|
||||||
modules="${modules} list"
|
modules="${modules} list"
|
||||||
modules="${modules} order"
|
modules="${modules} order"
|
||||||
modules="${modules} ical"
|
modules="${modules} ical"
|
||||||
|
|
@ -44,8 +43,8 @@ mkdir -p ${dir}
|
||||||
mkdir /tmp/sandbox -p
|
mkdir /tmp/sandbox -p
|
||||||
cd /tmp/sandbox
|
cd /tmp/sandbox
|
||||||
ptk fetch node ${modules}
|
ptk fetch node ${modules}
|
||||||
schwamm --include=/tmp/sandbox/plankton.swm.json --output=dump:logic-decl > ${dir}/plankton.d.ts
|
schwamm --include=/tmp/sandboxplankton.swm.json --output=dump:logic-decl > ${dir}/plankton.d.ts
|
||||||
schwamm --include=/tmp/sandbox/plankton.swm.json --output=dump:logic-impl > ${dir}/plankton.js
|
schwamm --include=/tmp/sandboxplankton.swm.json --output=dump:logic-impl > ${dir}/plankton.js
|
||||||
exit
|
exit
|
||||||
|
|
||||||
mkdir -p ${dir}
|
mkdir -p ${dir}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue