无权限的知识库系统
This commit is contained in:
parent
5f09ef3705
commit
d13b21e284
@ -108,14 +108,8 @@ class KnowledgeBase(models.Model):
|
||||
|
||||
def clean(self):
|
||||
"""验证知识库类型与创建者权限是否匹配"""
|
||||
try:
|
||||
user = User.objects.get(id=self.user_id)
|
||||
if user.role == 'member' and self.type != 'private':
|
||||
raise ValidationError('组员只能创建私人知识库')
|
||||
if user.role == 'leader' and self.type not in ['member', 'private']:
|
||||
raise ValidationError('组长只能创建成员级或私人知识库')
|
||||
except User.DoesNotExist:
|
||||
raise ValidationError('创建者不存在')
|
||||
# 移除所有权限验证,允许任何用户创建任何类型知识库
|
||||
pass
|
||||
|
||||
def to_response_dict(self):
|
||||
"""转换为API响应格式"""
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,7 @@ urlpatterns = [
|
||||
path('api/chat-history/', include('apps.chat.urls')),
|
||||
path('api/gmail/', include('apps.gmail.urls')),
|
||||
path('api/feishu/', include('apps.feishu.urls')),
|
||||
path('api/knowledge-bases/', include('apps.knowledge_base.urls')),
|
||||
]
|
||||
|
||||
# 在开发环境中提供媒体文件服务
|
||||
|
Loading…
Reference in New Issue
Block a user