Two authz behaviours were hard-coded on Platform.QQBOT/TELEGRAM/... in gateway/authz_mixin.py (_GROUP_CHAT_ENV, _ALLOWLIST_SUPPRESSES_PAIRING), so a plugin-registered platform could not get them and removing the bundled QQ adapter would silently drop QQ_GROUP_ALLOWED_USERS gating and change pairing. PlatformEntry gains group_allowed_chats_env and allowlist_suppresses_pairing; authz_mixin reads them through authz_field (live entry, else the bundled gateway_env.AUTHZ). Every bundled platform that was in the old tables declares them in its AUTHZ, so behaviour is unchanged.
22 lines
831 B
Python
22 lines
831 B
Python
"""DingTalk env -> gateway config bridge (``PlatformEntry.env_overrides``)."""
|
|
|
|
from gateway.config import Platform
|
|
from gateway.platform_env import EnvCred
|
|
|
|
ENV_ENABLE_CREDENTIALS = ("DINGTALK_CLIENT_ID", "DINGTALK_CLIENT_SECRET")
|
|
ENV_OVERRIDES = (
|
|
EnvCred(
|
|
Platform.DINGTALK, ("DINGTALK_CLIENT_ID", "DINGTALK_CLIENT_SECRET"),
|
|
fixed=(("client_id", "DINGTALK_CLIENT_ID"), ("client_secret", "DINGTALK_CLIENT_SECRET")),
|
|
home="DINGTALK_HOME_CHANNEL",
|
|
),
|
|
)
|
|
|
|
# Authorization env names (``PlatformEntry`` fields). Core reads them from this file when the
|
|
# live entry lacks them: a user plugin overriding this platform, safe mode, the plugin disabled.
|
|
AUTHZ = {
|
|
"allowed_users_env": "DINGTALK_ALLOWED_USERS",
|
|
"allow_all_env": "DINGTALK_ALLOW_ALL_USERS",
|
|
"allowlist_suppresses_pairing": True,
|
|
}
|