浏览代码

Fix: the bug that allows regular users to add unregistered users to the workspace. (#328)

tags/0.3.2
Columbus 2 年前
父节点
当前提交
5943385d42
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5
    3
      api/services/account_service.py

+ 5
- 3
api/services/account_service.py 查看文件

@@ -267,9 +267,10 @@ class TenantService:
}
if action not in ['add', 'remove', 'update']:
raise InvalidActionError("Invalid action.")

if operator.id == member.id:
raise CannotOperateSelfError("Cannot operate self.")
if member:
if operator.id == member.id:
raise CannotOperateSelfError("Cannot operate self.")

ta_operator = TenantAccountJoin.query.filter_by(
tenant_id=tenant.id,
@@ -365,6 +366,7 @@ class RegisterService:
account = Account.query.filter_by(email=email).first()

if not account:
TenantService.check_member_permission(tenant, inviter, None, 'add')
name = email.split('@')[0]
account = AccountService.create_account(email, name)
account.status = AccountStatus.PENDING.value

正在加载...
取消
保存