PROP-005 Rev 1.0 · 08 Jul 2026

Cane Agency · Change Proposal (ACCEPTED — applied graph-first as spec v6.0)สถาบันอ้อย · ข้อเสนอการเปลี่ยนแปลง (อนุมัติแล้ว — นำไปใช้แบบ graph (กราฟ) ก่อนเป็น spec (สเปก) v6.0)

Federated Identity & Multi-Capacity Parties — one platform identity, every role a party really playsอัตลักษณ์แบบสหพันธ์และผู้เล่นหลายบทบาท — อัตลักษณ์เดียวบน platform ครอบคลุมทุกบทบาทที่ผู้เล่นทำจริง

Documentเอกสาร
PROP-005
Statusสถานะ
ACCEPTED — applied v6.0อนุมัติแล้ว — ใช้ v6.0
Suffix codeรหัสต่อท้าย
FED
Updatedปรับปรุงล่าสุด
08 Jul 2026
Depends onขึ้นกับ
PROP-003 (FIN) + PROP-004 (CEC) — accepted together or before (Section 13)PROP-003 (FIN) + PROP-004 (CEC) — อนุมัติพร้อมกันหรือก่อนหน้า (ข้อ 13)
Affectsกระทบ
Graph, APP, PRD, ERD, DDD, PWF, UIX, SPEC-INDEX, every PROP-003/04 identity section — the widest-reaching proposal to dategraph, APP, PRD, ERD, DDD, PWF, UIX, SPEC-INDEX และทุกส่วนอัตลักษณ์ของ PROP-003/04 — ข้อเสนอที่กระทบกว้างที่สุดจนถึงปัจจุบัน
New surfaceช่องทางใช้งานใหม่
account (federation console — profile, parties, members, roles, consents)(console (คอนโซล) สหพันธ์ — โปรไฟล์ ผู้เล่น สมาชิก บทบาท ความยินยอม)
New entitiesEntity ใหม่
Person · Party · PartyCapacity · Membership · SurfaceRoleGrant · PermissionCatalog · RolePermission · ViewAsSession
New contextบริบทใหม่
federation (absorbs network_identity)(ควบรวม network_identity)
Exhibitเอกสารแนบ
prop-005-entitlement-matrix.html (interactive resolver)(ตัวจำลองสิทธิ์แบบโต้ตอบ)

1. Summary1. สรุปข้อเสนอ

Statusสถานะ This is a draft. Nothing here is binding until accepted and mirrored graph-first into the spec series (see drafts/CLAUDE.md). It replaces the platform's founding assumption — one account, one customer group — with a federated identity model: a person signs in once; a party (an individual or an organization) holds a set of capacities (grower, quota, mill, contractor, bank, government); capacities compile into surface entitlements; a six-layer access model resolves everything else. Customer groups stop being an account property and become party capacities. The design adapts the proven RiverSync federation specification [R1] and stands on the open-source wangkanai/federation OAuth 2.1 / OIDC stack [R2] over ASP.NET Core Identity [R3]. Suffix code FED. นี่คือร่าง ยังไม่มีผลผูกพันจนกว่าจะได้รับอนุมัติและสะท้อนแบบ graph ก่อนเข้าสู่ชุด spec (ดู drafts/CLAUDE.md) ข้อเสนอนี้แทนที่สมมติฐานก่อตั้งของ platform — หนึ่งบัญชี หนึ่งกลุ่มลูกค้า — ด้วยmodel (โมเดล) อัตลักษณ์แบบสหพันธ์ (federation): บุคคลลงชื่อเข้าใช้ครั้งเดียว; ผู้เล่น (party) — บุคคลหรือองค์กร — ถือชุดบทบาทความสามารถ (capacity) (ชาวไร่ โควต้า โรงงาน ผู้รับเหมา ธนาคาร หน่วยงานรัฐ); capacity คอมไพล์เป็นสิทธิ์เข้าช่องทางใช้งาน (surface); model การเข้าถึงหกชั้นตัดสินที่เหลือทั้งหมด กลุ่มลูกค้าเลิกเป็นคุณสมบัติของบัญชี และกลายเป็น capacity ของผู้เล่น การออกแบบดัดแปลงจาก spec สหพันธ์ของ RiverSync ที่พิสูจน์แล้ว [R1] และยืนบนสแต็ก OAuth 2.1 / OIDC โอเพนซอร์ส wangkanai/federation [R2] เหนือ ASP.NET Core Identity [R3] รหัสต่อท้าย FED

The trigger is field reality: in the Thai sugar industry the same actor routinely plays several parts. A mill runs a machinery service arm. A quota farmer operates a tractor pool for the network — and grows cane of his own. A cane farmer buys a spray drone and contracts for neighbors. PROP-004 modeled the contractor as a sixth customer group and patched the overlap with an "affiliated tenant" workaround (PROP-004 Q3); one season of design later the patch is clearly the wrong shape. The right shape — proven in production-grade form by the RiverSync platform [R1] — is that the extra role widens the party's entitlements; it never splits the party's identity.

แรงผลักคือความจริงภาคสนาม: ในอุตสาหกรรมน้ำตาลไทย ผู้เล่นเดียวกันสวมหลายบทบาทเป็นเรื่องปกติ โรงงานมีหน่วยบริการเครื่องจักรของตัวเอง หัวหน้าโควต้ามีกองรถแทรกเตอร์ให้เครือข่าย — และปลูกอ้อยของตนเองด้วย ลูกไร่ซื้อโดรนพ่นยาแล้วรับจ้างเพื่อนบ้าน PROP-004 model ผู้รับเหมาเป็นกลุ่มลูกค้าที่หก และปะรอยทับซ้อนด้วยวิธี "tenant ในเครือ" (PROP-004 Q3) — ผ่านการออกแบบหนึ่งฤดู รอยปะนั้นผิดรูปชัดเจน รูปที่ถูก — พิสูจน์แล้วในระดับ production โดย platform RiverSync [R1] — คือ บทบาทที่เพิ่มขึ้นขยายสิทธิ์ของผู้เล่น แต่ไม่มีวันฉีกอัตลักษณ์ของผู้เล่น

Principleหลักการ Identity is scarce; roles are plentiful. One person, one sign-in (NFR-14). One party, one record, however many capacities it earns. Every domain record the platform already holds — farmers, quotas, deliveries, work orders, loans, books — keeps its identifier and its history; PROP-005 changes who is allowed to be several things at once, not what those things are. Where this proposal deliberately diverges from its RiverSync source (person-level identity across organizations, Section 5.2; capacity disclosure in the marketplace, Section 8.4), the divergence is stated and argued, never silent. อัตลักษณ์ต้องมีน้อย บทบาทมีได้มาก หนึ่งบุคคล หนึ่งการลงชื่อเข้าใช้ (NFR-14) หนึ่งผู้เล่น หนึ่งเรกคอร์ด ไม่ว่าจะได้รับกี่ capacity ทุกเรกคอร์ดโดเมนที่ platform ถืออยู่ — ชาวไร่ โควตา การส่งมอบ ใบสั่งงาน สินเชื่อ บัญชี — คงรหัสและประวัติเดิม PROP-005 เปลี่ยนว่าใครได้รับอนุญาตให้เป็นหลายสิ่งพร้อมกัน ไม่ได้เปลี่ยนว่าสิ่งเหล่านั้นคืออะไร จุดที่ข้อเสนอนี้จงใจแตกต่างจากต้นแบบ RiverSync (อัตลักษณ์ระดับบุคคลข้ามองค์กร ข้อ 5.2; การเปิดเผย capacity ในตลาด ข้อ 8.4) จะระบุและให้เหตุผลเสมอ ไม่แตกต่างแบบเงียบ ๆ

2. Background2. ภูมิหลัง

2.1 The blurred-role reality — five combinations that already exist2.1 ความจริงของบทบาทที่พร่าเลือน — ห้าบทบาทผสมที่มีอยู่จริงแล้ว

Real actorผู้เล่นจริงCapacities held at onceCapacity ที่ถือพร้อมกันWhat the single-group model forces todaymodel กลุ่มเดียวบังคับอะไรวันนี้
Mill with a service armโรงงานที่มีหน่วยบริการmill + contractorA second "affiliated" contractor tenant (PROP-004 Q3) — duplicate org profile, duplicate members, split audit trail.tenant contractor "ในเครือ" ใบที่สอง (PROP-004 Q3) — โปรไฟล์องค์กรซ้ำ สมาชิกซ้ำ เส้นทางตรวจสอบแยกขาด
Quota farmer with a machinery poolหัวหน้าโควต้าที่มีกองเครื่องจักรquota + contractorSame duplication; his dispatcher must juggle two logins to serve one network.ซ้ำแบบเดียวกัน; ผู้จัดคิวงานต้องสลับสองบัญชีเพื่อรับใช้เครือข่ายเดียว
Quota farmer who grows his own caneหัวหน้าโควต้าที่ปลูกอ้อยเองquota + growerAlready fudged informally — his own crops ride inside his network as if he were his own sub-farmer.ทุกวันนี้เลี่ยงแบบไม่เป็นทางการ — อ้อยของตนวิ่งในเครือข่ายราวกับเป็นลูกไร่ของตัวเอง
Farmer with a spray droneชาวไร่ที่มีโดรนพ่นยาgrower + contractorMust onboard twice — a farmer account and a freelance-contractor record — two profiles for one person and one phone.ต้องขึ้นทะเบียนสองครั้ง — บัญชีชาวไร่และเรกคอร์ดผู้รับเหมาฟรีแลนซ์ — สองโปรไฟล์สำหรับคนเดียว เบอร์เดียว
Contractor who takes on landผู้รับเหมาที่รับที่ดินมาปลูกเองcontractor + growerThe reverse path — a service business becoming a grower (PROP-001 crop ownership makes this common) — has no path at all.เส้นทางย้อนกลับ — กิจการบริการผันมาเป็นผู้ปลูก (PROP-001 ทำให้พบบ่อย) — ไม่มีเส้นทางรองรับเลย

Two capacities never combine: bank (regulated lending — PROP-003 deliberately kept it exclusive) and government (สอน. — supervisory neutrality). The model must express exclusivity as a rule, not an accident (ข้อ 5.1).

สอง capacity ไม่ผสมกับใคร: bank (การปล่อยกู้ถูกกำกับ — PROP-003 จงใจสงวนไว้) และ government (สอน. — ความเป็นกลางเชิงกำกับ) model ต้องแสดงกฎความเป็นเอกสิทธิ์อย่างชัดแจ้ง ไม่ใช่ปล่อยตามยถากรรม (ข้อ 5.1)

2.2 The precedent — RiverSync's federation specification2.2 แบบอย่าง — spec สหพันธ์ของ RiverSync

The RiverSync platform (industrial-IoT, six applications, three tenant types) faced the identical problem — a partner organization that is also a customer — and answered it with a specification this proposal adapts wholesale [R1]: a six-layer access model (tenant → entitlement → role → permission → scope → cross-tenant) where each layer only narrows what the previous allows; a normative tenant-type × application entitlement matrix compiled into the token's apps claim; one role per account per application; per-app permission catalogs with scope that narrows, never widens; exactly three cross-tenant mechanisms (customer-granted partner access, audited view-as sessions, a factory default) — and the rule that carries this whole proposal: an organization holding two tenant-roles at once widens that tenant's entitlements, never the account's tenancy (its TEN-2). RiverSync also proves the delivery pattern: the model rides on ASP.NET Core Identity — extended, never replaced — compiles to short-named claims under a hard 4 KB token budget, and names one application (Account) as the sole identity writer that every other app consumes through shared decoders.

Platform RiverSync (IoT อุตสาหกรรม หกแอปพลิเคชัน สามประเภท tenant) เจอโจทย์เดียวกันเป๊ะ — องค์กรพันธมิตรที่เป็นลูกค้าด้วย — และตอบด้วย spec ที่ข้อเสนอนี้ดัดแปลงมาทั้งชุด [R1]: model การเข้าถึงหกชั้น (tenant → สิทธิ์เข้าแอป → บทบาท → permission → ขอบเขต → ข้าม tenant) แต่ละชั้นได้แต่บีบให้แคบลงจากชั้นก่อน; ตารางสิทธิ์ tenant-type × แอปพลิเคชันเชิงบรรทัดฐานที่คอมไพล์เข้า claim apps บน token (โทเคน); หนึ่งบทบาทต่อบัญชีต่อแอป; catalog (แคตตาล็อก) permission รายแอปพร้อมขอบเขตที่บีบแคบได้อย่างเดียว; กลไกข้าม tenant สามอย่างเท่านั้น (สิทธิ์พันธมิตรที่ลูกค้ามอบ, session (เซสชัน) view-as ที่ตรวจสอบได้, ค่าเริ่มต้นโรงงาน) — และกฎที่แบกข้อเสนอนี้ทั้งฉบับ: องค์กรที่ถือสองบทบาท tenant พร้อมกัน ขยายสิทธิ์ของ tenant นั้น ไม่ขยาย tenancy ของบัญชี (TEN-2 ของเขา) RiverSync ยังพิสูจน์แบบแผนการส่งมอบ: model ขี่บน ASP.NET Core Identity — ขยาย ไม่แทนที่ — คอมไพล์เป็น claim ชื่อสั้นใต้งบ token 4 KB และตั้งแอปเดียว (Account) เป็นผู้เขียนอัตลักษณ์รายเดียวที่แอปอื่นบริโภคผ่านตัวถอดรหัสกลาง

2.3 The foundation — wangkanai/federation (open source)2.3 รากฐาน — wangkanai/federation (โอเพนซอร์ส)

Both RiverSync and this platform build on the same in-house open-source foundation: wangkanai/federation [R2] — an ASP.NET Core authentication & authorization server implementing OAuth 2.1 (Authorization Code + PKCE, client credentials, refresh tokens) and OpenID Connect, with JWT support, external identity providers, user consent handling, and an identity model that already carries the primitives this proposal needs: Identity User · Role · Client · Resource · Scope · Directory · Group · Permission · Tenant. Apache-2.0 licensed. Section 9 maps every PROP-005 concept onto this base plus ASP.NET Core Identity, in the base-vs-extension style RiverSync proved [R1].

ทั้ง RiverSync และ platform นี้สร้างบนรากฐานโอเพนซอร์สในบ้านเดียวกัน: wangkanai/federation [R2] — เซิร์ฟเวอร์ยืนยันตัวตนและกำหนดสิทธิ์บน ASP.NET Core ที่ทำ OAuth 2.1 (Authorization Code + PKCE, client credentials, refresh token) และ OpenID Connect รองรับ JWT, ผู้ให้บริการอัตลักษณ์ภายนอก, การจัดการความยินยอมผู้ใช้ และ model อัตลักษณ์ที่มีหน่วยพื้นฐานที่ข้อเสนอนี้ต้องการครบ: Identity User · Role · Client · Resource · Scope · Directory · Group · Permission · Tenant สัญญาอนุญาต Apache-2.0 ข้อ 9 แมปทุกแนวคิดของ PROP-005 ลงบนฐานนี้บวก ASP.NET Core Identity ตามแบบตาราง base-vs-extension ที่ RiverSync พิสูจน์แล้ว [R1]

3. Problem statement3. โจทย์ปัญหา

4. The federated access model — six layers, adapted4. model การเข้าถึงแบบสหพันธ์ — หกชั้น ฉบับดัดแปลง

Authorization resolves in order; each layer only narrows what the previous one allows — nothing later can widen what an earlier layer denied [R1]. The adaptation: RiverSync's layer 1 is a tenant; ours is a party context, because people here are first-class and may act for several parties (Section 5.2).

การกำหนดสิทธิ์ตัดสินตามลำดับ แต่ละชั้นได้แต่บีบให้แคบลงจากชั้นก่อน — ชั้นหลังขยายสิ่งที่ชั้นก่อนปฏิเสธไม่ได้ [R1] จุดดัดแปลง: ชั้น 1 ของ RiverSync คือ tenant; ของเราคือบริบทผู้เล่น (party context) เพราะบุคคลในระบบนี้เป็นพลเมืองชั้นหนึ่งและอาจกระทำการแทนหลายผู้เล่น (ข้อ 5.2)

Layerชั้นQuestion it answersคำถามที่ตอบDecided byตัดสินโดย
1 · Party contextบริบทผู้เล่นWhich party is this person acting for right now?ตอนนี้บุคคลนี้กระทำการแทนผู้เล่นใด?Membership (Section 5.2) — chosen at sign-in or via the party switcher; exactly one active party per session token (FR-60)Membership (ข้อ 5.2) — เลือกตอนลงชื่อเข้าใช้หรือผ่านตัวสลับผู้เล่น; หนึ่งผู้เล่นที่ใช้งานต่อหนึ่ง token (FR-60)
2 · Entitlementสิทธิ์เข้าช่องทางWhich surfaces can this party context open?บริบทผู้เล่นนี้เปิดช่องทางใช้งานใดได้?The capacity × surface matrix (Section 6.1), compiled to the token's srf claim (FR-62, NFR-15)ตาราง capacity × surface (ข้อ 6.1) คอมไพล์เข้า claim srf (FR-62, NFR-15)
3 · RoleบทบาทWhich role does the membership hold in this surface?สมาชิกภาพนี้ถือบทบาทใดในช่องทางนี้?One role per surface per membership — SurfaceRoleGrant (Section 6.2, FR-63)หนึ่งบทบาทต่อช่องทางต่อสมาชิกภาพ — SurfaceRoleGrant (ข้อ 6.2, FR-63)
4 · PermissionWhat can that role do here?บทบาทนั้นทำอะไรได้ที่นี่?The surface's role × permission matrix (Section 7, FR-64)ตารางบทบาท × permission ของช่องทางนั้น (ข้อ 7, FR-64)
5 · ScopeขอบเขตWhere do those permissions apply?permission เหล่านั้นใช้ที่ไหน?Party-wide by default; narrowed per zone / province / quota network / field set (Section 7, FR-65)ทั้งผู้เล่นโดยปริยาย; บีบแคบรายเขต / จังหวัด / เครือข่ายโควต้า / ชุดแปลง (ข้อ 7, FR-65)
6 · Cross-partyข้ามผู้เล่นWhat can an outside party see of mine?ผู้เล่นภายนอกเห็นอะไรของฉันได้?Exactly four mechanisms: ConsentGrant · network relations (quota/mill) · marketplace visibility rules · audited platform view-as (Section 8)สี่กลไกเท่านั้น: ConsentGrant · ความสัมพันธ์เครือข่าย (โควต้า/โรงงาน) · กฎการมองเห็นของตลาด · view-as ของ platform ที่ตรวจสอบได้ (ข้อ 8)
1 Personลงชื่อครั้งเดียวOTP · OIDC Party contextเลือกผู้เล่นที่กระทำแทนMembership 2 Entitlementcapacity → surfacesrf claim = matrix 3–4 Role+ permission1 role / surface 5 Scopeบีบแคบzone · net 6 Crossข้ามผู้เล่นconsent Example · ตัวอย่าง บุญมี (บุคคล) → ผู้เล่น "บุญมีเซอร์วิส" [grower + contractor] → srf: mobile · dispatch · crew · account → บทบาท owner ทุกช่องทาง → ขอบเขต 3 อำเภอ → ธนาคารอ่านได้เฉพาะผ่าน ConsentGrant
Fig. 1 — The six-layer resolution, adapted from RiverSync [R1]: a person signs in once, acts for one party at a time, and every surface, role, permission and boundary derives from that context.รูปที่ 1 — การตัดสินสิทธิ์หกชั้น ดัดแปลงจาก RiverSync [R1]: บุคคลลงชื่อครั้งเดียว กระทำแทนหนึ่งผู้เล่นต่อครั้ง และทุกช่องทาง บทบาท permission และขอบเขต ล้วนสืบจากบริบทนั้น

5. Proposal A — people, parties & capacities5. ข้อเสนอ A — บุคคล ผู้เล่น และ capacity

5.1 The party & its capacity set5.1 ผู้เล่นและชุด capacity

A Party is the economic actor: kind: individual | organization. Every party holds a set of capacities — the six former customer groups reframed as grantable, verifiable roles-of-the-party: grower | quota | mill | contractor | bank | government. Each capacity is granted through its own verification (a grower shows fields; a contractor passes id-verification and publishes offerings; a mill holds an industry license; a bank holds a BOT license; สอน. is appointed) and can be suspended or revoked without touching the party's other capacities. Two rules are structural: bank and government are exclusive — a party holding either can hold nothing else — and every other combination is legal. Capacity, not group, now gates everything downstream: surfaces (Section 6.1), marketplace participation, perspective data slices.

ผู้เล่น (Party) คือผู้กระทำการทางเศรษฐกิจ: kind: individual | organization ทุกผู้เล่นถือชุด capacity — กลุ่มลูกค้าหกกลุ่มเดิมที่ถูกนิยามใหม่เป็นบทบาทของผู้เล่นที่ขอรับได้และตรวจยืนยันได้: grower | quota | mill | contractor | bank | government แต่ละ capacity ได้รับผ่านการยืนยันของตัวเอง (ผู้ปลูกแสดงแปลง; ผู้รับเหมาผ่านการยืนยันตัวตนและเผยแพร่รายการบริการ; โรงงานถือใบอนุญาตอุตสาหกรรม; ธนาคารถือใบอนุญาต ธปท.; สอน. มาจากการแต่งตั้ง) และถูกพักหรือถอนได้โดยไม่กระทบ capacity อื่นของผู้เล่นนั้น กฎเชิงโครงสร้างสองข้อ: bank และ government เป็นเอกสิทธิ์ — ผู้เล่นที่ถืออย่างใดอย่างหนึ่งถืออย่างอื่นไม่ได้ — ส่วนบทบาทผสมอื่นทุกแบบถูกต้องตามกฎ จากนี้ capacity ไม่ใช่กลุ่ม เป็นตัวคุมทุกอย่างปลายน้ำ: ช่องทางใช้งาน (ข้อ 6.1) การเข้าร่วมตลาด และส่วนข้อมูลรายมุมมอง

5.2 People & memberships — the deliberate divergence5.2 บุคคลและสมาชิกภาพ — จุดแตกต่างโดยเจตนา

RiverSync's identity is (email, tenant) — the same email holds a separate account per tenant, joined only by an account chooser [R1]. This proposal diverges, deliberately: here identity is the person. A Person signs in once — phone-first with OTP, since one phone per human is Thai field reality and email penetration among farmers is low — and holds Membership records in any number of parties. An individual party auto-creates a self-membership at birth. The account chooser survives as the party-context switcher: at sign-in (and any time after) the person picks which party they are acting for; the session token carries exactly one active party (FR-60), so layers 2–6 resolve identically to RiverSync. Why diverge: the dispatcher at the mill's service arm who farms in the evening is one person — splitting him into unlinked accounts is precisely the identity fragmentation Section 3 indicts; and person-level identity is what lets a work crew's reputation follow the human (PROP-004's operators), not just the business. The cost is concentrated PDPA responsibility on the person record — carried as NFR-14 and Q3.

อัตลักษณ์ของ RiverSync คือ (email, tenant) — อีเมลเดียวถือบัญชีแยกราย tenant เชื่อมกันแค่ด้วยตัวเลือกบัญชี [R1] ข้อเสนอนี้แตกต่างโดยเจตนา: ที่นี่อัตลักษณ์คือบุคคล Person ลงชื่อเข้าใช้ครั้งเดียว — เบอร์โทรนำด้วย OTP เพราะหนึ่งเบอร์ต่อหนึ่งคนคือความจริงภาคสนามไทย และอีเมลในหมู่ชาวไร่มีน้อย — และถือเรกคอร์ด Membership ในกี่ผู้เล่นก็ได้ ผู้เล่นแบบบุคคลสร้างสมาชิกภาพตนเองอัตโนมัติแต่กำเนิด ตัวเลือกบัญชีแปลงร่างเป็นตัวสลับบริบทผู้เล่น: ตอนลงชื่อเข้าใช้ (และทุกเมื่อหลังจากนั้น) บุคคลเลือกว่ากระทำแทนผู้เล่นใด; token ของ session ถือผู้เล่นที่ใช้งานเพียงหนึ่ง (FR-60) ชั้น 2–6 จึงตัดสินเหมือน RiverSync ทุกประการ เหตุผลที่แตกต่าง: ผู้จัดคิวงานของหน่วยบริการโรงงานที่ตอนเย็นทำไร่ คือคนคนเดียว — การฉีกเขาเป็นบัญชีที่ไม่เชื่อมกันคือการแตกกระจายอัตลักษณ์ที่ ข้อ 3 ฟ้องพอดี และอัตลักษณ์ระดับบุคคลคือสิ่งที่ทำให้ชื่อเสียงของชุดงานตามติดตัวคน (ผู้ปฏิบัติงานของ PROP-004) ไม่ใช่แค่ตามกิจการ ราคาที่จ่ายคือภาระ PDPA ที่กระจุกบนเรกคอร์ดบุคคล — บันทึกเป็น NFR-14 และ Q3

5.3 The federation entities5.3 Entity ของสหพันธ์

Entity · codeEntity · รหัสAttributesแอตทริบิวต์Rulesกฎ
Person
บุคคล
PSN-########
person_id, full_name, phone, phone_verified, email?, email_verified?, national_id_hash?, id_verified_level, login_providers[], status The human. phone unique platform-wide (NFR-14); OTP is the primary factor; login_providers[] covers OIDC externals (LINE · Google · Microsoft, Q2). id_verified_level: none | phone | national_id | ekyc — capacities require levels (Section 5.1). Never deleted while memberships exist; PDPA erasure via anonymization (Q3).มนุษย์ phone ไม่ซ้ำทั้ง platform (NFR-14); OTP เป็นปัจจัยหลัก; login_providers[] รองรับ OIDC ภายนอก (LINE · Google · Microsoft, Q2) id_verified_level: none | phone | national_id | ekyc — แต่ละ capacity กำหนดระดับขั้นต่ำ (ข้อ 5.1) ห้ามลบตราบมีสมาชิกภาพ; การลบตาม PDPA ใช้การทำนิรนาม (Q3)
Party
ผู้เล่น
PTY-########
party_id, kind, display_name, legal_name?, registration_no?, base_province, status, created_at kind: individual | organization. An individual party belongs to exactly one person (its self-member); an organization party is the former Tenant, one record per legal org — the affiliated-tenant workaround (PROP-004 Q3) is abolished. Domain profile records (Farmer, Mill, Contractor, FinancialInstitution…) attach to the party via party_id and keep their own ids and history (Section 5.4).kind: individual | organization ผู้เล่นแบบบุคคลเป็นของบุคคลเดียว (สมาชิกตนเอง); ผู้เล่นแบบองค์กรคือ Tenant เดิม หนึ่งเรกคอร์ดต่อหนึ่งนิติบุคคล — วิธี tenant ในเครือ (PROP-004 Q3) ถูกยกเลิก เรกคอร์ดโปรไฟล์โดเมน (Farmer, Mill, Contractor, FinancialInstitution…) เกาะผู้เล่นผ่าน party_id โดยคงรหัสและประวัติเดิม (ข้อ 5.4)
PartyCapacity
บทบาทของผู้เล่น
PCA-########
capacity_id, party_id, capacity, status, required_level, verified_by?, evidence_ref?, granted_at, suspended_at?, revoked_at? capacity: grower | quota | mill | contractor | bank | government; status: pending | active | suspended | revoked. UNIQUE (party_id, capacity). Exclusivity invariant: an active bank or government capacity forbids any other active capacity on the party (NFR-16). History is append-only — revocation never deletes.capacity: grower | quota | mill | contractor | bank | government; status: pending | active | suspended | revoked UNIQUE (party_id, capacity) กฎเอกสิทธิ์: capacity bank หรือ government ที่ active ห้ามมี capacity อื่น active บนผู้เล่นเดียวกัน (NFR-16) ประวัติต่อท้ายเท่านั้น — การถอนไม่ลบ
Membership
สมาชิกภาพ
MBR-########
membership_id, person_id, party_id, is_self, title?, status, invited_by?, joined_at The person↔party join. is_self marks the individual party's automatic membership. One person may hold many; each carries its own SurfaceRoleGrants (Section 6.2). status: invited | active | suspended | left. Leaving a party never touches the person's other memberships.จุดเชื่อมบุคคล↔ผู้เล่น is_self ระบุสมาชิกภาพอัตโนมัติของผู้เล่นแบบบุคคล หนึ่งบุคคลถือได้หลายรายการ แต่ละรายการมี SurfaceRoleGrant ของตัวเอง (ข้อ 6.2) status: invited | active | suspended | left การออกจากผู้เล่นหนึ่งไม่กระทบสมาชิกภาพอื่นของบุคคล

5.4 Migration — every record keeps its identity5.4 การย้ายระบบ — ทุกเรกคอร์ดคงอัตลักษณ์เดิม

TodayปัจจุบันBecomesกลายเป็น
Tenant (tenant_type)Party (kind: organization) — same identifier lineage; tenant_type maps to the initial PartyCapacity (sugar_factory→mill · quota_org→quota · government_agency→government · bank→bank · contractor→contractor).Party (kind: organization) — สายรหัสเดิม; tenant_type แมปเป็น PartyCapacity เริ่มต้น (sugar_factory→mill · quota_org→quota · government_agency→government · bank→bank · contractor→contractor)
User (per tenant)Person + Membership. Duplicate humans across tenants merge on verified phone — the merge is assisted, consent-confirmed, and logged (Q3).Person + Membership มนุษย์ที่ซ้ำข้าม tenant ควบรวมด้วยเบอร์ที่ยืนยันแล้ว — มีผู้ช่วยตรวจ ยืนยันด้วยความยินยอม และบันทึกทุกครั้ง (Q3)
Farmer (individual · CFC)Party (individual) + grower capacity + self-membership; the Farmer record keeps its id as the grower profile. Virtual farmers (PROP-001, WF-01) become parties with an unclaimed person — claiming is unchanged.Party (individual) + capacity grower + สมาชิกภาพตนเอง; เรกคอร์ด Farmer คงรหัสเดิมเป็นโปรไฟล์ผู้ปลูก ลูกไร่ virtual (PROP-001, WF-01) เป็นผู้เล่นที่มีบุคคลยังไม่อ้างสิทธิ์ — การอ้างสิทธิ์เหมือนเดิม
Contractor (kind: freelance | organization · CEC)The contractor capacity on the person's individual party (freelance) or the organization party. The Contractor record, its ratings, jobs and books keep their ids — PROP-004 Section 5.1's exactly one of user_id | tenant_id collapses into party_id. The freelance→org upgrade becomes "found an organization party; move the capacity"; ratings continuity holds (Section 10 impact).capacity contractor บนผู้เล่นแบบบุคคล (ฟรีแลนซ์) หรือผู้เล่นแบบองค์กร เรกคอร์ด Contractor คะแนน งาน และบัญชีคงรหัสเดิม — กฎ user_id | tenant_id อย่างใดอย่างหนึ่ง ของ PROP-004 ข้อ 5.1 ยุบเป็น party_id การอัปเกรดฟรีแลนซ์→องค์กรกลายเป็น "ตั้งผู้เล่นองค์กรแล้วย้าย capacity" โดยความต่อเนื่องของคะแนนคงอยู่ (ผลกระทบ ข้อ 10)
*_party_type (scattered enums)All requester/payer/endorser/grantor/subject/owner _party_type + _party_id pairs across PROP-003/04 resolve to a single party_id — the books context (PROP-004 Section 7) anticipated exactly this.คู่ requester/payer/endorser/grantor/subject/owner _party_type + _party_id ทั้งหมดใน PROP-003/04 ยุบเหลือ party_id เดียว — บริบท books (PROP-004 ข้อ 7) ออกแบบรอสิ่งนี้ไว้พอดี

6. Proposal B — entitlement & the role model6. ข้อเสนอ B — สิทธิ์เข้าช่องทางและ model บทบาท

6.1 The capacity × surface entitlement matrix (normative)6.1 ตารางสิทธิ์ capacity × ช่องทางใช้งาน (เชิงบรรทัดฐาน)

The platform gains an eighth surface: account — the federation console, modeled on RiverSync's Account app as sole identity writer [R1]: profile, parties, capacities, members, roles, permissions, consents. Every other surface consumes identity; none writes it. The matrix below is normative; a party's surface entitlement is the union over its active capacities, and the compiled srf claim must equal it (NFR-15) — a resolver that diverges is a defect, never a spec change [R1].

platform เพิ่มช่องทางใช้งานที่แปด: account — console สหพันธ์ ตามแบบแอป Account ของ RiverSync ในฐานะผู้เขียนอัตลักษณ์รายเดียว [R1]: โปรไฟล์ ผู้เล่น capacity สมาชิก บทบาท permission ความยินยอม ช่องทางอื่นทุกช่องบริโภคอัตลักษณ์ ไม่มีช่องใดเขียน ตารางด้านล่างเป็นเชิงบรรทัดฐาน; สิทธิ์ของผู้เล่นคือยูเนียนของ capacity ที่ active และ claim srf ที่คอมไพล์ต้องเท่ากับตาราง (NFR-15) — ตัวคอมไพล์ที่คลาดเคลื่อนคือ defect ไม่ใช่การแก้ spec [R1]

CapacityCapacityaccountmobileportaldispatchcrewfinanceregulator
grower
ผู้ปลูกผู้ปลูก
●●—————
quota
หัวหน้าโควต้า
●●●————
mill
โรงงาน
●—●————
contractor
ผู้รับเหมา
●——●●——
bank
ธนาคาร exclusiveเอกสิทธิ์
●————●—
government
สอน. exclusiveเอกสิทธิ์
●—————●

website stays public (no entitlement row). account rides in the claim explicitly for every capacity — the uniform-decode lesson RiverSync resolved in its v0.9 [R1]. Presence in srf means tile shown, not "may sign in". Worked union: หจก.โควต้าโคกสูง [quota + grower + contractor] → account · mobile · portal · dispatch · crew — one organization, five tiles, zero duplicate identities.

website ยังเป็นสาธารณะ (ไม่มีแถวสิทธิ์) account อยู่ใน claim อย่างชัดแจ้งสำหรับทุก capacity — บทเรียนถอดรหัสแบบเอกรูปที่ RiverSync สรุปใน v0.9 [R1] การปรากฏใน srf แปลว่าแสดงไทล์ ไม่ใช่ "ลงชื่อเข้าใช้ได้" ตัวอย่างยูเนียน: หจก.โควต้าโคกสูง [quota + grower + contractor] → account · mobile · portal · dispatch · crew — หนึ่งองค์กร ห้าไทล์ ศูนย์อัตลักษณ์ซ้ำ

6.2 One role per surface per membership6.2 หนึ่งบทบาทต่อช่องทางต่อสมาชิกภาพ

Entity · codeEntity · รหัสAttributesแอตทริบิวต์Rulesกฎ
SurfaceRoleGrant
สิทธิ์บทบาทรายช่องทาง
SRG-########
grant_id, membership_id, surface, role_id, granted_by, granted_at, status UNIQUE (membership_id, surface) — exactly one role per surface per membership, RiverSync's FED-6 verbatim [R1]; no role-union mechanic exists anywhere. Grants live only on surfaces the party is entitled to (Section 6.1); revoking a capacity suspends its surfaces' grants. Every party has one fixed-full role — owner — holding every permission, locked-on in every matrix, undeletable; an individual party's self-membership is its owner.UNIQUE (membership_id, surface) — หนึ่งบทบาทต่อช่องทางต่อสมาชิกภาพ ตาม FED-6 ของ RiverSync คำต่อคำ [R1]; ไม่มีกลไกรวมบทบาทที่ใดทั้งสิ้น สิทธิ์มีได้เฉพาะช่องทางที่ผู้เล่นมีสิทธิ์เข้า (ข้อ 6.1); การถอน capacity พักสิทธิ์ของช่องทางนั้นทั้งหมด ทุกผู้เล่นมีบทบาทเต็มถาวรหนึ่งเดียว — owner — ถือทุก permission ล็อกติดในทุกตาราง ลบไม่ได้; สมาชิกภาพตนเองของผู้เล่นแบบบุคคลคือ owner โดยกำเนิด

Existing role sets survive intact — they simply re-home: the portal roles (mill & quota staff), PROP-003's finance roles, PROP-004's contractor_owner · dispatcher · machine_operator · contractor_admin become the default role sets of their surfaces, template-cloneable per party. What changes is the grant: a role now attaches to (membership, surface), so the same person can be dispatcher on the mill's dispatch surface Monday-to-Friday and owner of his own grower party on the weekend — one sign-in, two contexts, never a merged session.

ชุดบทบาทเดิมอยู่ครบ — แค่ย้ายบ้าน: บทบาท portal (เจ้าหน้าที่โรงงานและโควต้า), บทบาท finance ของ PROP-003, และ contractor_owner · dispatcher · machine_operator · contractor_admin ของ PROP-004 กลายเป็นชุดบทบาทปริยายของช่องทางนั้น ๆ โคลนเป็นแม่แบบรายผู้เล่นได้ สิ่งที่เปลี่ยนคือตัวสิทธิ์: บทบาทเกาะกับ (membership, surface) คนเดียวกันจึงเป็น dispatcher บน dispatch ของโรงงานวันจันทร์–ศุกร์ และเป็น owner ของผู้เล่นผู้ปลูกของตนวันหยุด — ลงชื่อครั้งเดียว สองบริบท ไม่มี session ปนกัน

6.3 The canonical population — parties & people the prototypes must reuse6.3 ประชากรอ้างอิง — ผู้เล่นและบุคคลที่ต้นแบบต้องใช้ซ้ำ

Partyผู้เล่นCapacitiesCapacitySurface tilesไทล์ช่องทางDemonstratesสาธิต
Mitr Kaset millโรงงานน้ำตาลมิตรเกษตร orgmill + contractoraccount · portal · dispatch · crewThe factory service arm — one org, no affiliated-tenant duplicate; its dispatch profile discloses the mill capacity (Section 8.3).หน่วยบริการโรงงาน — องค์กรเดียว ไม่มี tenant ในเครือซ้ำ; โปรไฟล์ dispatch เปิดเผย capacity โรงงาน (ข้อ 8.3)
หจก.โควต้าโคกสูง orgquota + grower + contractoraccount · mobile · portal · dispatch · crewTriple capacity: network head, own cane, machinery pool — the widest legal union.สาม capacity: หัวหน้าเครือข่าย อ้อยของตนเอง กองเครื่องจักร — ยูเนียนกว้างสุดที่ถูกกฎ
บุญส่ง (ลูกไร่) individualgroweraccount · mobileThe unchanged base case — most parties stay single-capacity.กรณีฐานที่ไม่เปลี่ยน — ผู้เล่นส่วนใหญ่ยังถือ capacity เดียว
บุญมี (โดรน) individualgrower + contractoraccount · mobile · dispatch · crewThe drone moonlighter — one onboarding, second capacity added in-app (WF-25); ratings and books on one record.ชาวไร่ผันโดรน — ขึ้นทะเบียนครั้งเดียว เพิ่ม capacity ที่สองในแอป (WF-25); คะแนนและบัญชีบนเรกคอร์ดเดียว
ธ.ก.ส. orgbank excl.account · financeExclusivity enforced — the invariant, not a convention (NFR-16).เอกสิทธิ์ถูกบังคับ — เป็นกฎคงที่ ไม่ใช่ธรรมเนียม (NFR-16)
สอน. orggovernment excl.account · regulatorSupervisory neutrality preserved.คงความเป็นกลางเชิงกำกับ
Person: สมชายบุคคล: สมชาย PSNmember of 2 partiesสมาชิก 2 ผู้เล่นcontext-dependentตามบริบทThe Section 5.2 divergence made flesh: dispatcher at Mitr Kaset's service arm and owner of his own grower party — one phone, one sign-in, a party switcher between them.จุดแตกต่าง ข้อ 5.2 ฉบับมีชีวิต: dispatcher ของหน่วยบริการมิตรเกษตร และ owner ของผู้เล่นผู้ปลูกของตน — เบอร์เดียว ลงชื่อครั้งเดียว สลับผู้เล่นระหว่างกัน
Exhibitเอกสารแนบ The interactive resolver prop-005-entitlement-matrix.html implements Section 4–Section 6 live: pick a persona (this table), toggle capacities and verification, and watch tiles, matrix rows and the six-layer trace re-resolve — the same persona-tweaks discipline RiverSync pins as a requirement [R1]. ตัวจำลองแบบโต้ตอบ prop-005-entitlement-matrix.html ทำ ข้อ 4–ข้อ 6 ให้มีชีวิต: เลือกบุคคลอ้างอิง (ตารางนี้) สลับ capacity และการยืนยัน แล้วดูไทล์ แถวตาราง และร่องรอยหกชั้นตัดสินใหม่สด ๆ — วินัย persona-tweaks แบบเดียวกับที่ RiverSync ตราเป็นข้อกำหนด [R1]

7. Proposal C — permission catalogs & scope7. ข้อเสนอ C — catalog permission และขอบเขต

Catalogs are per surface [R1]: each surface carries its own permission catalog grouped by domain, and the account surface renders a role × permission matrix per surface with the owner column locked on. Surfaces the party cannot reach render as locked chips naming the reason ("dispatch ต้องมี capacity ผู้รับเหมา"). Scope narrows, never widens: the matrix default applies party-wide; an override replaces it for one scope with an equal-or-narrower set. Scope dimensions are the platform's real geography: province | district | mill_zone | quota_network | field_set — a quota org's field officer scoped to one district; a mill's quality officer scoped to two zones; a contractor org's dispatcher scoped to the western crews. Full catalogs are SPEC-APP work on acceptance; this proposal fixes the mechanics and the group skeletons (account: parties & capacities · members & roles · consents & audit; existing surfaces keep their current implicit groups, now made explicit).

catalog เป็นรายช่องทาง [R1]: แต่ละช่องทางถือ catalog permission ของตัวเองจัดกลุ่มตามโดเมน และช่องทาง account แสดงตารางบทบาท × permission รายช่องทางโดยคอลัมน์ owner ล็อกติด ช่องทางที่ผู้เล่นเข้าไม่ได้แสดงเป็นชิปล็อกพร้อมเหตุผล ("dispatch ต้องมี capacity ผู้รับเหมา") ขอบเขตบีบแคบได้อย่างเดียว: ค่าปริยายของตารางใช้ทั้งผู้เล่น; การ override แทนที่เฉพาะขอบเขตนั้นด้วยชุดที่เท่าเดิมหรือแคบกว่า มิติของขอบเขตคือภูมิศาสตร์จริงของ platform: province | district | mill_zone | quota_network | field_set — เจ้าหน้าที่ภาคสนามขององค์กรโควต้าจำกัดหนึ่งอำเภอ; เจ้าหน้าที่คุณภาพของโรงงานจำกัดสองเขต; dispatcher ขององค์กรรับเหมาจำกัดชุดงานฝั่งตะวันตก catalog เต็มเป็นงาน SPEC-APP เมื่ออนุมัติ; ข้อเสนอนี้ตรึงกลไกและโครงกลุ่ม (account: ผู้เล่นและ capacity · สมาชิกและบทบาท · ความยินยอมและการตรวจสอบ; ช่องทางเดิมคงกลุ่มโดยนัยปัจจุบัน แต่ทำให้ชัดแจ้ง)

Entity · codeEntity · รหัสAttributesแอตทริบิวต์Rulesกฎ
PermissionCatalog
catalog permission
PMC-####
permission_id, surface, group, key, name_th, name_en, description? Platform-defined, versioned with the spec; parties never invent permissions — they compose roles from the catalog.กำหนดโดย platform กำกับรุ่นตาม spec; ผู้เล่นไม่สร้าง permission เอง — ประกอบบทบาทจาก catalog เท่านั้น
RolePermission
สิทธิ์ของบทบาท
RPM-########
role_permission_id, party_id, role_id, permission_id, allowed, scope_type?, scope_ref? The authored matrix cell. scope_type: province | district | mill_zone | quota_network | field_set with scope_ref; a scoped row must be equal-or-narrower than the party-wide default (FR-65). Compiled into the token's perm claim at sign-in (Section 10) — scope rides inside perm, no standalone claim [R1].เซลล์ตารางที่ผู้เล่นกำหนด scope_type: province | district | mill_zone | quota_network | field_set พร้อม scope_ref; แถวที่จำกัดขอบเขตต้องเท่าเดิมหรือแคบกว่าค่าปริยายทั้งผู้เล่น (FR-65) คอมไพล์เข้า claim perm ตอนลงชื่อเข้าใช้ (ข้อ 10) — ขอบเขตขี่ใน perm ไม่มี claim แยก [R1]

8. Proposal D — cross-party access, audit & visibility mandates8. ข้อเสนอ D — การเข้าถึงข้ามผู้เล่น การตรวจสอบ และกฎการมองเห็น

8.1 Exactly four mechanisms cross a party boundary8.1 กลไกข้ามขอบเขตผู้เล่นมีสี่อย่างเท่านั้น

#MechanismกลไกRuleกฎ
X1ConsentGrant (generalized)(ขยายทั่วไป)PROP-003's consent gate becomes party↔party: grantor_party_id → grantee_party_id, scoped, term-limited, revocable, effective immediately. Bank reads (FIN), books sharing (CEC Section 7) and any future data grant all ride this one rail. NFR-08 unchanged.ประตูความยินยอมของ PROP-003 กลายเป็นผู้เล่น↔ผู้เล่น: grantor_party_id → grantee_party_id จำกัดขอบเขตและเวลา ถอนได้ มีผลทันที การอ่านของธนาคาร (FIN) การแบ่งปันบัญชี (CEC ข้อ 7) และการมอบข้อมูลใด ๆ ในอนาคต วิ่งบนรางเดียวนี้ NFR-08 คงเดิม
X2Network relationsความสัมพันธ์เครือข่ายStanding structural visibility the domain already defines: quota ↔ sub-farmer (network data), mill ↔ quota (contract & delivery data). Now specified as relation-scoped reads, not group privilege — a quota org sees network fields because of the relation record, whatever else it also is.การมองเห็นเชิงโครงสร้างที่โดเมนกำหนดอยู่แล้ว: โควต้า ↔ ลูกไร่ (ข้อมูลเครือข่าย), โรงงาน ↔ โควต้า (สัญญาและการส่งมอบ) จากนี้ spec เป็นการอ่านตามเรกคอร์ดความสัมพันธ์ ไม่ใช่อภิสิทธิ์ของกลุ่ม — องค์กรโควต้าเห็นแปลงเครือข่ายเพราะเรกคอร์ดความสัมพันธ์ ไม่ว่ามันจะเป็นอะไรอย่างอื่นอีก
X3Marketplace visibilityการมองเห็นในตลาดPROP-004's rules (offering directory, verified reviews public per Q4, NFR-12 fairness) — reads granted by publishing into the marketplace, bounded to what was published.กฎของ PROP-004 (ไดเรกทอรีบริการ รีวิวยืนยันสาธารณะตาม Q4 ความเป็นธรรม NFR-12) — สิทธิ์อ่านเกิดจากการเผยแพร่สู่ตลาด และจำกัดเท่าที่เผยแพร่
X4Platform view-asview-as ของ platformPlatform support acts inside a party only through a ViewAsSession (VAS-########): permission-gated, announced by a persistent banner, every action dual-logged in the party's audit trail and the platform's [R1]. Read-only by default; write enforcement is Q5 — named-gap discipline copied from the source.ฝ่ายสนับสนุน platform กระทำภายในผู้เล่นได้ทางเดียวคือ ViewAsSession (VAS-########): ต้องมี permission เฉพาะ มีแบนเนอร์ประกาศถาวร ทุกการกระทำบันทึกคู่ทั้งฝั่งผู้เล่นและฝั่ง platform [R1] อ่านอย่างเดียวโดยปริยาย; การบังคับฝั่งเขียนคือ Q5 — วินัยประกาศช่องว่างตามต้นแบบ

8.2 Attribution8.2 การระบุที่มา

Every cross-party action is audited and attributed to both the acting party and the acting person (FR-67) — stronger than the source model, and necessary because people here cross parties by design (ข้อ 5.2). A quota org's entry in a sub-farmer's log reads "หจก.โควต้าโคกสูง · โดย สมชาย"; a view-as entry reads the platform and the named supporter.

ทุกการกระทำข้ามผู้เล่นถูกตรวจสอบและระบุที่มาถึงทั้งผู้เล่นที่กระทำและบุคคลที่กระทำ (FR-67) — เข้มกว่าต้นแบบ และจำเป็นเพราะบุคคลในระบบนี้ข้ามผู้เล่นโดยการออกแบบ (ข้อ 5.2) รายการขององค์กรโควต้าในบันทึกของลูกไร่อ่านว่า "หจก.โควต้าโคกสูง · โดย สมชาย"; รายการ view-as ระบุ platform และชื่อผู้สนับสนุน

8.3 Visibility mandates — normative for every prototype and production8.3 กฎการมองเห็น — บรรทัดฐานสำหรับทุกต้นแบบและ production

Surfaceพื้นที่Ruleกฎ
Surface switcherตัวสลับช่องทางLists entitled surfaces only — gated surfaces are absent, never shown locked [R1].แสดงเฉพาะช่องทางที่มีสิทธิ์ — ช่องทางที่ถูกกั้นหายไปเลย ไม่แสดงแบบล็อก [R1]
Party switcherตัวสลับผู้เล่นLists the person's active memberships; switching re-issues the token (FR-60) — never a merged session.แสดงสมาชิกภาพที่ active ของบุคคล; การสลับออก token ใหม่ (FR-60) — ไม่มี session ปนกัน
Capacity disclosure — marketplaceการเปิดเผย capacity — ตลาดDeliberate divergence from the source's partner-role confidentiality [R1]: a contractor profile in the marketplace must disclose its party's mill or quota capacity ("หน่วยบริการของโรงงานมิตรเกษตร"). Rationale: the mill is also the buyer of the cane the service touches — hiding the affiliation would let a market-maker masquerade as a neutral vendor (upholds PROP-004 Q3, NFR-12).จุดแตกต่างโดยเจตนาจากกฎปกปิดบทบาทพันธมิตรของต้นแบบ [R1]: โปรไฟล์ผู้รับเหมาในตลาดต้องเปิดเผย capacity โรงงานหรือโควต้าของผู้เล่น ("หน่วยบริการของโรงงานมิตรเกษตร") เหตุผล: โรงงานคือผู้ซื้ออ้อยที่บริการนั้นแตะต้องด้วย — การซ่อนสังกัดจะปล่อยให้ผู้กุมตลาดปลอมตัวเป็นผู้ขายที่เป็นกลาง (ยืนตาม PROP-004 Q3, NFR-12)
Capacity disclosure — elsewhereการเปิดเผย capacity — ที่อื่นOutside the marketplace the source rule holds: a counterparty sees only the capacity the interaction concerns — a bank reading consented books does not learn the grantor's other capacities beyond what the scope carries.นอกตลาด กฎต้นแบบคงอยู่: คู่สัญญาเห็นเฉพาะ capacity ที่ธุรกรรมนั้นเกี่ยว — ธนาคารที่อ่านบัญชีตามความยินยอมไม่รู้ capacity อื่นของผู้ให้เกินกว่าที่ขอบเขตพาไป
Unverified capacitycapacity ยังไม่ยืนยันA pending capacity's surfaces lock with an explain-and-unlock state naming the missing verification; the rest of the party is untouched [R1].ช่องทางของ capacity สถานะ pending ล็อกพร้อมคำอธิบายและทางปลดล็อกที่ระบุการยืนยันที่ขาด; ส่วนอื่นของผู้เล่นไม่กระทบ [R1]
View-as sessionsession view-asPersistent banner names the impersonated party; exit returns to the platform console; all actions dual-logged [R1].แบนเนอร์ถาวรระบุผู้เล่นที่ถูกสวม; ออกแล้วกลับ console platform; ทุกการกระทำบันทึกคู่ [R1]
Ranking integrityความเที่ยงของอันดับCapacity combinations never privilege marketplace rank — a mill-owned contractor outranks no one by affiliation (NFR-12 unchanged).บทบาทผสมไม่เคยให้แต้มต่ออันดับตลาด — ผู้รับเหมาของโรงงานไม่แซงใครเพราะสังกัด (NFR-12 คงเดิม)

9. Foundation — wangkanai/federation + ASP.NET Core Identity (normative)9. รากฐาน — wangkanai/federation + ASP.NET Core Identity (เชิงบรรทัดฐาน)

The model in Sections 4–8 is not built from scratch. Its authorization server is wangkanai/federation [R2] — OAuth 2.1 (Authorization Code + PKCE, client credentials, refresh) and OpenID Connect [R4], JWT issuance, external providers, consent handling — and its store is ASP.NET Core Identity, extended, never replaced [R3], the exact discipline RiverSync proved [R1]. Each surface (mobile, portal, dispatch, crew, finance, regulator) is an OIDC client of the account authority; none holds credentials of its own.

model ใน ข้อ 4–8 ไม่ได้สร้างจากศูนย์ เซิร์ฟเวอร์กำหนดสิทธิ์คือ wangkanai/federation [R2] — OAuth 2.1 (Authorization Code + PKCE, client credentials, refresh) และ OpenID Connect [R4] ออก JWT ผู้ให้บริการภายนอก การจัดการความยินยอม — และคลังข้อมูลคือ ASP.NET Core Identity แบบขยาย ไม่แทนที่ [R3] วินัยเดียวกับที่ RiverSync พิสูจน์ [R1] แต่ละช่องทางใช้งาน (mobile, portal, dispatch, crew, finance, regulator) เป็น client แบบ OIDC ของศูนย์ account; ไม่มีช่องทางใดถือรหัสผ่านเอง

ConceptแนวคิดFoundation baseฐานรากที่ใช้Cane Agency extensionส่วนขยายของ Cane Agency
PersonAspNetUsers (IdentityUser<Guid>)Person columns (Section 5.3); UNIQUE (PhoneNumber) replaces the email index — phone-first (NFR-14); OTP via Identity phone confirmation; LINE · Google · Microsoft as AspNetUserLogins (Q2).คอลัมน์ Person (ข้อ 5.3); UNIQUE (PhoneNumber) แทนดัชนีอีเมล — เบอร์นำ (NFR-14); OTP ผ่านการยืนยันเบอร์ของ Identity; LINE · Google · Microsoft เป็น AspNetUserLogins (Q2)
Party · PartyCapacity · Membershipfederation's Identity Tenant · Directory · Group primitives [R2]หน่วย Identity Tenant · Directory · Group ของ federation [R2]Party generalizes Tenant to individual | organization; PartyCapacity and Membership are extension entities with no framework equivalent (Section 5.3).Party ขยาย Tenant เป็น individual | organization; PartyCapacity และ Membership เป็น entity ส่วนขยายที่เฟรมเวิร์กไม่มี (ข้อ 5.3)
SurfaceRoleGrantAspNetRoles + AspNetUserRolesSurfaceKey on the join + UNIQUE (MembershipId, SurfaceKey) — one role per surface (Section 6.2), mirroring the source's per-app key [R1]; roles carry PartyId · IsFixed (owner).SurfaceKey บนตารางเชื่อม + UNIQUE (MembershipId, SurfaceKey) — หนึ่งบทบาทต่อช่องทาง (ข้อ 6.2) สะท้อนคีย์รายแอปของต้นแบบ [R1]; บทบาทถือ PartyId · IsFixed (owner)
Permission · scopefederation's Identity Permission & Scope [R2] + role claimsIdentity Permission & Scope ของ federation [R2] + role claimsAuthored as PermissionCatalog / RolePermission (Section 7); compiled into perm at sign-in — never queried live by consumers.กำหนดเป็น PermissionCatalog / RolePermission (ข้อ 7); คอมไพล์เข้า perm ตอนลงชื่อเข้าใช้ — ผู้บริโภคไม่สืบค้นสด
Surface clientsClient รายช่องทางfederation's Identity Client · Resource [R2]Identity Client · Resource ของ federation [R2]One registered client per surface; the account surface is the authority host. Delegation (view-as) uses the RFC 8693 actor pattern [R5].หนึ่ง client จดทะเบียนต่อช่องทาง; ช่องทาง account เป็นโฮสต์ศูนย์กลาง การสวมสิทธิ์ (view-as) ใช้แบบแผน actor ของ RFC 8693 [R5]

10. The token claim contract10. สัญญา claim บน token

At sign-in (and at every party switch) the resolved model compiles onto the access token as short-named claims. The account authority is the sole writer; surfaces consume through shared decoders, never by reaching into the identity store [R1].

ตอนลงชื่อเข้าใช้ (และทุกครั้งที่สลับผู้เล่น) model ที่ตัดสินแล้วคอมไพล์ลง token เป็น claim ชื่อสั้น ศูนย์ account เป็นผู้เขียนรายเดียว; ช่องทางบริโภคผ่านตัวถอดรหัสกลาง ไม่ล้วงคลังอัตลักษณ์ [R1]

ClaimCarriesบรรทุก
subThe person (PSN id) — stable across every party context (Section 5.2).บุคคล (รหัส PSN) — คงที่ทุกบริบทผู้เล่น (ข้อ 5.2)
ptyThe active party of this session — exactly one (FR-60); switching parties re-issues the token.ผู้เล่นที่ใช้งานของ session นี้ — หนึ่งเดียว (FR-60); สลับผู้เล่นออก token ใหม่
capThe party's active capacity set — drives capacity-conditional UI (e.g. the disclosure chip, Section 8.3).ชุด capacity ที่ active ของผู้เล่น — ขับ UI ตามเงื่อนไข capacity (เช่น ชิปเปิดเผยสังกัด ข้อ 8.3)
srfEntitled surface keys, compiled from the Section 6.1 matrix as the union over cap; account always explicit; must equal the matrix (NFR-15). Drives the switcher. Finer role × surface narrowing resolves shell-side from the grant set — the token stays capacity-level, exactly the source's split [R1].คีย์ช่องทางที่มีสิทธิ์ คอมไพล์จากตาราง ข้อ 6.1 เป็นยูเนียนเหนือ cap; account ชัดแจ้งเสมอ; ต้องเท่ากับตาราง (NFR-15) ขับตัวสลับช่องทาง การบีบละเอียดระดับบทบาท × ช่องทางตัดสินฝั่ง shell จากชุดสิทธิ์ — token อยู่ระดับ capacity ตามการแบ่งของต้นแบบ [R1]
permPermissions and scope, packed by a deterministic codec — no standalone scope claim (token budget) [R1].permission และขอบเขต แพ็กด้วย codec เชิงกำหนด — ไม่มี claim ขอบเขตแยก (งบ token) [R1]
verPerson verification level + per-capacity verification flags — gates locked states (Section 8.3).ระดับการยืนยันบุคคล + ธงยืนยันราย capacity — ประตูสถานะล็อก (ข้อ 8.3)
act · vasView-as only: the acting platform person (RFC 8693 actor [R5]) + the ViewAsSession id (Section 8.1 X4).เฉพาะ view-as: บุคคล platform ที่กระทำ (actor ตาม RFC 8693 [R5]) + รหัส ViewAsSession (ข้อ 8.1 X4)
Budget (normative)งบ (บรรทัดฐาน) The encrypted access token fits a 4 KB JWE budget; nothing unbounded rides in claims — anything larger resolves server-side [R1]. Field exception: the offline-first surfaces (crew, mobile) receive JWS (signed, not encrypted) tokens with an offline validity window (Q6) — a field device without signal must still open today's dispatched jobs. token เข้ารหัสต้องอยู่ในงบ JWE 4 KB; ไม่มีสิ่งไร้ขอบเขตใน claim — อะไรที่ใหญ่กว่าตัดสินฝั่งเซิร์ฟเวอร์ [R1] ข้อยกเว้นภาคสนาม: ช่องทางเน้นออฟไลน์ (crew, mobile) รับ token JWS (ลงนาม ไม่เข้ารหัส) พร้อมหน้าต่างใช้งานออฟไลน์ (Q6) — อุปกรณ์กลางไร่ที่ไร้สัญญาณต้องยังเปิดงานที่จัดคิววันนี้ได้

11. Context & event changes (DDD)11. การเปลี่ยนแปลงบริบทและเหตุการณ์ (DDD)

New eventเหตุการณ์ใหม่Producerผู้ผลิตConsumersผู้บริโภค
PersonRegistered · PersonMergedfederationall surfaces, audit
PartyCreated · CapacityGranted · CapacitySuspended · CapacityRevokedfederationservice_marketplace, lending, regulator reports, audit
MembershipActivated · MembershipLeft · SurfaceRoleGranted · SurfaceRoleRevokedfederationall surfaces (shell nav), audit
PartyContextIssuedfederationaudit (session forensics)(นิติวิทยา session)
ViewAsStarted · ViewAsEndedfederationthe viewed party's audit + platform auditบันทึกของผู้เล่นที่ถูกดู + บันทึก platform

12. Workflow impact (PWF)12. ผลกระทบต่อเวิร์กโฟลว์ (PWF)

IDWorkflowเวิร์กโฟลว์
WF-24 newUnified onboarding — person registers once (phone OTP → verification level), founds or joins a party, requests the first capacity; per-capacity verification branches. Replaces the six separate group onboardings as the single entry.การขึ้นทะเบียนรวม — บุคคลลงทะเบียนครั้งเดียว (OTP → ระดับยืนยัน) ตั้งหรือเข้าร่วมผู้เล่น ขอ capacity แรก; แขนงการยืนยันราย capacity แทนการขึ้นทะเบียนแยกหกกลุ่มด้วยทางเข้าเดียว
WF-25 newCapacity extension — an existing party requests an additional capacity (the drone farmer, the mill service arm); verification, approval authority (Q1), entitlement recompile, exclusivity check (NFR-16).การขยาย capacity — ผู้เล่นเดิมขอ capacity เพิ่ม (ชาวไร่โดรน หน่วยบริการโรงงาน); การยืนยัน อำนาจอนุมัติ (Q1) คอมไพล์สิทธิ์ใหม่ ตรวจเอกสิทธิ์ (NFR-16)
WF-26 newSession & party switching — sign-in, party-context choice, token issue/re-issue, offline JWS issuance for field surfaces (Section 10).session และการสลับผู้เล่น — ลงชื่อเข้าใช้ เลือกบริบทผู้เล่น ออก/ออกซ้ำ token และออก JWS ออฟไลน์สำหรับช่องทางภาคสนาม (ข้อ 10)
WF-27 newPlatform view-as — start (permission gate), banner, dual-logged actions, end; read-only default (Q5).view-as ของ platform — เริ่ม (ประตู permission) แบนเนอร์ บันทึกคู่ จบ; อ่านอย่างเดียวโดยปริยาย (Q5)
WF-01 extendVirtual-farmer claiming becomes person-claiming: the unclaimed person attached to the virtual party is claimed by phone verification; continuity promise unchanged.การอ้างสิทธิ์ลูกไร่ virtual กลายเป็นการอ้างสิทธิ์บุคคล: บุคคลที่ยังไม่อ้างสิทธิ์บนผู้เล่น virtual ถูกอ้างด้วยการยืนยันเบอร์; คำมั่นความต่อเนื่องคงเดิม
WF-13…15 extendConsent, scoring & origination run on party↔party ConsentGrant (X1); scorecards select by capacity.ความยินยอม การให้คะแนน และการออกสินเชื่อ วิ่งบน ConsentGrant ผู้เล่น↔ผู้เล่น (X1); เกณฑ์ประเมินเลือกตาม capacity
WF-18 extendContractor onboarding becomes a WF-24/25 specialization — the contractor capacity's verification branch; the freelance→org upgrade becomes a capacity move (Section 5.4).การขึ้นทะเบียนผู้รับเหมากลายเป็นกรณีเฉพาะของ WF-24/25 — แขนงยืนยันของ capacity ผู้รับเหมา; การอัปเกรดฟรีแลนซ์→องค์กรกลายเป็นการย้าย capacity (ข้อ 5.4)

13. Requirements additions13. ข้อกำหนดที่เพิ่ม

IDRequirementข้อกำหนดSurfacesช่องทางใช้งานPriorityความสำคัญ
FR-60One federated sign-in per person (phone OTP + external OIDC providers); party-context switcher; exactly one active party per token; re-issue on switchลงชื่อเข้าใช้สหพันธ์หนึ่งครั้งต่อบุคคล (OTP + OIDC ภายนอก); ตัวสลับผู้เล่น; หนึ่งผู้เล่นที่ใช้งานต่อ token; ออก token ใหม่เมื่อสลับaccount, allP0
FR-61Party & capacity management: found party, request/grant/suspend/revoke capacities, per-capacity verification levels, exclusivity enforcementการจัดการผู้เล่นและ capacity: ตั้งผู้เล่น ขอ/ให้/พัก/ถอน capacity ระดับยืนยันราย capacity บังคับเอกสิทธิ์accountP0
FR-62Entitlement compiler: srf = union of the Section 6.1 matrix over active capacities; surface switcher renders exactly the claimตัวคอมไพล์สิทธิ์: srf = ยูเนียนของตาราง ข้อ 6.1 เหนือ capacity ที่ active; ตัวสลับช่องทางแสดงตรงตาม claim เป๊ะaccount, allP0
FR-63Memberships & surface-role grants: invite by phone, one role per surface per membership, owner fixed-full, template role sets per capacityสมาชิกภาพและสิทธิ์บทบาทรายช่องทาง: เชิญด้วยเบอร์ หนึ่งบทบาทต่อช่องทางต่อสมาชิกภาพ owner เต็มถาวร ชุดบทบาทแม่แบบราย capacityaccountP0
FR-64Permission catalogs & role × permission matrix authoring per surface, owner column locked, locked chips for unreachable surfacescatalog permission และการกำหนดตารางบทบาท × permission รายช่องทาง คอลัมน์ owner ล็อก ชิปล็อกสำหรับช่องทางที่เข้าไม่ได้accountP1
FR-65Scope overrides: province / district / mill_zone / quota_network / field_set, equal-or-narrower enforcedoverride ขอบเขต: จังหวัด / อำเภอ / เขตโรงงาน / เครือข่ายโควต้า / ชุดแปลง บังคับเท่าเดิมหรือแคบกว่าaccountP1
FR-66ConsentGrant generalized to party↔party with capacity-aware scopes; grant/revoke UI on account surfaceConsentGrant ขยายเป็นผู้เล่น↔ผู้เล่นพร้อมขอบเขตรับรู้ capacity; UI ให้/ถอนบนช่องทาง accountaccount, financeP0
FR-67Cross-party audit with dual attribution — acting party + acting person on every entryบันทึกข้ามผู้เล่นพร้อมระบุที่มาคู่ — ผู้เล่นที่กระทำ + บุคคลที่กระทำ ทุกรายการallP0
FR-68Platform view-as sessions: permission-gated start, persistent banner, dual logging, session recordsession view-as ของ platform: เริ่มแบบมีประตู permission แบนเนอร์ถาวร บันทึกคู่ เรกคอร์ด sessionaccount, portal, dispatchP1
FR-69Migration & merge tooling: tenant→party and user→person mapping, phone-verified assisted person merge, full audit of every mergeเครื่องมือย้ายและควบรวม: แมป tenant→party และ user→person การควบรวมบุคคลแบบมีผู้ช่วยยืนยันด้วยเบอร์ บันทึกทุกการควบรวมครบaccount (admin)(ผู้ดูแล)P0
IDNon-functionalไม่ใช่หน้าที่
NFR-14Person uniqueness & PDPA: one verified phone = one person platform-wide; person data minimized, purpose-bound, erasable by anonymization [R6]; merges consent-confirmed and logged.เอกลักษณ์บุคคลและ PDPA: หนึ่งเบอร์ยืนยัน = หนึ่งบุคคลทั้ง platform; ข้อมูลบุคคลเก็บน้อยที่สุด ผูกวัตถุประสงค์ ลบได้ด้วยการทำนิรนาม [R6]; การควบรวมยืนยันด้วยความยินยอมและบันทึกเสมอ
NFR-15Compiler bind: the compiled srf and perm claims must equal the authored model (Section 6.1 matrix, Section 7 matrices); a diverging resolver is a defect, never a spec change [R1] — the matrices are the tests.กฎผูกตัวคอมไพล์: claim srf และ perm ที่คอมไพล์ต้องเท่ากับ model ที่กำหนด (ตาราง ข้อ 6.1, ข้อ 7); ตัวตัดสินที่คลาดเคลื่อนคือ defect ไม่ใช่การแก้ spec [R1] — ตารางคือชุดทดสอบ
NFR-16Capacity exclusivity invariant: an active bank or government capacity coexists with no other active capacity on the same party — enforced at grant time and re-checked at every compile.กฎเอกสิทธิ์ capacity: capacity bank หรือ government ที่ active อยู่ร่วมกับ capacity อื่นบนผู้เล่นเดียวกันไม่ได้ — บังคับตอนให้สิทธิ์และตรวจซ้ำทุกครั้งที่คอมไพล์
NFR-17Token budget: 4 KB JWE for encrypted tokens; JWS for the offline field surfaces with a bounded offline window (Q6); nothing unbounded in claims [R1].งบ token: JWE 4 KB สำหรับ token เข้ารหัส; JWS สำหรับช่องทางภาคสนามออฟไลน์พร้อมหน้าต่างออฟไลน์จำกัด (Q6); ไม่มีสิ่งไร้ขอบเขตใน claim [R1]

14. What happens to PROP-003 & PROP-004 — and the acceptance order14. ชะตาของ PROP-003 และ PROP-004 — และลำดับการอนุมัติ

Proposalข้อเสนอAmendment under PROP-005การแก้ไขภายใต้ PROP-005
PROP-003 (FIN)The bank customer group becomes the exclusive bank capacity; the finance surface gates on it; ConsentGrant re-homes to party↔party (X1) with its scopes intact; FIN roles become the finance surface's default role set. No lending behaviour changes.กลุ่มธนาคารกลายเป็น capacity bank แบบเอกสิทธิ์; ช่องทาง finance คุมด้วยมัน; ConsentGrant ย้ายเป็นผู้เล่น↔ผู้เล่น (X1) โดยขอบเขตคงเดิม; บทบาท FIN เป็นชุดบทบาทปริยายของช่องทาง finance พฤติกรรมสินเชื่อไม่เปลี่ยน
PROP-004 (CEC)The contractor becomes a capacity, not a sixth group (resolving the reviewer's "decide for me"): dispatch + crew gate on it; Section 5.1's freelance|organization duality collapses into party kind; Q3's affiliated tenant is abolished in favor of the mill/quota party holding the contractor capacity with mandatory marketplace disclosure (Section 8.3); WF-18 becomes a WF-24/25 branch. Everything the marketplace runs on — offerings, work orders, ratings, books — is untouched; the CEC perspective re-keys from group to capacity.ผู้รับเหมากลายเป็น capacity ไม่ใช่กลุ่มที่หก (ปิดประเด็น "ตัดสินให้" ของผู้ทบทวน): dispatch + crew คุมด้วยมัน; ทวิภาวะ freelance|organization ของ ข้อ 5.1 ยุบเป็น kind ของผู้เล่น; tenant ในเครือของ Q3 ถูกยกเลิก แทนด้วยผู้เล่นโรงงาน/โควต้าที่ถือ capacity ผู้รับเหมาพร้อมการเปิดเผยในตลาดภาคบังคับ (ข้อ 8.3); WF-18 เป็นแขนงของ WF-24/25 ทุกอย่างที่ตลาดใช้ — รายการบริการ ใบสั่งงาน คะแนน บัญชี — ไม่แตะ; มุมมอง CEC เปลี่ยนคีย์จากกลุ่มเป็น capacity
PROP-001 / 02Virtual farmers become parties with unclaimed persons (WF-01 extension); the perspective machinery keys by capacity instead of group — document families (CFC/CFQ/MILL/GOV/FIN/CEC) keep their codes.ลูกไร่ virtual เป็นผู้เล่นที่มีบุคคลยังไม่อ้างสิทธิ์ (ส่วนขยาย WF-01); กลไกมุมมองเปลี่ยนคีย์จากกลุ่มเป็น capacity — ตระกูลเอกสาร (CFC/CFQ/MILL/GOV/FIN/CEC) คงรหัสเดิม
Acceptance orderลำดับการอนุมัติ PROP-005 presupposes PROP-003 and PROP-004. Recommended: accept 03 → 04 → 05 as one train, applying the graph once at the end (3.x → 6.0) with capacities in place from the start — cheaper than building group-keyed structures in 5.0 and re-keying them in 6.0. If 03/04 must ship first, the Section 5.4 migration table is the contract. PROP-005 ตั้งอยู่บน PROP-003 และ PROP-004 แนะนำ: อนุมัติ 03 → 04 → 05 เป็นขบวนเดียว แล้วปรับ graph ครั้งเดียวตอนท้าย (3.x → 6.0) โดยมี capacity ตั้งแต่ต้น — ถูกกว่าสร้างโครงสร้างคีย์กลุ่มใน 5.0 แล้วเปลี่ยนคีย์ใน 6.0 หาก 03/04 ต้องไปก่อน ตาราง ข้อ 5.4 คือสัญญาการย้าย

15. Navigation & information-architecture changes15. การเปลี่ยนแปลงการนำทางและสถาปัตยกรรมสารสนเทศ

16. Glossary additions16. ศัพท์ที่เพิ่มในอภิธาน

สหพันธ์อัตลักษณ์ (identity federation) · บุคคล (person) · ผู้เล่น (party) · บทบาทความสามารถ / capacity · สมาชิกภาพ (membership) · บริบทผู้เล่น (party context) · ตัวสลับผู้เล่น (party switcher) · สิทธิ์เข้าช่องทาง (surface entitlement) · บทบาทเต็มถาวร (fixed-full role / owner) · เอกสิทธิ์ (capacity exclusivity) · การสวมสิทธิ์แบบตรวจสอบได้ (audited view-as) · ตัวคอมไพล์ claim (claims compiler) · งบ token (token budget).

สหพันธ์อัตลักษณ์ (identity federation) · บุคคล (person) · ผู้เล่น (party) · บทบาทความสามารถ / capacity · สมาชิกภาพ (membership) · บริบทผู้เล่น (party context) · ตัวสลับผู้เล่น (party switcher) · สิทธิ์เข้าช่องทาง (surface entitlement) · บทบาทเต็มถาวร (fixed-full role / owner) · เอกสิทธิ์ (capacity exclusivity) · การสวมสิทธิ์แบบตรวจสอบได้ (audited view-as) · ตัวคอมไพล์ claim (claims compiler) · งบ token (token budget)

17. Spec impact matrix17. ตารางผลกระทบต่อเอกสาร spec

ArtifactเอกสารChangeการเปลี่ยนแปลงRev
spec-graph.jsoncustomerGroups → capacities (+ exclusivity rules), +1 surface (account), +8 entities, +1 context (federation, absorbing network_identity), ~30 relationships re-keyed to party_id, +14 events, +4 workflows + WF-01/13…15/18 extensions, FR-60…69, NFR-14…17, federation block (matrix + claims), glossary — change FIRSTcustomerGroups → capacities (+ กฎเอกสิทธิ์), +1 ช่องทางใช้งาน (account), +8 entity, +1 บริบท (federation ควบรวม network_identity), ~30 ความสัมพันธ์เปลี่ยนคีย์เป็น party_id, +14 เหตุการณ์, +4 เวิร์กโฟลว์ + ส่วนขยาย WF-01/13…15/18, FR-60…69, NFR-14…17, บล็อก federation (ตาราง + claim), อภิธาน — แก้ก่อนเสมอ5.0 → 6.0
SPEC-APPAccount surface, capacities table, normative entitlement matrix, role model rewrite (Section 6), FR/NFR additions — the largest single-document revision of the seriesช่องทาง account ตาราง capacity ตารางสิทธิ์บรรทัดฐาน model บทบาทเขียนใหม่ (ข้อ 6) FR/NFR เพิ่ม — การแก้เอกสารเดี่ยวครั้งใหญ่ที่สุดของชุด4.0 → 5.0
SPEC-PRDGroups → capacities across goals & segments; onboarding story unified (WF-24)กลุ่ม → capacity ทั้งเป้าหมายและกลุ่มเป้า; เรื่องราวขึ้นทะเบียนรวมเป็นหนึ่ง (WF-24)4.0 → 5.0
SPEC-ERDFederation entities Section 5.3/Section 6.2/Section 7; Tenant/User migration mapping; every *_party_type pair collapses to party_idEntity สหพันธ์ ข้อ 5.3/ข้อ 6.2/ข้อ 7; การแมปย้าย Tenant/User; ทุกคู่ *_party_type ยุบเป็น party_id5.0 → 6.0
SPEC-DDDfederation context, consumption architecture, events Section 11, glossary Section 16บริบท federation สถาปัตยกรรมการบริโภค เหตุการณ์ ข้อ 11 อภิธาน ข้อ 165.0 → 6.0
SPEC-PWFWF-24…27 + extensions Section 12; onboarding diagrams re-rooted at the unified entryWF-24…27 + ส่วนขยาย ข้อ 12; แผนภาพขึ้นทะเบียนย้ายรากสู่ทางเข้ารวม5.0 → 6.0
SPEC-UIXParty switcher, capacity onboarding, account console, locked/explain states, view-as banner — seeded by the exhibitตัวสลับผู้เล่น การขอ capacity console account สถานะล็อก/อธิบาย แบนเนอร์ view-as — ตั้งต้นจากเอกสารแนบ4.0 → 5.0
PROP-003 · PROP-004Amended per Section 14 on the same acceptance train; their perspective documents re-key to capacitiesแก้ตาม ข้อ 14 ในขบวนอนุมัติเดียวกัน; เอกสารรายมุมมองเปลี่ยนคีย์เป็น capacity—
SPEC-INDEX + CLAUDE.md filesCapacity vocabulary, +1 surface, exhibit linksศัพท์ capacity, +1 ช่องทางใช้งาน, ลิงก์เอกสารแนบ—

18. Open questions18. คำถามเปิด

#QuestionคำถามProposed defaultค่าเริ่มต้นที่เสนอ
Q1Capacity approval authority — who verifies each capacity claim?อำนาจอนุมัติ capacity — ใครตรวจยืนยันคำขอแต่ละ capacity?grower: evidence-based self-serve; contractor: id-verification + platform review; quota & mill: confirmed against the mill/สอน. registry; bank: BOT license, platform-admin gated; government: appointment. Table finalized in SPEC-APP on acceptance.grower: หลักฐานแบบบริการตนเอง; contractor: ยืนยันตัวตน + ตรวจโดย platform; quota และ mill: ยืนยันกับทะเบียนโรงงาน/สอน.; bank: ใบอนุญาต ธปท. ผ่านผู้ดูแล platform; government: การแต่งตั้ง ตารางสรุปใน SPEC-APP เมื่ออนุมัติ
Q2External identity providers — which, and does e-KYC (ThaID / NDID) back the national_id / ekyc levels?ผู้ให้บริการอัตลักษณ์ภายนอก — เจ้าใด และ e-KYC (ThaID / NDID) รองรับระดับ national_id / ekyc หรือไม่?LINE first (Thai ubiquity), Google/Microsoft second; ThaID targeted for the ekyc level — integration study before acceptance.LINE ก่อน (แพร่หลายในไทย) Google/Microsoft ตาม; เล็ง ThaID สำหรับระดับ ekyc — ศึกษาการเชื่อมก่อนอนุมัติ
Q3Person merge & PDPA erasure — the exact merge protocol and what anonymization preserves?การควบรวมบุคคลและการลบตาม PDPA — พิธีการควบรวมและการทำนิรนามเก็บอะไรไว้?Merge only on verified-phone match + OTP confirmation on both sides; anonymization keeps party records and aggregates, severs the person link [R6].ควบรวมเฉพาะเบอร์ยืนยันตรงกัน + OTP ยืนยันทั้งสองฝั่ง; การทำนิรนามเก็บเรกคอร์ดผู้เล่นและค่าสรุป ตัดลิงก์บุคคล [R6]
Q4Does the quota capacity imply grower?capacity quota พ่วง grower โดยนัยหรือไม่?No — separate grants; the triple-capacity quota org (Section 6.3) shows explicit is cheap and auditable.ไม่ — ให้แยกกัน; องค์กรโควต้าสาม capacity (ข้อ 6.3) พิสูจน์ว่าการให้ชัดแจ้งถูกและตรวจสอบได้
Q5View-as write enforcement — read-only, or member-effective permissions?การบังคับฝั่งเขียนของ view-as — อ่านอย่างเดียว หรือตามสิทธิ์สมาชิก?Read-only default with explicit, permission-named exceptions; the source names this as its own open gap [R1] — we adopt the stricter default.อ่านอย่างเดียวโดยปริยาย ยกเว้นแบบระบุ permission ชัดแจ้ง; ต้นแบบประกาศเรื่องนี้เป็นช่องว่างเปิดของตัวเอง [R1] — เราเลือกค่าปริยายที่เข้มกว่า
Q6Offline JWS validity for crew/mobile — how long may a field token live without refresh?อายุ JWS ออฟไลน์ของ crew/mobile — token ภาคสนามอยู่ได้นานแค่ไหนโดยไม่ต่ออายุ?72-hour offline window, silent refresh on any connectivity; revocation list syncs on reconnect.หน้าต่างออฟไลน์ 72 ชั่วโมง ต่ออายุเงียบเมื่อมีสัญญาณ; รายการถอนซิงก์เมื่อกลับมาออนไลน์
Q7Does สอน. see the capacity graph (who is both mill and contractor)?สอน. เห็น graph capacity (ใครเป็นทั้งโรงงานและผู้รับเหมา) หรือไม่?Aggregate, anonymized structure reports only — mirrors PROP-003 Q7 / PROP-004 Q9.เฉพาะรายงานโครงสร้างแบบรวมไม่ระบุตัวตน — สะท้อน PROP-003 Q7 / PROP-004 Q9

19. References19. แหล่งอ้างอิง

  1. R1 — RiverSync SPEC-PRD-FED v0.9 — Federation: identity, roles & access (3 Jul 2026) and SPEC-DDD-FED (writer/consumer architecture): six-layer access model, tenant-type entitlement matrix + compiler bind, one role per app, fixed-full roles, per-app permission catalogs, narrow-only scope, three cross-tenant mechanisms, TEN-2 multi-role organizations, ASP.NET Identity base-vs-extension mapping, short-named claims + 4 KB JWE budget + JWS field exception, canonical persona discipline. claude.ai/design (shared project e7c56f3c…)
  2. R2 — wangkanai/federation: open-source ASP.NET Core authentication & authorization server — OAuth 2.1 (Authorization Code + PKCE, client credentials, refresh), OpenID Connect, JWT, external providers, consent; identity model with User · Role · Client · Resource · Scope · Directory · Group · Permission · Tenant. Apache-2.0. github.com/wangkanai/federation
  3. R3 — Microsoft ASP.NET Core Identity: the membership framework (AspNet* tables, external logins, phone/email confirmation, 2FA) this model extends, never replaces. learn.microsoft.com
  4. R4 — OAuth 2.1 (draft) & OpenID Connect Core 1.0 — the authorization and identity protocols the account authority speaks. oauth.net · openid.net
  5. R5 — RFC 8693, OAuth 2.0 Token Exchange — the actor-claim pattern behind audited view-as delegation. rfc-editor.org
  6. R6 — Personal Data Protection Act B.E. 2562 (2019) — lawful basis, purpose limitation, and erasure duties governing the Person record and consent rails. pdpc.or.th
  1. R1 — RiverSync SPEC-PRD-FED v0.9 — Federation: identity, roles & access (3 ก.ค. 2569) และ SPEC-DDD-FED (สถาปัตยกรรมผู้เขียน/ผู้บริโภค): model หกชั้น ตารางสิทธิ์ราย tenant-type + กฎผูกตัวคอมไพล์ หนึ่งบทบาทต่อแอป บทบาทเต็มถาวร catalog รายแอป ขอบเขตบีบแคบอย่างเดียว กลไกข้าม tenant สามอย่าง องค์กรหลายบทบาท TEN-2 ตารางฐาน-ส่วนขยาย ASP.NET Identity claim ชื่อสั้น + งบ JWE 4 KB + ข้อยกเว้น JWS ภาคสนาม วินัย persona อ้างอิง claude.ai/design (โปรเจกต์แชร์ e7c56f3c…)
  2. R2 — wangkanai/federation: เซิร์ฟเวอร์ยืนยันตัวตนและกำหนดสิทธิ์โอเพนซอร์สบน ASP.NET Core — OAuth 2.1 (Authorization Code + PKCE, client credentials, refresh), OpenID Connect, JWT, ผู้ให้บริการภายนอก, ความยินยอม; model อัตลักษณ์ User · Role · Client · Resource · Scope · Directory · Group · Permission · Tenant สัญญา Apache-2.0 github.com/wangkanai/federation
  3. R3 — Microsoft ASP.NET Core Identity: เฟรมเวิร์กสมาชิก (ตาราง AspNet*, การเข้าระบบภายนอก, ยืนยันเบอร์/อีเมล, 2FA) ที่ model นี้ขยาย ไม่แทนที่ learn.microsoft.com
  4. R4 — OAuth 2.1 (ร่าง) และ OpenID Connect Core 1.0 — โปรโตคอลการกำหนดสิทธิ์และอัตลักษณ์ที่ศูนย์ account ใช้สื่อสาร oauth.net · openid.net
  5. R5 — RFC 8693 OAuth 2.0 Token Exchange — แบบแผน actor claim เบื้องหลังการสวมสิทธิ์ view-as ที่ตรวจสอบได้ rfc-editor.org
  6. R6 — พ.ร.บ. คุ้มครองข้อมูลส่วนบุคคล พ.ศ. 2562 — ฐานทางกฎหมาย การจำกัดวัตถุประสงค์ และหน้าที่การลบ ที่กำกับเรกคอร์ดบุคคลและรางความยินยอม pdpc.or.th

20. Revision history20. ประวัติการแก้ไข

RevDateวันที่Changeการเปลี่ยนแปลง
1.008 Jul 2026Accepted. Applied graph-first as spec v6.0: graph customerGroups → capacities, +1 surface (account), +8 federation entities, +1 context (federation, absorbing network_identity), *_party_type → party_id convergence, +13 events, WF-24…27 + WF-01/13…15/18 extensions, FR-60…69, NFR-14…17, the federation block (entitlement matrix + token claims), glossary. Mirrored into SPEC-APP (5.0), SPEC-PRD (5.0), SPEC-ERD (6.0), SPEC-DDD (6.0), SPEC-PWF (6.0), SPEC-UIX (5.0), all perspective docs, SPEC-INDEX and the docs CLAUDE.md files.อนุมัติแล้ว นำไปใช้แบบ graph ก่อนเป็น spec v6.0: graph customerGroups → capacities, +1 ช่องทางใช้งาน (account), +8 entity สหพันธ์, +1 บริบท (federation ควบรวม network_identity), การยุบ *_party_type → party_id, +13 เหตุการณ์, WF-24…27 + ส่วนขยาย WF-01/13…15/18, FR-60…69, NFR-14…17, บล็อก federation (ตารางสิทธิ์ + claim token), อภิธาน สะท้อนเข้า SPEC-APP (5.0), SPEC-PRD (5.0), SPEC-ERD (6.0), SPEC-DDD (6.0), SPEC-PWF (6.0), SPEC-UIX (5.0), เอกสารรายมุมมองทั้งหมด SPEC-INDEX และไฟล์ CLAUDE.md
0.108 Jul 2026First draft for review — federated identity & multi-capacity party model adapted from RiverSync SPEC-PRD-FED (R1) on the wangkanai/federation foundation (R2): six-layer access model, Person/Party/PartyCapacity/Membership + SurfaceRoleGrant/PermissionCatalog/RolePermission/ViewAsSession, account surface (eighth), normative capacity × surface entitlement matrix + compiler bind, four cross-party mechanisms, marketplace capacity-disclosure divergence, token claim contract (4 KB JWE · field JWS), WF-24…27, FR-60…69, NFR-14…17, PROP-003/04 amendment plan & acceptance train, canonical population, interactive exhibit. Suffix code FED.ร่างแรกเพื่อพิจารณา — model อัตลักษณ์สหพันธ์และผู้เล่นหลาย capacity ดัดแปลงจาก RiverSync SPEC-PRD-FED (R1) บนรากฐาน wangkanai/federation (R2): model หกชั้น, Person/Party/PartyCapacity/Membership + SurfaceRoleGrant/PermissionCatalog/RolePermission/ViewAsSession, ช่องทาง account (ที่แปด), ตารางสิทธิ์ capacity × surface เชิงบรรทัดฐาน + กฎผูกตัวคอมไพล์, กลไกข้ามผู้เล่นสี่อย่าง, จุดแตกต่างการเปิดเผย capacity ในตลาด, สัญญา claim token (JWE 4 KB · JWS ภาคสนาม), WF-24…27, FR-60…69, NFR-14…17, แผนแก้ PROP-003/04 และขบวนอนุมัติ, ประชากรอ้างอิง, เอกสารแนบแบบโต้ตอบ รหัสต่อท้าย FED