mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-07 02:10:23 +00:00
perf: Setting user attributes is invalid
This commit is contained in:
@@ -84,7 +84,6 @@ class FeiShu(RequestMixin):
|
||||
非业务数据导致的错误直接抛异常,说明是系统配置错误,业务代码不用理会
|
||||
"""
|
||||
requests_cls = FeishuRequests
|
||||
attributes = settings.FEISHU_RENAME_ATTRIBUTES
|
||||
|
||||
def __init__(self, app_id, app_secret, timeout=None):
|
||||
self._app_id = app_id or ''
|
||||
@@ -97,6 +96,10 @@ class FeiShu(RequestMixin):
|
||||
)
|
||||
self.url_instance = self._requests.url_instance
|
||||
|
||||
@property
|
||||
def attributes(self):
|
||||
return settings.FEISHU_RENAME_ATTRIBUTES
|
||||
|
||||
def get_user_id_by_code(self, code):
|
||||
# https://open.feishu.cn/document/ukTMukTMukTM/uEDO4UjLxgDO14SM4gTN
|
||||
|
||||
@@ -138,8 +141,8 @@ class FeiShu(RequestMixin):
|
||||
return invalid_users
|
||||
|
||||
@staticmethod
|
||||
def default_user_detail(data):
|
||||
username = data['user_id']
|
||||
def default_user_detail(data, user_id):
|
||||
username = data.get('user_id', user_id)
|
||||
name = data.get('name', username)
|
||||
email = data.get('email') or data.get('enterprise_email')
|
||||
email = construct_user_email(username, email)
|
||||
@@ -152,6 +155,6 @@ class FeiShu(RequestMixin):
|
||||
data = kwargs['other_info']
|
||||
data['user_id'] = user_id
|
||||
info = flatten_dict(data)
|
||||
default_detail = self.default_user_detail(data)
|
||||
default_detail = self.default_user_detail(data, user_id)
|
||||
detail = map_attributes(default_detail, info, self.attributes)
|
||||
return detail
|
||||
|
Reference in New Issue
Block a user