Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【优化】查询部门(list_departments)接口,指定查询full_name返回警告 #937

Open
Canway-shiisa opened this issue Mar 2, 2023 · 1 comment
Assignees
Labels
canway 需求来源为嘉为侧 Layer: api Api module related Type: bug Something isn't working

Comments

@Canway-shiisa
Copy link
Contributor

Canway-shiisa commented Mar 2, 2023

异常描述
调用list_departments接口的时候,指定返回full_name字段会返回异常

重现方法

  • 不带任何字段查询来调用该接口,结果带有full_name:
    image
  • 带有full_name进行查询,不允许:
    企业微信截图_f95256e2-0344-4bf1-afe8-d912fb9dc0ed
    =》这种结果让接口调用者特别疑惑

期望行为
可以正常指定full_name进行返回

版本
用户管理最新版仍存在该问题

额外信息
这里导致这个问题的原因:

  • full_name不属于用户表存储的字段,只是一个特殊的拼接属性
  • 这个接口的返回中做了字段检查,检测指定字段是否属于数据库字段,由于full_name不属于,所以会发生异常
    def _check_fields(self, fields):
@wklken
Copy link
Collaborator

wklken commented Mar 2, 2023

AdvancedListAPIView 是所有/api/v2共用的, 目前的原则是能不动就不动(复杂度过高, 变更风险比较大)

@wklken wklken added Type: bug Something isn't working Layer: api Api module related labels Mar 2, 2023
@Canway-shiisa Canway-shiisa added the canway 需求来源为嘉为侧 label Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
canway 需求来源为嘉为侧 Layer: api Api module related Type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants