forked from bai/curriculum-project-hub
refactor(spec): generalize Feishu to Connections
- Connections/Prelude.lean: ConnectionProvider 枚举 (当前仅飞书) - Connections/Feishu.lean: FeishuAppBinding + FeishuProfile - Connections.lean: ConnectionBinding/ConnectionProfile inductive - Organization.feishu → connections: List ConnectionBinding - User.feishu → connections: List ConnectionProfile - 删除 FeishuConnection.lean
This commit is contained in:
@@ -2,7 +2,7 @@ import Spec.System.Hierarchy
|
|||||||
import Spec.System.ProjectGroup
|
import Spec.System.ProjectGroup
|
||||||
import Spec.System.Organization
|
import Spec.System.Organization
|
||||||
import Spec.System.User
|
import Spec.System.User
|
||||||
import Spec.System.FeishuConnection
|
import Spec.System.Connections
|
||||||
import Spec.System.ProjectWorkspace
|
import Spec.System.ProjectWorkspace
|
||||||
import Spec.System.Capacity
|
import Spec.System.Capacity
|
||||||
import Spec.System.PlatformAdministration
|
import Spec.System.PlatformAdministration
|
||||||
@@ -21,7 +21,8 @@ import Spec.System.Audit
|
|||||||
**语义分歧点**:
|
**语义分歧点**:
|
||||||
|
|
||||||
- `Hierarchy` —— 三层主体:平台 → 组织 → 用户。
|
- `Hierarchy` —— 三层主体:平台 → 组织 → 用户。
|
||||||
- `User` —— 飞书绑定:登录途径,不是用户本体。
|
- `User` —— 用户创建路径(管理员直接创建;飞书注册 `OPEN`)。
|
||||||
|
- `Connections` —— 外部连接:提供商枚举(当前仅飞书) + 绑定/信息类型。
|
||||||
- `ProjectGroup` —— project↔飞书群 1:1 长生命周期绑定(ADR-0001);群是协作空间,不持锁。
|
- `ProjectGroup` —— project↔飞书群 1:1 长生命周期绑定(ADR-0001);群是协作空间,不持锁。
|
||||||
- `Organization` —— SaaS 租户(ADR-0020);project/team 单归属,TEAM grant 不跨 org;
|
- `Organization` —— SaaS 租户(ADR-0020);project/team 单归属,TEAM grant 不跨 org;
|
||||||
connection secret 信封与 fail-closed resolver(ADR-0024);
|
connection secret 信封与 fail-closed resolver(ADR-0024);
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import Spec.System.Connections.Prelude
|
||||||
|
import Spec.System.Connections.Feishu
|
||||||
|
|
||||||
|
/-!
|
||||||
|
# Connections —— 连接绑定与用户信息
|
||||||
|
|
||||||
|
组织/用户的外部连接。提供商枚举见 `Connections.Prelude`;
|
||||||
|
飞书具体类型见 `Connections.Feishu`。
|
||||||
|
-/
|
||||||
|
|
||||||
|
namespace Spec.System
|
||||||
|
|
||||||
|
|
||||||
|
/-- 组织连接绑定(`PINNED`)。 -/
|
||||||
|
inductive ConnectionBinding (I : Identifiers) where
|
||||||
|
/-- 飞书(`PINNED`)。 -/
|
||||||
|
| feishu : FeishuAppBinding I → ConnectionBinding I
|
||||||
|
|
||||||
|
/-- 用户连接信息(`PINNED`)。 -/
|
||||||
|
inductive ConnectionProfile (I : Identifiers) where
|
||||||
|
/-- 飞书(`PINNED`)。 -/
|
||||||
|
| feishu : FeishuProfile I → ConnectionProfile I
|
||||||
|
|
||||||
|
end Spec.System
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
import Spec.Prelude
|
import Spec.Prelude
|
||||||
|
|
||||||
/-!
|
/-!
|
||||||
# Feishu —— 组织飞书应用绑定与用户飞书信息
|
# Feishu —— 飞书连接
|
||||||
|
|
||||||
组织绑定一个飞书企业应用(1:1, `Option` 自带)。用户经此应用登录、调飞书 API。
|
组织绑定一个飞书企业应用(1:1)。用户经此应用登录、调飞书 API。
|
||||||
绑定是组织级;用户通过所属组织隐含获得绑定作用域。
|
|
||||||
-/
|
-/
|
||||||
|
|
||||||
namespace Spec.System
|
namespace Spec.System
|
||||||
@@ -18,7 +17,7 @@ structure FeishuAppBinding where
|
|||||||
/-- app_secret 信封引用(`PINNED`, ADR-0024)。 -/
|
/-- app_secret 信封引用(`PINNED`, ADR-0024)。 -/
|
||||||
appSecretEnvelope : I.FeishuAppSecretRef
|
appSecretEnvelope : I.FeishuAppSecretRef
|
||||||
|
|
||||||
/-- 用户的飞书信息(`PINNED`)。User 上的可选绑定载荷。 -/
|
/-- 用户的飞书信息(`PINNED`)。 -/
|
||||||
structure FeishuProfile where
|
structure FeishuProfile where
|
||||||
/-- 应用内身份(`OPEN`);调 API 的直接句柄,换应用即变。 -/
|
/-- 应用内身份(`OPEN`);调 API 的直接句柄,换应用即变。 -/
|
||||||
openId : I.FeishuOpenId
|
openId : I.FeishuOpenId
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/-!
|
||||||
|
# Connections.Prelude —— 连接提供商
|
||||||
|
|
||||||
|
用户/组织的外部身份连接。当前仅 IdP 类别(飞书)。
|
||||||
|
模型 provider connection 是独立概念,见 `Spec.System.Organization`。
|
||||||
|
-/
|
||||||
|
|
||||||
|
namespace Spec.System
|
||||||
|
|
||||||
|
/-- 连接提供商(`PINNED`;当前仅飞书,未来可扩展钉钉/企微)。 -/
|
||||||
|
inductive ConnectionProvider where
|
||||||
|
/-- 飞书(`PINNED`)。 -/
|
||||||
|
| feishu
|
||||||
|
|
||||||
|
end Spec.System
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import Spec.Prelude
|
import Spec.Prelude
|
||||||
import Spec.System.User
|
import Spec.System.Connections
|
||||||
import Spec.System.FeishuConnection
|
|
||||||
|
|
||||||
/-!
|
/-!
|
||||||
# Hierarchy —— 主体层级
|
# Hierarchy —— 主体层级
|
||||||
@@ -24,14 +23,14 @@ structure Platform where
|
|||||||
/-- 平台自有飞书应用(`PINNED`, ADR-0023)。 -/
|
/-- 平台自有飞书应用(`PINNED`, ADR-0023)。 -/
|
||||||
application : I.PlatformFeishuApplicationId
|
application : I.PlatformFeishuApplicationId
|
||||||
/-- 组织(`PINNED`, ADR-0020)。project/team 必须归属且仅归属一个 org。
|
/-- 组织(`PINNED`, ADR-0020)。project/team 必须归属且仅归属一个 org。
|
||||||
飞书应用绑定 1:1(`Option` 自带),见 `FeishuConnection`。角色/tenancy/凭据见 `Spec.System.Organization`。 -/
|
外部连接见 `Connections`。角色/tenancy/凭据见 `Spec.System.Organization`。 -/
|
||||||
structure Organization where
|
structure Organization where
|
||||||
/-- 组织标识(`OPEN` 表示)。 -/
|
/-- 组织标识(`OPEN` 表示)。 -/
|
||||||
id : I.OrganizationId
|
id : I.OrganizationId
|
||||||
/-- 飞书应用绑定(`PINNED`, 可选;1:1,每 org 至多一个)。 -/
|
/-- 外部连接(`PINNED`)。 -/
|
||||||
feishu : Option (FeishuAppBinding I)
|
connections : List (ConnectionBinding I)
|
||||||
|
|
||||||
/-- 用户(`PINNED`, 租户层独立实体)。必属一个组织。飞书绑定见 `FeishuConnection`。 -/
|
/-- 用户(`PINNED`, 租户层独立实体)。必属一个组织。外部连接见 `Connections`。 -/
|
||||||
structure User where
|
structure User where
|
||||||
/-- 用户标识(`OPEN` 表示;组织内唯一,不可改;登录用)。 -/
|
/-- 用户标识(`OPEN` 表示;组织内唯一,不可改;登录用)。 -/
|
||||||
id : I.UserId
|
id : I.UserId
|
||||||
@@ -41,7 +40,7 @@ structure User where
|
|||||||
displayName : String
|
displayName : String
|
||||||
/-- 密码哈希(`OPEN` 表示;id + 密码登录)。 -/
|
/-- 密码哈希(`OPEN` 表示;id + 密码登录)。 -/
|
||||||
passwordHash : String
|
passwordHash : String
|
||||||
/-- 飞书绑定(`PINNED`, 可选)。 -/
|
/-- 外部连接(`PINNED`)。 -/
|
||||||
feishu : Option (FeishuProfile I)
|
connections : List (ConnectionProfile I)
|
||||||
|
|
||||||
end Spec.System
|
end Spec.System
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Spec.Prelude
|
|||||||
/-!
|
/-!
|
||||||
# User —— 用户创建路径
|
# User —— 用户创建路径
|
||||||
|
|
||||||
用户实体见 `Hierarchy.User`;飞书绑定见 `Spec.System.FeishuConnection`。
|
用户实体见 `Hierarchy.User`;外部连接见 `Spec.System.Connections`。
|
||||||
|
|
||||||
用户创建当前只钉管理员直接创建;飞书自助注册→管理员审批未钉死(`OPEN`)。
|
用户创建当前只钉管理员直接创建;飞书自助注册→管理员审批未钉死(`OPEN`)。
|
||||||
-/
|
-/
|
||||||
|
|||||||
Reference in New Issue
Block a user