perf: Support WeCom DingTalk FeiShu Lark Slack attribute mapping

This commit is contained in:
feng
2024-07-30 16:33:42 +08:00
committed by Bryan
parent 9825f9fbd2
commit 8d83c953d3
12 changed files with 122 additions and 37 deletions

View File

@@ -245,6 +245,26 @@ def construct_user_email(username, email, email_suffix=''):
return email or default
def flatten_dict(d, parent_key='', sep='.'):
items = {}
for k, v in d.items():
new_key = f"{parent_key}{sep}{k}" if parent_key else k
if isinstance(v, dict):
items.update(flatten_dict(v, new_key, sep=sep))
else:
items[new_key] = v
return items
def map_attributes(default_profile, profile, attributes):
detail = default_profile
for local_name, remote_name in attributes.items():
value = profile.get(remote_name)
if value:
detail[local_name] = value
return detail
def get_current_org_members():
from orgs.utils import current_org
return current_org.get_members()