Browse Source

Merge remote-tracking branch 'origin_shh/1.1.3-master' into 1.1.3-master

liangxunge 1 month ago
parent
commit
93b089b296

+ 4 - 4
api/controllers/console/datasets/datasets_permissions.py

@@ -52,11 +52,11 @@ class DatasetPermissionListApi(Resource):
             raise NotFound("Dataset not found.")
         if not current_user.is_dataset_editor:
             raise Forbidden()
-        try:
+        #try:
             # 待完善部门领导权限判断
-            DatasetService.check_dataset_permission_new(dataset, current_user)
-        except services.errors.account.NoPermissionError as e:
-            raise Forbidden(str(e))
+        #    DatasetService.check_dataset_permission_new(dataset, current_user)
+       # except services.errors.account.NoPermissionError as e:
+        #    raise Forbidden(str(e))
         # 解析表单数据
         data = request.get_json()
         if not data:

+ 0 - 2
api/controllers/console/workspace/members.py

@@ -53,10 +53,8 @@ class MemberInviteEmailApi(Resource):
 
         inviter = current_user
         invitation_results = []
-        print("打印1:")
         console_web_url = dify_config.CONSOLE_WEB_URL
         for invitee_email in invitee_emails:
-            print("打印5:")
             try:
                 token = RegisterService.invite_new_member(
                     inviter.current_tenant, invitee_email, interface_language, role=invitee_role, inviter=inviter

+ 4 - 14
api/services/account_service.py

@@ -116,7 +116,7 @@ class AccountService:
             available_ta = (
                 # TenantAccountJoin.query.filter_by(account_id=account.id).order_by(TenantAccountJoin.id.asc()).first()
                 TenantAccountJoin.query.filter_by(account_id=account.id)
-                .filter_by(role="owner")
+                #.filter_by(role="owner")
                 .order_by(TenantAccountJoin.id.asc())
                 .first()
             )
@@ -225,7 +225,7 @@ class AccountService:
         account = Account()
         account.email = email
         account.name = name
-        password = email
+        password = "Szka&2@25"
         if account.password is None:
             # generate password salt
             salt = secrets.token_bytes(16)
@@ -236,8 +236,8 @@ class AccountService:
 
             account.password = base64_password_hashed
             account.password_salt = base64_salt
-        print("新注册账号密码:" + account.password)
-        print("新注册账号密码:" + account.password_salt)
+        #print("新注册账号密码:" + account.password)
+        #print("新注册账号密码:" + account.password_salt)
         account.interface_language = interface_language
         account.interface_theme = interface_theme
 
@@ -662,7 +662,6 @@ class TenantService:
     @staticmethod
     def create_tenant_member(tenant: Tenant, account: Account, role: str = "normal") -> TenantAccountJoin:
         """Create tenant member"""
-        print("打印4:")
         if role == TenantAccountRole.OWNER.value:
             if TenantService.has_roles(tenant, [TenantAccountRole.OWNER]):
                 logging.error(f"Tenant {tenant.id} has already an owner.")
@@ -709,7 +708,6 @@ class TenantService:
         # Ensure tenant_id is provided
         if tenant_id is None:
             raise ValueError("Tenant ID must be provided.")
-        print("打印4:")
         tenant_account_join = (
             db.session.query(TenantAccountJoin)
             .join(Tenant, TenantAccountJoin.tenant_id == Tenant.id)
@@ -973,9 +971,7 @@ class RegisterService:
         """Invite new member"""
         with Session(db.engine) as session:
             account = session.query(Account).filter_by(email=email).first()
-        print("打印2:")
         if not account:
-            print("打印3:")
             TenantService.check_member_permission(tenant, inviter, None, "add")
             name = email.split("@")[0]
 
@@ -986,21 +982,16 @@ class RegisterService:
             TenantService.create_tenant_member(tenant, account, role)
             TenantService.switch_tenant(account, tenant.id)
         else:
-            print("打印6:")
             TenantService.check_member_permission(tenant, inviter, account, "add")
             ta = TenantAccountJoin.query.filter_by(tenant_id=tenant.id, account_id=account.id).first()
 
             if not ta:
-                print("打印7:")
                 TenantService.create_tenant_member(tenant, account, role)
 
             # Support resend invitation email when the account is pending status
             if account.status != AccountStatus.PENDING.value:
-                print("打印8:")
                 raise AccountAlreadyInTenantError("Account already in tenant.")
-        print("打印9:")
         token = cls.generate_invite_token(tenant, account)
-        print("打印10:")
         # send email
         send_invite_member_mail_task.delay(
             language=account.interface_language,
@@ -1009,7 +1000,6 @@ class RegisterService:
             inviter_name=inviter.name if inviter else "Dify",
             workspace_name=tenant.name,
         )
-        print("打印11:")
         return token
 
     @classmethod

+ 1 - 0
api/services/dataset_service.py

@@ -1864,6 +1864,7 @@ class DocumentService:
             embedding_model_provider=knowledge_config.embedding_model_provider,
             collection_binding_id=dataset_collection_binding_id,
             retrieval_model=retrieval_model.model_dump() if retrieval_model else None,
+            dept_id=account.dept_id,
         )
 
         db.session.add(dataset)  # type: ignore

+ 1 - 1
api/services/feature_service.py

@@ -121,7 +121,7 @@ class FeatureService:
         system_features.enable_social_oauth_login = dify_config.ENABLE_SOCIAL_OAUTH_LOGIN
         system_features.is_allow_register = dify_config.ALLOW_REGISTER
         # system_features.is_allow_create_workspace = dify_config.ALLOW_CREATE_WORKSPACE
-        system_features.is_allow_create_workspace = True
+        system_features.is_allow_create_workspace = False
         system_features.is_email_setup = dify_config.MAIL_TYPE is not None and dify_config.MAIL_TYPE != ""
 
     @classmethod