mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 05:36:02 +08:00
remove knowledge admin role (#12450)
This commit is contained in:
parent
4e6c86341d
commit
fd2bfff023
@ -86,7 +86,7 @@ class DatasetService:
|
|||||||
else:
|
else:
|
||||||
return [], 0
|
return [], 0
|
||||||
else:
|
else:
|
||||||
if user.current_role not in (TenantAccountRole.OWNER, TenantAccountRole.ADMIN):
|
if user.current_role != TenantAccountRole.OWNER:
|
||||||
# show all datasets that the user has permission to access
|
# show all datasets that the user has permission to access
|
||||||
if permitted_dataset_ids:
|
if permitted_dataset_ids:
|
||||||
query = query.filter(
|
query = query.filter(
|
||||||
@ -382,7 +382,7 @@ class DatasetService:
|
|||||||
if dataset.tenant_id != user.current_tenant_id:
|
if dataset.tenant_id != user.current_tenant_id:
|
||||||
logging.debug(f"User {user.id} does not have permission to access dataset {dataset.id}")
|
logging.debug(f"User {user.id} does not have permission to access dataset {dataset.id}")
|
||||||
raise NoPermissionError("You do not have permission to access this dataset.")
|
raise NoPermissionError("You do not have permission to access this dataset.")
|
||||||
if user.current_role not in (TenantAccountRole.OWNER, TenantAccountRole.ADMIN):
|
if user.current_role != TenantAccountRole.OWNER:
|
||||||
if dataset.permission == DatasetPermissionEnum.ONLY_ME and dataset.created_by != user.id:
|
if dataset.permission == DatasetPermissionEnum.ONLY_ME and dataset.created_by != user.id:
|
||||||
logging.debug(f"User {user.id} does not have permission to access dataset {dataset.id}")
|
logging.debug(f"User {user.id} does not have permission to access dataset {dataset.id}")
|
||||||
raise NoPermissionError("You do not have permission to access this dataset.")
|
raise NoPermissionError("You do not have permission to access this dataset.")
|
||||||
@ -404,7 +404,7 @@ class DatasetService:
|
|||||||
if not user:
|
if not user:
|
||||||
raise ValueError("User not found")
|
raise ValueError("User not found")
|
||||||
|
|
||||||
if user.current_role not in (TenantAccountRole.OWNER, TenantAccountRole.ADMIN):
|
if user.current_role != TenantAccountRole.OWNER:
|
||||||
if dataset.permission == DatasetPermissionEnum.ONLY_ME:
|
if dataset.permission == DatasetPermissionEnum.ONLY_ME:
|
||||||
if dataset.created_by != user.id:
|
if dataset.created_by != user.id:
|
||||||
raise NoPermissionError("You do not have permission to access this dataset.")
|
raise NoPermissionError("You do not have permission to access this dataset.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user