From c69a17a92a1e723bf30362eb3a4adae8666de9fd Mon Sep 17 00:00:00 2001 From: Felipe Trost Date: Mon, 23 Oct 2023 16:02:42 +0200 Subject: [PATCH 1/2] Add owner to processes --- src/management-system/src/backend/server/rest-api/process.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/management-system/src/backend/server/rest-api/process.js b/src/management-system/src/backend/server/rest-api/process.js index 94d594cd5..fb48f55ac 100644 --- a/src/management-system/src/backend/server/rest-api/process.js +++ b/src/management-system/src/backend/server/rest-api/process.js @@ -66,6 +66,8 @@ processRouter.post('/', isAllowed('create', 'Process'), async (req, res) => { return; } + body.owner = req.session.userId || ''; + /** @type {Ability} */ const userAbility = req.userAbility; From c6b961fd3978a495bd4bfc44c035b768194e645b Mon Sep 17 00:00:00 2001 From: Felipe Trost Date: Mon, 23 Oct 2023 16:07:22 +0200 Subject: [PATCH 2/2] Narrower type for expiration --- src/management-system/src/backend/server/iam/rest-api/roles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/management-system/src/backend/server/iam/rest-api/roles.js b/src/management-system/src/backend/server/iam/rest-api/roles.js index f29014076..c01912eec 100644 --- a/src/management-system/src/backend/server/iam/rest-api/roles.js +++ b/src/management-system/src/backend/server/iam/rest-api/roles.js @@ -88,7 +88,7 @@ rolesRouter.put('/:id', validateRole, isAllowed('update', 'Role'), async (req, r try { // validateRole turns expiration into a Date, in order for the object merge // to work, we need it to be a string (type safe option in mergeIntoObject) - if (typeof role.expiration === 'object') { + if (role.expiration !== null && typeof role.expiration === 'object') { /** @type {Date} */ const expirationDate = role.expiration; role.expiration = expirationDate.toISOString();