From 7a32fe79d99c41ad8658f3e9a913814092869c60 Mon Sep 17 00:00:00 2001 From: baozhoutao Date: Fri, 20 Sep 2024 10:52:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=80=9A=E8=BF=87=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=98=E9=87=8F=E6=8C=87=E5=AE=9A=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9A=84=E7=AE=80=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/default/services/spaces.service.js | 8 ++++++-- .../main/default/triggers/space_users.trigger.js | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/services/standard-space/main/default/services/spaces.service.js b/services/standard-space/main/default/services/spaces.service.js index 2946cf8c9d..00e05ead40 100644 --- a/services/standard-space/main/default/services/spaces.service.js +++ b/services/standard-space/main/default/services/spaces.service.js @@ -2,7 +2,7 @@ * @Author: sunhaolin@hotoa.com * @Date: 2022-12-02 16:53:23 * @LastEditors: baozhoutao@steedos.com - * @LastEditTime: 2023-01-13 11:44:40 + * @LastEditTime: 2024-09-20 10:51:35 * @Description: */ "use strict"; @@ -190,7 +190,7 @@ module.exports = { return; } - let profile = 'user'; + let profile = process.env.STEEDOS_TENANT_REGISTER_DEFAULT_PROFILE || 'user'; const space = await spaceObj.findOne(spaceId, { fields: ['default_profile', 'default_organization'] }) if (space) { @@ -202,6 +202,10 @@ module.exports = { } } + if(process.env.STEEDOS_TENANT_REGISTER_PROFILE ){ + profile = process.env.STEEDOS_TENANT_REGISTER_PROFILE; + } + if (!organization_id) { const rootOrg = (await orgObj.find({ filters: [ diff --git a/services/standard-space/main/default/triggers/space_users.trigger.js b/services/standard-space/main/default/triggers/space_users.trigger.js index c394d8f261..25a0761525 100644 --- a/services/standard-space/main/default/triggers/space_users.trigger.js +++ b/services/standard-space/main/default/triggers/space_users.trigger.js @@ -2,7 +2,7 @@ * @Author: sunhaolin@hotoa.com * @Date: 2022-12-07 14:19:57 * @LastEditors: baozhoutao@steedos.com - * @LastEditTime: 2024-09-09 17:42:29 + * @LastEditTime: 2024-09-20 10:43:52 * @Description: */ "use strict"; @@ -401,7 +401,7 @@ module.exports = { } if (doc.profile) { const isSpaceOwner = await broker.call('spaces.isSpaceOwner', { spaceId: doc.space, userId: userId }) - if (doc.profile === 'admin' && !isSpaceOwner) { + if (doc.profile === 'admin' && !isSpaceOwner && this.userId) { throw new Error("Only the administrator can set the profile to admin"); } } else {