ownership

This commit is contained in:
Julian Krauser 2024-10-07 18:09:27 +02:00
parent 72fb6fbc20
commit e2b46becf0
13 changed files with 79 additions and 13 deletions

View file

@ -124,23 +124,17 @@ export async function finishInvite(req: Request, res: Response, grantAdmin: bool
lastname: lastname,
mail: mail,
secret: secret,
isOwner: grantAdmin,
};
let id = await UserCommandHandler.create(createUser);
if (grantAdmin) {
let createPermission: CreateUserPermissionCommand = {
permission: "*",
userId: id,
};
await UserPermissionCommandHandler.create(createPermission);
}
let jwtData: JWTToken = {
userId: id,
mail: mail,
username: username,
firstname: firstname,
lastname: lastname,
isOwner: grantAdmin,
permissions: {
...(grantAdmin ? { admin: true } : {}),
},