Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions backend/apps/datasource/crud/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,17 +384,19 @@ def get_table_schema(session: SessionDep, current_user: CurrentUser, ds: CoreDat
else:
schema_table += f", {table_comment}\n[\n"

field_list = []
for field in obj.fields:
field_comment = ''
if field.custom_comment:
field_comment = field.custom_comment.strip()
if field_comment == '':
field_list.append(f"({field.field_name}:{field.field_type})")
else:
field_list.append(f"({field.field_name}:{field.field_type}, {field_comment})")
schema_table += ",\n".join(field_list)
if obj.fields:
field_list = []
for field in obj.fields:
field_comment = ''
if field.custom_comment:
field_comment = field.custom_comment.strip()
if field_comment == '':
field_list.append(f"({field.field_name}:{field.field_type})")
else:
field_list.append(f"({field.field_name}:{field.field_type}, {field_comment})")
schema_table += ",\n".join(field_list)
schema_table += '\n]\n'

t_obj = {"id": obj.table.id, "schema_table": schema_table}
tables.append(t_obj)
all_tables.append(t_obj)
Expand Down
2 changes: 2 additions & 0 deletions backend/apps/datasource/crud/permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def get_row_permission_filters(session: SessionDep, current_user: CurrentUser, d
if p_list is not None and u_list is not None and permission.id in p_list and (
current_user.id in u_list or f'{current_user.id}' in u_list):
flag = True
break
if flag:
res.append(transRecord2DTO(session, permission))
where_str = transFilterTree(session, res, ds)
Expand Down Expand Up @@ -64,6 +65,7 @@ def get_column_permission_fields(session: SessionDep, current_user: CurrentUser,
if p_list is not None and u_list is not None and permission.id in p_list and (
current_user.id in u_list or f'{current_user.id}' in u_list):
flag = True
break
if flag:
permission_list = json.loads(permission.permissions)
fields = filter_list(fields, permission_list)
Expand Down