[int]
This commit is contained in:
parent
ebc9baa4b3
commit
0ab67447f3
11 changed files with 28 additions and 106 deletions
|
@ -2,23 +2,23 @@
|
|||
"groups": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "auto"
|
||||
"name": "Auto"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "zug"
|
||||
"name": "Zug"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "flugzeug"
|
||||
"name": "Flugzeug"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "fahrrad"
|
||||
"name": "Fahrrad"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "zu_fuß"
|
||||
"name": "zu Fuß"
|
||||
}
|
||||
],
|
||||
"admins": [
|
||||
|
|
|
@ -101,11 +101,11 @@ namespace _espe.api
|
|||
},
|
||||
"required": [
|
||||
"expiry",
|
||||
"name_mode",
|
||||
"name_changeable",
|
||||
"name_value",
|
||||
"email_address_mode",
|
||||
"email_address_changeable",
|
||||
"email_address_value",
|
||||
"groups_mode",
|
||||
"groups_changeable",
|
||||
"groups_value",
|
||||
]
|
||||
}),
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
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_member_summon(
|
||||
rest_subject : lib_plankton.rest_http.type_rest
|
||||
) : void
|
||||
{
|
||||
lib_plankton.rest_http.register<
|
||||
{
|
||||
url_template : string;
|
||||
},
|
||||
(
|
||||
null
|
||||
|
|
||||
string
|
||||
)
|
||||
>(
|
||||
rest_subject,
|
||||
lib_plankton.http.enum_method.post,
|
||||
_espe.conf.get().server.path_base + "/member/summon/:id",
|
||||
{
|
||||
"description": () => "sendet an ein Mitglied eine E-Mail mit Aufforderung zur Registrierung",
|
||||
"restriction": () => restriction_logged_in,
|
||||
"execution": () => async ({"path_parameters": path_parameters, "input": input}) => {
|
||||
if (input === null) {
|
||||
return Promise.reject(new Error("impossible"));
|
||||
}
|
||||
else {
|
||||
const member_id : _espe.type.member_id = parseInt(path_parameters["id"]);
|
||||
const url : (null | string) = await _espe.service.member.summon(member_id, input.url_template);
|
||||
|
||||
return (
|
||||
(url === null)
|
||||
? Promise.resolve({
|
||||
"status_code": 409,
|
||||
"data": null,
|
||||
})
|
||||
: Promise.resolve({
|
||||
"status_code": 200,
|
||||
"data": url,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -52,7 +52,6 @@ namespace _espe.api
|
|||
}
|
||||
// member
|
||||
{
|
||||
_espe.api.register_member_summon(rest_subject);
|
||||
_espe.api.register_member_list(rest_subject);
|
||||
_espe.api.register_member_read(rest_subject);
|
||||
_espe.api.register_member_modify(rest_subject);
|
||||
|
|
|
@ -273,7 +273,7 @@ namespace _espe.repository.member
|
|||
// groups
|
||||
const hits : Array<{key : Array<any>; preview : Record<string, any>;}> = await get_group_chest().search(
|
||||
{
|
||||
"expression": "group_id = $group_id",
|
||||
"expression": "member_id = $member_id",
|
||||
"arguments": {"member_id": id}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -623,18 +623,14 @@ namespace _espe.service.member
|
|||
* @todo check validity (e.g. username characters)
|
||||
*/
|
||||
export async function export_authelia_user_data(
|
||||
options : {
|
||||
{
|
||||
"custom_data": custom_data = null,
|
||||
} : {
|
||||
custom_data ?: (null | Array<_espe.type.member_object>);
|
||||
} = {}
|
||||
} = {
|
||||
}
|
||||
) : Promise<any>
|
||||
{
|
||||
options = Object.assign(
|
||||
{
|
||||
"custom_data": null,
|
||||
},
|
||||
options
|
||||
);
|
||||
|
||||
type type_entry = {
|
||||
disabled : boolean;
|
||||
displayname : string;
|
||||
|
@ -645,11 +641,11 @@ namespace _espe.service.member
|
|||
return lib_plankton.call.convey(
|
||||
(
|
||||
(
|
||||
(options.custom_data !== undefined)
|
||||
(custom_data !== undefined)
|
||||
&&
|
||||
(options.custom_data !== null)
|
||||
(custom_data !== null)
|
||||
)
|
||||
? (options.custom_data.map((member_object, index) => ({"id": index, "object": member_object})))
|
||||
? (custom_data.map((member_object, index) => ({"id": index, "object": member_object})))
|
||||
: await dump()
|
||||
),
|
||||
[
|
||||
|
@ -661,8 +657,6 @@ namespace _espe.service.member
|
|||
),
|
||||
(x : Array<any>) => x.filter(
|
||||
entry => (
|
||||
entry.object.registered
|
||||
&&
|
||||
(
|
||||
(entry.object.password_image !== null)
|
||||
&&
|
||||
|
@ -697,20 +691,16 @@ namespace _espe.service.member
|
|||
/**
|
||||
*/
|
||||
export async function export_authelia_user_file(
|
||||
options : {
|
||||
{
|
||||
"custom_data": custom_data = null,
|
||||
} : {
|
||||
custom_data ?: (null | Array<_espe.type.member_object>);
|
||||
} = {}
|
||||
} = {
|
||||
}
|
||||
) : Promise<string>
|
||||
{
|
||||
options = Object.assign(
|
||||
{
|
||||
"custom_data": null,
|
||||
},
|
||||
options
|
||||
);
|
||||
|
||||
const nm_yaml = require("yaml");
|
||||
return nm_yaml.stringify(await export_authelia_user_data(options));
|
||||
return nm_yaml.stringify(await export_authelia_user_data({"custom_data": custom_data}));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,18 +65,17 @@ ${dir_temp}/espe-core.js ${dir_temp}/espe-core.d.ts: \
|
|||
${dir_source}/api/actions/group_read.ts \
|
||||
${dir_source}/api/actions/group_add.ts \
|
||||
${dir_source}/api/actions/group_modify.ts \
|
||||
${dir_source}/api/actions/member_summon.ts \
|
||||
${dir_source}/api/actions/member_list.ts \
|
||||
${dir_source}/api/actions/member_read.ts \
|
||||
${dir_source}/api/actions/member_modify.ts \
|
||||
${dir_source}/api/actions/member_delete.ts \
|
||||
${dir_source}/api/actions/member_password_change_initialize.ts \
|
||||
${dir_source}/api/actions/member_password_change_execute.ts \
|
||||
${dir_source}/api/actions/invite_list.ts \
|
||||
${dir_source}/api/actions/invite_read.ts \
|
||||
${dir_source}/api/actions/invite_create.ts \
|
||||
${dir_source}/api/actions/invite_examine.ts \
|
||||
${dir_source}/api/actions/invite_accept.ts \
|
||||
${dir_source}/api/actions/invitation_list.ts \
|
||||
${dir_source}/api/actions/invitation_read.ts \
|
||||
${dir_source}/api/actions/invitation_create.ts \
|
||||
${dir_source}/api/actions/invitation_examine.ts \
|
||||
${dir_source}/api/actions/invitation_accept.ts \
|
||||
${dir_source}/api/functions.ts \
|
||||
${dir_source}/conf.ts
|
||||
@ ${cmd_log} "compile | core …"
|
||||
|
|
Loading…
Add table
Reference in a new issue