Compare commits
15 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
085d255ae7 | ||
|
|
4538782d80 | ||
|
|
cc244ad576 | ||
|
|
8d803cbec1 | ||
|
|
7c9f856aa1 | ||
|
|
79253873be | ||
|
|
1ed2f003e4 | ||
|
|
ff5449766a | ||
|
|
547c957f42 | ||
|
|
abd703981f | ||
|
|
d77f0299b9 | ||
|
|
9006170bdf | ||
|
|
2485e9c680 | ||
|
|
d712412ac5 | ||
|
|
aa17938c6e |
|
|
@ -44,14 +44,6 @@
|
||||||
"name": "Example Orginsation",
|
"name": "Example Orginsation",
|
||||||
"domain": "example.org"
|
"domain": "example.org"
|
||||||
},
|
},
|
||||||
"misc": {
|
|
||||||
"prefix_for_veiled_email_addresses": "member-",
|
|
||||||
"facultative_membership_number": true,
|
|
||||||
"auto_register": true
|
|
||||||
},
|
|
||||||
"summon_email": {
|
|
||||||
"remark": null
|
|
||||||
},
|
|
||||||
"password_policy": {
|
"password_policy": {
|
||||||
"minimum_length": 4,
|
"minimum_length": 4,
|
||||||
"maximum_length": 12,
|
"maximum_length": 12,
|
||||||
|
|
@ -62,13 +54,11 @@
|
||||||
"password_change": {
|
"password_change": {
|
||||||
"cooldown_time": 300
|
"cooldown_time": 300
|
||||||
},
|
},
|
||||||
"name_index": {
|
|
||||||
"veil": false,
|
|
||||||
"salt": null
|
|
||||||
},
|
|
||||||
"connections": {
|
"connections": {
|
||||||
"frontend_url_base": "http://localhost:8888",
|
"frontend_url_base": "http://localhost:8888",
|
||||||
"login_url": null
|
"frontend_path_template_invitation_handle": "/#invitation_handle,key={{key}}",
|
||||||
|
"frontend_path_template_password_change": "/#password_change_exec,id={{id}},key={{key}}",
|
||||||
|
"login_url": "https://login.example.org"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
|
|
@ -39,21 +39,24 @@
|
||||||
"name": "alexandra",
|
"name": "alexandra",
|
||||||
"label": "Alexandra Ahorn",
|
"label": "Alexandra Ahorn",
|
||||||
"email_address": "alex-rockt@example.org",
|
"email_address": "alex-rockt@example.org",
|
||||||
"groups": [1, 2, 3]
|
"groups": [1, 2, 3],
|
||||||
|
"password": "aaa111"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"name": "berthold",
|
"name": "berthold",
|
||||||
"label": "Berthold Buche",
|
"label": "Berthold Buche",
|
||||||
"email_address": "bert-ohne-ernie@example.org",
|
"email_address": "bert-ohne-ernie@example.org",
|
||||||
"groups": [4, 5, 2]
|
"groups": [4, 5, 2],
|
||||||
|
"password": "bbb222"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 3,
|
"id": 3,
|
||||||
"name": "charlotte",
|
"name": "charlotte",
|
||||||
"label": "Charlotte Castania",
|
"label": "Charlotte Castania",
|
||||||
"email_address": "charly-the-unicorn@example.org",
|
"email_address": "charly-the-unicorn@example.org",
|
||||||
"groups": [4, 1]
|
"groups": [4, 1],
|
||||||
|
"password": "ccc333"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"invitations": [
|
"invitations": [
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## Beschreibung
|
## Beschreibung
|
||||||
|
|
||||||
- Hintergrund-Dienst für [Espe](https://gitlab.die-linke.cloud/espe/documentation)
|
- Hintergrund-Dienst für [Espe](/espe/meta)
|
||||||
|
|
||||||
|
|
||||||
## Erstellung
|
## Erstellung
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,10 @@ namespace _espe.api
|
||||||
"type": "intiger",
|
"type": "intiger",
|
||||||
"description": "ID"
|
"description": "ID"
|
||||||
},
|
},
|
||||||
|
"preview": {
|
||||||
|
"nullable": false,
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
"name": {
|
"name": {
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
@ -63,12 +67,19 @@ namespace _espe.api
|
||||||
"description": "Beschriftung"
|
"description": "Beschriftung"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"label",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"id",
|
"id",
|
||||||
"name",
|
"preview",
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
"restriction": () => restriction_logged_in,
|
"restriction": () => restriction_none,
|
||||||
"execution": () => async ({}) => {
|
"execution": () => async ({}) => {
|
||||||
const data = await _espe.service.group.list();
|
const data = await _espe.service.group.list();
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ namespace _espe.api
|
||||||
groups_value : Array<int>;
|
groups_value : Array<int>;
|
||||||
expiry : (null | int);
|
expiry : (null | int);
|
||||||
};
|
};
|
||||||
notification_target_url_template ?: (null | string);
|
|
||||||
send_immediatly : boolean;
|
send_immediatly : boolean;
|
||||||
},
|
},
|
||||||
(
|
(
|
||||||
|
|
@ -44,6 +43,7 @@ namespace _espe.api
|
||||||
{
|
{
|
||||||
id : _espe.type.member_id;
|
id : _espe.type.member_id;
|
||||||
key : string;
|
key : string;
|
||||||
|
url : (null | string);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
>(
|
>(
|
||||||
|
|
@ -117,11 +117,6 @@ namespace _espe.api
|
||||||
"expiry",
|
"expiry",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"notification_target_url_template": {
|
|
||||||
"type": "string",
|
|
||||||
"nullable": true,
|
|
||||||
"description": "Platz-Halter: key"
|
|
||||||
},
|
|
||||||
"send_immediatly": {
|
"send_immediatly": {
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
|
@ -145,20 +140,31 @@ namespace _espe.api
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
},
|
},
|
||||||
|
"url": {
|
||||||
|
"type": "string",
|
||||||
|
"nullable": true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"required": [
|
"required": [
|
||||||
"id",
|
"id",
|
||||||
"key",
|
"key",
|
||||||
|
"url",
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
"restriction": () => restriction_logged_in,
|
"restriction": () => restriction_logged_in,
|
||||||
"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 invitation_info : {id : _espe.type.invitation_id; key : _espe.type.invitation_key;} = await _espe.service.invitation.create(
|
{
|
||||||
|
const invitation_info : {
|
||||||
|
id : _espe.type.invitation_id;
|
||||||
|
key : _espe.type.invitation_key;
|
||||||
|
url : (null | string);
|
||||||
|
} = await _espe.service.invitation.create(
|
||||||
{
|
{
|
||||||
"name_changeable": input.data.name_changeable,
|
"name_changeable": input.data.name_changeable,
|
||||||
"name_value": input.data.name_value,
|
"name_value": input.data.name_value,
|
||||||
|
|
@ -171,14 +177,15 @@ namespace _espe.api
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"expiry": input.data.expiry,
|
"expiry": input.data.expiry,
|
||||||
"notification_target_url_template": input.notification_target_url_template,
|
|
||||||
"send_immediatly": input.send_immediatly,
|
"send_immediatly": input.send_immediatly,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return Promise.resolve({
|
return Promise.resolve(
|
||||||
|
{
|
||||||
"status_code": 201,
|
"status_code": 201,
|
||||||
"data": invitation_info
|
"data": invitation_info
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
69
source/api/actions/invitation_delete.ts
Normal file
69
source/api/actions/invitation_delete.ts
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
Espe | Ein schlichtes Werkzeug zur Mitglieder-Verwaltung | Backend
|
||||||
|
Copyright (C) 2024 Christian Fraß
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
|
||||||
|
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
This program 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with this program. If not, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace _espe.api
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function register_invitation_delete(
|
||||||
|
rest_subject : lib_plankton.rest_http.type_rest
|
||||||
|
) : void
|
||||||
|
{
|
||||||
|
lib_plankton.rest_http.register<
|
||||||
|
int,
|
||||||
|
null
|
||||||
|
>(
|
||||||
|
rest_subject,
|
||||||
|
lib_plankton.http.enum_method.delete,
|
||||||
|
_espe.api.full_path("/invitation/delete"),
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @todo translation
|
||||||
|
*/
|
||||||
|
"description": () => "löscht eine Einladung",
|
||||||
|
"input_schema": () => ({
|
||||||
|
"nullable": false,
|
||||||
|
"type": "integer",
|
||||||
|
}),
|
||||||
|
"output_schema": () => ({
|
||||||
|
"nullable": true,
|
||||||
|
}),
|
||||||
|
"restriction": () => restriction_logged_in,
|
||||||
|
"execution": () => async (stuff) => {
|
||||||
|
if (stuff.input === null)
|
||||||
|
{
|
||||||
|
return Promise.reject(new Error("impossible"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const invitation_id : _espe.type.invitation_id = stuff.input;
|
||||||
|
await _espe.service.invitation.remove(
|
||||||
|
invitation_id
|
||||||
|
);
|
||||||
|
return Promise.resolve(
|
||||||
|
{
|
||||||
|
"status_code": 200,
|
||||||
|
"data": null
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -62,15 +62,22 @@ namespace _espe.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
|
||||||
await _espe.service.member.password_change_initialize(input.identifier, input.url_template);
|
{
|
||||||
return Promise.resolve({
|
await _espe.service.member.password_change_initialize(
|
||||||
|
input.identifier,
|
||||||
|
input.url_template
|
||||||
|
);
|
||||||
|
return Promise.resolve(
|
||||||
|
{
|
||||||
"status_code": 200,
|
"status_code": 200,
|
||||||
"data": null
|
"data": null
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace _espe.api
|
||||||
>(
|
>(
|
||||||
rest_subject,
|
rest_subject,
|
||||||
lib_plankton.http.enum_method.post,
|
lib_plankton.http.enum_method.post,
|
||||||
_espe.conf.get().server.path_base + "/session/begin",
|
_espe.api.full_path("/session/begin"),
|
||||||
{
|
{
|
||||||
"description": () => "führt die Anmeldung am System aus um geschützte Aktionen nutzen zu können",
|
"description": () => "führt die Anmeldung am System aus um geschützte Aktionen nutzen zu können",
|
||||||
"input_schema": () => ({
|
"input_schema": () => ({
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ namespace _espe.api
|
||||||
_espe.api.register_invitation_list(rest_subject);
|
_espe.api.register_invitation_list(rest_subject);
|
||||||
_espe.api.register_invitation_read(rest_subject);
|
_espe.api.register_invitation_read(rest_subject);
|
||||||
_espe.api.register_invitation_create(rest_subject);
|
_espe.api.register_invitation_create(rest_subject);
|
||||||
|
_espe.api.register_invitation_delete(rest_subject);
|
||||||
_espe.api.register_invitation_examine(rest_subject);
|
_espe.api.register_invitation_examine(rest_subject);
|
||||||
_espe.api.register_invitation_accept(rest_subject);
|
_espe.api.register_invitation_accept(rest_subject);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
124
source/conf.ts
124
source/conf.ts
|
|
@ -149,14 +149,6 @@ namespace _espe.conf
|
||||||
name : string;
|
name : string;
|
||||||
domain : string;
|
domain : string;
|
||||||
};
|
};
|
||||||
misc : {
|
|
||||||
prefix_for_veiled_email_addresses : string;
|
|
||||||
facultative_membership_number : boolean;
|
|
||||||
auto_register : boolean;
|
|
||||||
};
|
|
||||||
summon_email : {
|
|
||||||
remark : string;
|
|
||||||
};
|
|
||||||
password_policy : {
|
password_policy : {
|
||||||
minimum_length : (null | int);
|
minimum_length : (null | int);
|
||||||
maximum_length : (null | int);
|
maximum_length : (null | int);
|
||||||
|
|
@ -167,12 +159,10 @@ namespace _espe.conf
|
||||||
password_change : {
|
password_change : {
|
||||||
cooldown_time : int;
|
cooldown_time : int;
|
||||||
};
|
};
|
||||||
name_index : {
|
|
||||||
veil : boolean;
|
|
||||||
salt : (null | string);
|
|
||||||
};
|
|
||||||
connections : {
|
connections : {
|
||||||
frontend_url_base : (null | string);
|
frontend_url_base : (null | string);
|
||||||
|
frontend_path_template_invitation_handle : (null | string);
|
||||||
|
frontend_path_template_password_change : (null | string);
|
||||||
login_url : (null | string);
|
login_url : (null | string);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -220,7 +210,7 @@ namespace _espe.conf
|
||||||
conf_raw : any
|
conf_raw : any
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
const version : int = (conf_raw["version"] ?? 5);
|
const version : int = (conf_raw["version"] ?? 6);
|
||||||
_data = {
|
_data = {
|
||||||
"general": (
|
"general": (
|
||||||
((node_general) => ({
|
((node_general) => ({
|
||||||
|
|
@ -231,7 +221,8 @@ namespace _espe.conf
|
||||||
"log": (
|
"log": (
|
||||||
(() => {
|
(() => {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 1: {
|
case 1:
|
||||||
|
{
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"kind": "stdout",
|
"kind": "stdout",
|
||||||
|
|
@ -245,7 +236,9 @@ namespace _espe.conf
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
case 5: {
|
case 5:
|
||||||
|
case 6:
|
||||||
|
{
|
||||||
const node_log = (
|
const node_log = (
|
||||||
conf_raw["log"]
|
conf_raw["log"]
|
||||||
??
|
??
|
||||||
|
|
@ -282,12 +275,15 @@ namespace _espe.conf
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
case 3: {
|
case 3:
|
||||||
|
{
|
||||||
return "::";
|
return "::";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
case 5: {
|
case 5:
|
||||||
|
case 6:
|
||||||
|
{
|
||||||
return (node_server["host"] ?? "::");
|
return (node_server["host"] ?? "::");
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
@ -302,7 +298,8 @@ namespace _espe.conf
|
||||||
const kind : string = (node_database["kind"] ?? "sqlite");
|
const kind : string = (node_database["kind"] ?? "sqlite");
|
||||||
const node_database_data_raw = (node_database["data"] ?? {});
|
const node_database_data_raw = (node_database["data"] ?? {});
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case "sqlite": {
|
case "sqlite":
|
||||||
|
{
|
||||||
return {
|
return {
|
||||||
"kind": kind,
|
"kind": kind,
|
||||||
"data": {
|
"data": {
|
||||||
|
|
@ -311,14 +308,16 @@ namespace _espe.conf
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "postgresql": {
|
case "postgresql":
|
||||||
|
{
|
||||||
return {
|
return {
|
||||||
"kind": kind,
|
"kind": kind,
|
||||||
"data": node_database_data_raw,
|
"data": node_database_data_raw,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
throw (new Error("unhandled"));
|
throw (new Error("unhandled"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -330,7 +329,8 @@ namespace _espe.conf
|
||||||
const kind : string = (node_email_sending["kind"] ?? "console");
|
const kind : string = (node_email_sending["kind"] ?? "console");
|
||||||
const data_raw = (node_email_sending["data"] ?? {});
|
const data_raw = (node_email_sending["data"] ?? {});
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case "regular": {
|
case "regular":
|
||||||
|
{
|
||||||
return {
|
return {
|
||||||
"kind": kind,
|
"kind": kind,
|
||||||
"data": {
|
"data": {
|
||||||
|
|
@ -340,7 +340,8 @@ namespace _espe.conf
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "redirect": {
|
case "redirect":
|
||||||
|
{
|
||||||
return {
|
return {
|
||||||
"kind": kind,
|
"kind": kind,
|
||||||
"data": {
|
"data": {
|
||||||
|
|
@ -351,7 +352,8 @@ namespace _espe.conf
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "console": {
|
case "console":
|
||||||
|
{
|
||||||
return {
|
return {
|
||||||
"kind": kind,
|
"kind": kind,
|
||||||
"data": {
|
"data": {
|
||||||
|
|
@ -359,7 +361,8 @@ namespace _espe.conf
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "drop": {
|
case "drop":
|
||||||
|
{
|
||||||
return {
|
return {
|
||||||
"kind": kind,
|
"kind": kind,
|
||||||
"data": {
|
"data": {
|
||||||
|
|
@ -367,7 +370,8 @@ namespace _espe.conf
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
throw (new Error("unhandled"));
|
throw (new Error("unhandled"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -387,18 +391,6 @@ namespace _espe.conf
|
||||||
"name": ((node_settings["organisation"] ?? {})["name"] ?? "Example Orginsation"), // TODO: mandatory?
|
"name": ((node_settings["organisation"] ?? {})["name"] ?? "Example Orginsation"), // TODO: mandatory?
|
||||||
"domain": ((node_settings["organisation"] ?? {})["domain"] ?? "example.org"), // TODO: mandatory?
|
"domain": ((node_settings["organisation"] ?? {})["domain"] ?? "example.org"), // TODO: mandatory?
|
||||||
},
|
},
|
||||||
"misc": (
|
|
||||||
((node_settings_misc) => ({
|
|
||||||
"prefix_for_veiled_email_addresses": (node_settings_misc["prefix_for_veiled_email_addresses"] ?? "member-"),
|
|
||||||
"facultative_membership_number": (node_settings_misc["facultative_membership_number"] ?? false),
|
|
||||||
"auto_register": (node_settings_misc["auto_register"] ?? false),
|
|
||||||
})) (node_settings["misc"] ?? {})
|
|
||||||
),
|
|
||||||
"summon_email": (
|
|
||||||
((node_settings_summon_email) => ({
|
|
||||||
"remark": (node_settings_summon_email["remark"] ?? null),
|
|
||||||
})) (node_settings["summon_email"] ?? {})
|
|
||||||
),
|
|
||||||
"password_policy": (
|
"password_policy": (
|
||||||
((node_settings_password_policy) => ({
|
((node_settings_password_policy) => ({
|
||||||
"minimum_length": (
|
"minimum_length": (
|
||||||
|
|
@ -412,8 +404,8 @@ namespace _espe.conf
|
||||||
: 240
|
: 240
|
||||||
),
|
),
|
||||||
"must_contain_letter": (node_settings_password_policy["must_contain_letter"] ?? true),
|
"must_contain_letter": (node_settings_password_policy["must_contain_letter"] ?? true),
|
||||||
"must_contain_number": (node_settings_password_policy["must_contain_number"] ?? true),
|
"must_contain_number": (node_settings_password_policy["must_contain_number"] ?? false),
|
||||||
"must_contain_special_character": (node_settings_password_policy["must_contain_special_character"] ?? true),
|
"must_contain_special_character": (node_settings_password_policy["must_contain_special_character"] ?? false),
|
||||||
})) (node_settings["password_policy"] ?? {})
|
})) (node_settings["password_policy"] ?? {})
|
||||||
),
|
),
|
||||||
"password_change": (
|
"password_change": (
|
||||||
|
|
@ -421,15 +413,47 @@ namespace _espe.conf
|
||||||
"cooldown_time": (node_settings_password_change["cooldown_time"] ?? 86400),
|
"cooldown_time": (node_settings_password_change["cooldown_time"] ?? 86400),
|
||||||
})) (node_settings["password_change"] ?? {})
|
})) (node_settings["password_change"] ?? {})
|
||||||
),
|
),
|
||||||
"name_index": (
|
|
||||||
((node_settings_password_policy) => ({
|
|
||||||
"veil": (node_settings_password_policy["veil"] ?? true),
|
|
||||||
"salt": (node_settings_password_policy["salt"] ?? ""),
|
|
||||||
})) (node_settings["name_index"] ?? {})
|
|
||||||
),
|
|
||||||
"connections": (
|
"connections": (
|
||||||
((node_settings_connections) => ({
|
((node_settings_connections) => ({
|
||||||
"frontend_url_base": (node_settings_connections["frontend_url_base"] ?? null),
|
"frontend_url_base": (node_settings_connections["frontend_url_base"] ?? null),
|
||||||
|
"frontend_path_template_password_change": (() => {
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 6:
|
||||||
|
{
|
||||||
|
return (node_settings_connections["frontend_path_template_password_change"] ?? null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) (),
|
||||||
|
"frontend_path_template_invitation_handle": (() => {
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 6:
|
||||||
|
{
|
||||||
|
return (node_settings_connections["frontend_path_template_invitation_handle"] ?? null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) (),
|
||||||
"login_url": (node_settings_connections["login_url"] ?? null),
|
"login_url": (node_settings_connections["login_url"] ?? null),
|
||||||
})) (node_settings["connections"] ?? {})
|
})) (node_settings["connections"] ?? {})
|
||||||
),
|
),
|
||||||
|
|
@ -438,7 +462,8 @@ namespace _espe.conf
|
||||||
"outputs": (() => {
|
"outputs": (() => {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2: {
|
case 2:
|
||||||
|
{
|
||||||
const node_output = (conf_raw["output"] ?? {});
|
const node_output = (conf_raw["output"] ?? {});
|
||||||
return (
|
return (
|
||||||
("authelia" in node_output)
|
("authelia" in node_output)
|
||||||
|
|
@ -457,12 +482,15 @@ namespace _espe.conf
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3:
|
||||||
|
{
|
||||||
return (conf_raw["outputs"] ?? []);
|
return (conf_raw["outputs"] ?? []);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
case 5: {
|
case 5:
|
||||||
|
case 6:
|
||||||
|
{
|
||||||
const node_outputs = (conf_raw["outputs"] ?? []);
|
const node_outputs = (conf_raw["outputs"] ?? []);
|
||||||
return node_outputs.map(
|
return node_outputs.map(
|
||||||
(output_description : {kind : string; data : any;}) => {
|
(output_description : {kind : string; data : any;}) => {
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,8 @@
|
||||||
"identifier": "deu"
|
"identifier": "deu"
|
||||||
},
|
},
|
||||||
"tree": {
|
"tree": {
|
||||||
"email.summon.subject": "Registrierung",
|
|
||||||
"email.summon.body": "Hi, {{name}}\n\n{{remark}}\n\nWenn du die Dienste nutzen möchtest, rufe bitte folgende Adresse auf:\n\n{{url}}",
|
|
||||||
"email.registration.subject": "Registrierung erfolgt",
|
"email.registration.subject": "Registrierung erfolgt",
|
||||||
"email.registration.body": "Das Mitglied '{{name_display}}' hat sich soeben registriert:\n\n{{url}}",
|
"email.registration.body": "'{{name}}' ('{{label}}') wurde soeben registriert",
|
||||||
"email.activation.subject": "Freischaltung erfolgt",
|
"email.activation.subject": "Freischaltung erfolgt",
|
||||||
"email.activation.body": "Hi, {{name_display}}\n\nDein Mitglieder-Konto wurde gerade freigeschalten. Du kannst dich nun anmelden:\n\nURL: {{url}}\nAnmelde-Name: {{name_login}}\n{{password_info}}",
|
"email.activation.body": "Hi, {{name_display}}\n\nDein Mitglieder-Konto wurde gerade freigeschalten. Du kannst dich nun anmelden:\n\nURL: {{url}}\nAnmelde-Name: {{name_login}}\n{{password_info}}",
|
||||||
"email.activation.password_info": "Passwort: {{password}}\n\nBitte ändere dein Passwort zeitnah!",
|
"email.activation.password_info": "Passwort: {{password}}\n\nBitte ändere dein Passwort zeitnah!",
|
||||||
|
|
@ -15,7 +13,7 @@
|
||||||
"email.password_change.execution.subject": "Passwort-Änderung abgeschlossen",
|
"email.password_change.execution.subject": "Passwort-Änderung abgeschlossen",
|
||||||
"email.password_change.execution.body": "Hi, {{name}}\n\nDein Passwort wurde soeben geändert.\n",
|
"email.password_change.execution.body": "Hi, {{name}}\n\nDein Passwort wurde soeben geändert.\n",
|
||||||
"email.invitation.subject": "Einladung",
|
"email.invitation.subject": "Einladung",
|
||||||
"email.invitation.body": "{{url}}",
|
"email.invitation.body": "Du wurdest zu {{organisation}} eingeladen. Um beizutreten, rufe bitte folgende Adresse auf:\n\n{{url}}",
|
||||||
"help.args.action.description": "auszuführende Aktion; Auswahl",
|
"help.args.action.description": "auszuführende Aktion; Auswahl",
|
||||||
"help.args.action.options.serve": "Server starten",
|
"help.args.action.options.serve": "Server starten",
|
||||||
"help.args.action.options.api_doc": "API-Dokumentation gemäß OpenAPI-Spezifikation auf Standard-Ausgabe schreiben",
|
"help.args.action.options.api_doc": "API-Dokumentation gemäß OpenAPI-Spezifikation auf Standard-Ausgabe schreiben",
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,8 @@
|
||||||
"identifier": "eng"
|
"identifier": "eng"
|
||||||
},
|
},
|
||||||
"tree": {
|
"tree": {
|
||||||
"email.summon.subject": "Registration",
|
|
||||||
"email.summon.body": "Hi, {{name}}\n\n{{remark}}\n\nIn case you want to use online service, open the following link:\n\n{{url}}",
|
|
||||||
"email.registration.subject": "Registration received",
|
"email.registration.subject": "Registration received",
|
||||||
"email.registration.body": "The member '{{name_display}}' just registered:\n\n{{url}}",
|
"email.registration.body": "'{{name}}' ('{{label}}') just has been registered",
|
||||||
"email.activation.subject": "Activated",
|
"email.activation.subject": "Activated",
|
||||||
"email.activation.body": "Hi, {{name_display}}\n\nYour account has just been activated. You may login now:\n\nURL: {{url}}\nLogin name: {{name_login}}\n{{password_info}}",
|
"email.activation.body": "Hi, {{name_display}}\n\nYour account has just been activated. You may login now:\n\nURL: {{url}}\nLogin name: {{name_login}}\n{{password_info}}",
|
||||||
"email.activation.password_info": "Password: {{password}}\n\nPlease change your password soon!",
|
"email.activation.password_info": "Password: {{password}}\n\nPlease change your password soon!",
|
||||||
|
|
@ -15,7 +13,7 @@
|
||||||
"email.password_change.execution.subject": "Password change concluded",
|
"email.password_change.execution.subject": "Password change concluded",
|
||||||
"email.password_change.execution.body": "Hi, {{name}}\n\nYour password has just been changed.\n",
|
"email.password_change.execution.body": "Hi, {{name}}\n\nYour password has just been changed.\n",
|
||||||
"email.invitation.subject": "invitation",
|
"email.invitation.subject": "invitation",
|
||||||
"email.invitation.body": "{{url}}",
|
"email.invitation.body": "You have been invited to {{organisation}}. In order to join, please open the following address:\n\n{{url}}",
|
||||||
"help.args.action.description": "action to executo; options",
|
"help.args.action.description": "action to executo; options",
|
||||||
"help.args.action.options.serve": "start server",
|
"help.args.action.options.serve": "start server",
|
||||||
"help.args.action.options.api_doc": "write API documentation according to OpenAPI specification to stdout",
|
"help.args.action.options.api_doc": "write API documentation according to OpenAPI specification to stdout",
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ namespace _espe.helpers
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return lib_plankton.string.coin(
|
return lib_plankton.string.coin(
|
||||||
"{{base}}/{{rest}}",
|
"{{base}}{{rest}}",
|
||||||
{
|
{
|
||||||
"base": frontend_url_base,
|
"base": frontend_url_base,
|
||||||
"rest": lib_plankton.string.coin(template, arguments_),
|
"rest": lib_plankton.string.coin(template, arguments_),
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ namespace _espe.sample
|
||||||
label : string;
|
label : string;
|
||||||
email_address : (null | string);
|
email_address : (null | string);
|
||||||
groups : Array<int>;
|
groups : Array<int>;
|
||||||
|
password : string;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
invitations : Array<
|
invitations : Array<
|
||||||
|
|
@ -94,15 +95,19 @@ namespace _espe.sample
|
||||||
{
|
{
|
||||||
for (const member_raw of data.members)
|
for (const member_raw of data.members)
|
||||||
{
|
{
|
||||||
const member_id : _espe.type.member_id = await _espe.service.member.project(
|
const member_id : _espe.type.member_id = await _espe.service.member.add(
|
||||||
{
|
{
|
||||||
"name": member_raw.name,
|
"name": member_raw.name,
|
||||||
"label": member_raw.label,
|
"label": member_raw.label,
|
||||||
"email_address": member_raw.email_address,
|
"email_address": member_raw.email_address,
|
||||||
"groups": member_raw.groups.map(group_id => track_groups.get(group_id)),
|
"groups": member_raw.groups.map(group_id => track_groups.get(group_id)),
|
||||||
|
"password": member_raw.password,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"silent": true,
|
"password_generated": false,
|
||||||
|
"signal_change": false,
|
||||||
|
"greet_member": false,
|
||||||
|
"notify_admins": false,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace _espe.service.group
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function list(
|
export async function list(
|
||||||
) : Promise<
|
) : Promise<
|
||||||
Array<
|
Array<
|
||||||
{
|
{
|
||||||
|
|
@ -31,7 +31,12 @@ namespace _espe.service.group
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
return _espe.repository.group.list(null);
|
return lib_plankton.list.sorted(
|
||||||
|
await _espe.repository.group.list(null),
|
||||||
|
{
|
||||||
|
"compare_element": (entry1, entry2) => (entry1.preview.label <= entry2.preview.label)
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,9 @@ namespace _espe.service.invitation
|
||||||
"groups_value": groups_value,
|
"groups_value": groups_value,
|
||||||
} : {
|
} : {
|
||||||
name_changeable : boolean;
|
name_changeable : boolean;
|
||||||
name_value : string;
|
name_value : (null | string);
|
||||||
label_changeable : boolean;
|
label_changeable : boolean;
|
||||||
label_value : string;
|
label_value : (null | string);
|
||||||
email_address_changeable : boolean;
|
email_address_changeable : boolean;
|
||||||
email_address_value : (null | string);
|
email_address_value : (null | string);
|
||||||
groups_changeable : boolean;
|
groups_changeable : boolean;
|
||||||
|
|
@ -78,15 +78,19 @@ namespace _espe.service.invitation
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"expiry": expiry = -1,
|
"expiry": expiry = -1,
|
||||||
"notification_target_url_template": notification_target_url_template = null,
|
|
||||||
"send_immediatly": send_immediatly = true,
|
"send_immediatly": send_immediatly = true,
|
||||||
} : {
|
} : {
|
||||||
expiry ?: (null | int);
|
expiry ?: (null | int);
|
||||||
notification_target_url_template ?: (null | string);
|
|
||||||
send_immediatly ?: boolean;
|
send_immediatly ?: boolean;
|
||||||
} = {
|
} = {
|
||||||
}
|
}
|
||||||
) : Promise<{id : _espe.type.invitation_id; key : _espe.type.invitation_key}>
|
) : Promise<
|
||||||
|
{
|
||||||
|
id : _espe.type.invitation_id;
|
||||||
|
key : _espe.type.invitation_key;
|
||||||
|
url : (null | string);
|
||||||
|
}
|
||||||
|
>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @todo outsource to conf
|
* @todo outsource to conf
|
||||||
|
|
@ -97,7 +101,7 @@ namespace _espe.service.invitation
|
||||||
*/
|
*/
|
||||||
const invitation_key : _espe.type.invitation_key = lib_plankton.sha256.get(
|
const invitation_key : _espe.type.invitation_key = lib_plankton.sha256.get(
|
||||||
(
|
(
|
||||||
name_value
|
(name_value ?? "")
|
||||||
+
|
+
|
||||||
"/"
|
"/"
|
||||||
+
|
+
|
||||||
|
|
@ -124,6 +128,19 @@ namespace _espe.service.invitation
|
||||||
"groups_value": groups_value,
|
"groups_value": groups_value,
|
||||||
};
|
};
|
||||||
const invitation_id : _espe.type.invitation_id = await _espe.repository.invitation.create(invitation_object);
|
const invitation_id : _espe.type.invitation_id = await _espe.repository.invitation.create(invitation_object);
|
||||||
|
const frontend_path_template_invitation_handle : (null | string) = _espe.conf.get().settings.connections.frontend_path_template_invitation_handle;
|
||||||
|
const url : (null | string) = (
|
||||||
|
(frontend_path_template_invitation_handle === null)
|
||||||
|
?
|
||||||
|
null
|
||||||
|
:
|
||||||
|
_espe.helpers.frontend_url_get(
|
||||||
|
frontend_path_template_invitation_handle,
|
||||||
|
{
|
||||||
|
"key": invitation_key,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
// send link
|
// send link
|
||||||
{
|
{
|
||||||
if (! send_immediatly)
|
if (! send_immediatly)
|
||||||
|
|
@ -140,7 +157,7 @@ namespace _espe.service.invitation
|
||||||
(email_address_value !== "")
|
(email_address_value !== "")
|
||||||
)
|
)
|
||||||
&&
|
&&
|
||||||
(notification_target_url_template !== null)
|
(url !== null)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
@ -149,31 +166,29 @@ namespace _espe.service.invitation
|
||||||
{
|
{
|
||||||
"details": {
|
"details": {
|
||||||
"provided_address": email_address_value,
|
"provided_address": email_address_value,
|
||||||
"notification_target_url_template": notification_target_url_template,
|
"url": url,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const url : (null | string) = _espe.helpers.frontend_url_get(
|
try
|
||||||
notification_target_url_template,
|
|
||||||
{
|
{
|
||||||
"key": invitation_key,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
await _espe.helpers.email_send(
|
await _espe.helpers.email_send(
|
||||||
[email_address_value],
|
[email_address_value],
|
||||||
lib_plankton.translate.get(
|
lib_plankton.string.coin(
|
||||||
"email.invitation.subject",
|
"{{head}} | {{core}}",
|
||||||
{
|
{
|
||||||
|
"head": _espe.conf.get().settings.organisation.name,
|
||||||
|
"core": lib_plankton.translate.get("email.invitation.subject"),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
lib_plankton.translate.get(
|
lib_plankton.translate.get(
|
||||||
"email.invitation.body",
|
"email.invitation.body",
|
||||||
{
|
{
|
||||||
"url": (url ?? "?"),
|
"url": (url ?? "?"),
|
||||||
|
"organisation": _espe.conf.get().settings.organisation.name,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
@ -196,10 +211,21 @@ namespace _espe.service.invitation
|
||||||
return {
|
return {
|
||||||
"id": invitation_id,
|
"id": invitation_id,
|
||||||
"key": invitation_key,
|
"key": invitation_key,
|
||||||
|
"url": url,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function remove(
|
||||||
|
id : _espe.type.invitation_id
|
||||||
|
) : Promise<void>
|
||||||
|
{
|
||||||
|
return _espe.repository.invitation.delete_(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export function get_by_id(
|
export function get_by_id(
|
||||||
|
|
@ -286,14 +312,15 @@ namespace _espe.service.invitation
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const password : string = (
|
let password_generated : boolean = (
|
||||||
(
|
(data.password === null)
|
||||||
(data.password !== null)
|
||
|
||||||
&&
|
(data.password === "")
|
||||||
(data.password !== "")
|
);
|
||||||
)
|
const password_value : string = (
|
||||||
|
password_generated
|
||||||
?
|
?
|
||||||
data.password
|
(data.password as string)
|
||||||
:
|
:
|
||||||
_espe.service.member.generate_password()
|
_espe.service.member.generate_password()
|
||||||
);
|
);
|
||||||
|
|
@ -302,7 +329,7 @@ namespace _espe.service.invitation
|
||||||
incident : string;
|
incident : string;
|
||||||
details : Record<string, any>;
|
details : Record<string, any>;
|
||||||
}
|
}
|
||||||
> = _espe.service.member.validate_password(password);
|
> = _espe.service.member.validate_password(password_value);
|
||||||
if (flaws_password.length > 0)
|
if (flaws_password.length > 0)
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
|
|
@ -364,7 +391,13 @@ namespace _espe.service.invitation
|
||||||
??
|
??
|
||||||
[]
|
[]
|
||||||
),
|
),
|
||||||
"password": password,
|
"password": password_value,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"password_generated": password_generated,
|
||||||
|
"signal_change": true,
|
||||||
|
"greet_member": true,
|
||||||
|
"notify_admins": true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,18 +145,15 @@ namespace _espe.service.member
|
||||||
*/
|
*/
|
||||||
async function send_activation_email(
|
async function send_activation_email(
|
||||||
member_object : _espe.type.member_object,
|
member_object : _espe.type.member_object,
|
||||||
options : {
|
{
|
||||||
|
"password": password = null,
|
||||||
|
} : {
|
||||||
password ?: (null | string);
|
password ?: (null | string);
|
||||||
} = {}
|
} = {}
|
||||||
) : Promise<void>
|
) : Promise<void>
|
||||||
{
|
{
|
||||||
options = Object.assign(
|
if (! member_object.enabled)
|
||||||
{
|
{
|
||||||
"password": null,
|
|
||||||
},
|
|
||||||
options
|
|
||||||
);
|
|
||||||
if (! member_object.enabled) {
|
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -185,15 +182,17 @@ namespace _espe.service.member
|
||||||
"url": (_espe.conf.get().settings.connections.login_url ?? "--"),
|
"url": (_espe.conf.get().settings.connections.login_url ?? "--"),
|
||||||
"password_info": (
|
"password_info": (
|
||||||
(
|
(
|
||||||
(options.password === undefined)
|
(password === undefined)
|
||||||
||
|
||
|
||||||
(options.password === null)
|
(password === null)
|
||||||
)
|
)
|
||||||
? ""
|
?
|
||||||
: lib_plankton.string.coin(
|
""
|
||||||
|
:
|
||||||
|
lib_plankton.string.coin(
|
||||||
lib_plankton.translate.get("email.activation.password_info"),
|
lib_plankton.translate.get("email.activation.password_info"),
|
||||||
{
|
{
|
||||||
"password": options.password,
|
"password": password,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
@ -239,7 +238,12 @@ namespace _espe.service.member
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
return _espe.repository.member.list(search_term);
|
return lib_plankton.list.sorted(
|
||||||
|
await _espe.repository.member.list(search_term),
|
||||||
|
{
|
||||||
|
"compare_element": (entry1, entry2) => (entry1.id <= entry2.id)
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -255,47 +259,6 @@ namespace _espe.service.member
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* legt ein Mitglied an
|
|
||||||
*/
|
|
||||||
export async function project(
|
|
||||||
data : {
|
|
||||||
name : string;
|
|
||||||
label : string;
|
|
||||||
email_address : (null | string);
|
|
||||||
groups : Array<_espe.type.group_id>;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"silent": silent = false,
|
|
||||||
} : {
|
|
||||||
silent ?: boolean;
|
|
||||||
} = {
|
|
||||||
}
|
|
||||||
) : Promise<_espe.type.member_id>
|
|
||||||
{
|
|
||||||
const object : _espe.type.member_object = {
|
|
||||||
"name": data.name,
|
|
||||||
"label": data.label,
|
|
||||||
"email_address": data.email_address,
|
|
||||||
"groups": data.groups,
|
|
||||||
"enabled": true,
|
|
||||||
"password_image": null,
|
|
||||||
"password_change_last_attempt": null,
|
|
||||||
"password_change_token": null,
|
|
||||||
};
|
|
||||||
const id : _espe.type.member_id = await _espe.repository.member.create(object);
|
|
||||||
if (silent)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
signal_change();
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* legt ein Mitglied an
|
* legt ein Mitglied an
|
||||||
*/
|
*/
|
||||||
|
|
@ -308,9 +271,15 @@ namespace _espe.service.member
|
||||||
password : string;
|
password : string;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"silent": silent = false,
|
"password_generated": password_generated = false,
|
||||||
|
"signal_change": flag_signal_change = false,
|
||||||
|
"greet_member": flag_greet_member = false,
|
||||||
|
"notify_admins": flag_notify_admins = false,
|
||||||
} : {
|
} : {
|
||||||
silent ?: boolean;
|
password_generated ?: boolean;
|
||||||
|
signal_change ?: boolean;
|
||||||
|
greet_member ?: boolean;
|
||||||
|
notify_admins ?: boolean;
|
||||||
} = {
|
} = {
|
||||||
}
|
}
|
||||||
) : Promise<_espe.type.member_id>
|
) : Promise<_espe.type.member_id>
|
||||||
|
|
@ -326,7 +295,9 @@ namespace _espe.service.member
|
||||||
"password_change_token": null,
|
"password_change_token": null,
|
||||||
};
|
};
|
||||||
const id : _espe.type.member_id = await _espe.repository.member.create(object);
|
const id : _espe.type.member_id = await _espe.repository.member.create(object);
|
||||||
if (silent)
|
// change
|
||||||
|
{
|
||||||
|
if (! flag_signal_change)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
@ -334,63 +305,50 @@ namespace _espe.service.member
|
||||||
{
|
{
|
||||||
signal_change();
|
signal_change();
|
||||||
}
|
}
|
||||||
return id;
|
|
||||||
}
|
}
|
||||||
|
// greet member
|
||||||
|
|
||||||
/**
|
|
||||||
* sendet an ein Mitglied eine E-Mail mit Aufforderung zur Registrierung
|
|
||||||
*/
|
|
||||||
export async function summon(
|
|
||||||
member_id : _espe.type.member_id,
|
|
||||||
url_template : string
|
|
||||||
) : Promise<(null | string)>
|
|
||||||
{
|
{
|
||||||
_espe.helpers.frontend_url_check();
|
if (! flag_greet_member)
|
||||||
const member_object : _espe.type.member_object = await get(member_id);
|
|
||||||
if (member_object.email_address === null)
|
|
||||||
{
|
{
|
||||||
return null;
|
// do nothing
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const url : (null | string) = _espe.helpers.frontend_url_get(
|
await send_activation_email(
|
||||||
url_template,
|
object,
|
||||||
{
|
{
|
||||||
"verification": await _espe.helpers.verification_get(member_id),
|
"password": (password_generated ? data.password : null),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (url === null) {
|
}
|
||||||
|
}
|
||||||
|
// notify admins
|
||||||
|
{
|
||||||
|
if (! flag_notify_admins)
|
||||||
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
await _espe.helpers.email_send(
|
{
|
||||||
[
|
_espe.service.admin.notify_all(
|
||||||
member_object.email_address,
|
|
||||||
],
|
|
||||||
lib_plankton.string.coin(
|
lib_plankton.string.coin(
|
||||||
"{{head}} | {{core}}",
|
"{{head}} | {{core}}",
|
||||||
{
|
{
|
||||||
"head": _espe.conf.get().settings.organisation.name,
|
"head": _espe.conf.get().settings.organisation.name,
|
||||||
"core": lib_plankton.translate.get("email.summon.subject"),
|
"core": lib_plankton.translate.get("email.registration.subject"),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
lib_plankton.string.coin(
|
lib_plankton.string.coin(
|
||||||
lib_plankton.translate.get("email.summon.body"),
|
lib_plankton.translate.get("email.registration.body"),
|
||||||
{
|
{
|
||||||
"name": name_display(member_object),
|
"name": object.name,
|
||||||
"url": url,
|
"label": object.label,
|
||||||
"remark": (
|
|
||||||
(_espe.conf.get().settings.summon_email.remark === null)
|
|
||||||
? ""
|
|
||||||
: (_espe.conf.get().settings.summon_email.remark + "\n\n")
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return url;
|
|
||||||
}
|
}
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,9 +235,6 @@
|
||||||
"settings": {
|
"settings": {
|
||||||
"organisation": {
|
"organisation": {
|
||||||
"domain": "testdomain.org"
|
"domain": "testdomain.org"
|
||||||
},
|
|
||||||
"misc": {
|
|
||||||
"prefix_for_veiled_email_addresses": "wicht-"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ 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)
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ ${dir_temp}/espe-core.js ${dir_temp}/espe-core.d.ts: \
|
||||||
${dir_source}/api/actions/invitation_list.ts \
|
${dir_source}/api/actions/invitation_list.ts \
|
||||||
${dir_source}/api/actions/invitation_read.ts \
|
${dir_source}/api/actions/invitation_read.ts \
|
||||||
${dir_source}/api/actions/invitation_create.ts \
|
${dir_source}/api/actions/invitation_create.ts \
|
||||||
|
${dir_source}/api/actions/invitation_delete.ts \
|
||||||
${dir_source}/api/actions/invitation_examine.ts \
|
${dir_source}/api/actions/invitation_examine.ts \
|
||||||
${dir_source}/api/actions/invitation_accept.ts \
|
${dir_source}/api/actions/invitation_accept.ts \
|
||||||
${dir_source}/api/functions.ts \
|
${dir_source}/api/functions.ts \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue