Skip to content

Commit

Permalink
支持通过环境变量指定注册用户的简档
Browse files Browse the repository at this point in the history
  • Loading branch information
baozhoutao committed Sep 20, 2024
1 parent 21228e1 commit 7a32fe7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: [email protected]
* @Date: 2022-12-02 16:53:23
* @LastEditors: [email protected]
* @LastEditTime: 2023-01-13 11:44:40
* @LastEditTime: 2024-09-20 10:51:35
* @Description:
*/
"use strict";
Expand Down Expand Up @@ -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) {
Expand All @@ -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: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: [email protected]
* @Date: 2022-12-07 14:19:57
* @LastEditors: [email protected]
* @LastEditTime: 2024-09-09 17:42:29
* @LastEditTime: 2024-09-20 10:43:52
* @Description:
*/
"use strict";
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 7a32fe7

Please sign in to comment.