如题,获取当前应用可使用的知识库这个接口存在问题!
对于团队管理,当A用户将B用户添加到自己的团队,然后A用户将自己的知识库使用权,赋予给B用户
B用户创建应用时是无法选择A用户赋予自己使用权的知识库,查看代码后得知
def list_dataset(self, with_valid=True):
if with_valid:
self.is_valid(raise_exception=True)
application = QuerySet(Application).get(id=self.data.get("application_id"))
return select_list(get_file_content(
os.path.join(PROJECT_DIR, "apps", "application", 'sql', 'list_application_dataset.sql')),
[self.data.get('user_id') if self.data.get('user_id') == str(application.user_id) else None,
application.user_id, self.data.get('user_id')])
这行代码对应的sql查询语句:
SELECT
*
FROM
dataset
WHERE
user_id = %s UNION
SELECT
*
FROM
dataset
WHERE
“id” IN (
SELECT
team_member_permission.target
FROM
team_member team_member
LEFT JOIN team_member_permission team_member_permission ON team_member_permission.member_id = team_member.“id”
WHERE
( “team_member_permission”.“auth_target_type” = ‘DATASET’ AND “team_member_permission”.“operate”::text[] @> ARRAY[‘USE’] AND team_member.team_id = %s AND team_member.user_id =%s )
)
逻辑上有问题。