Cane Agency · Change Proposal (ACCEPTED — applied graph-first as spec v6.0)สถาบันอ้อย · ข้อเสนอการเปลี่ยนแปลง (อนุมัติแล้ว — นำไปใช้แบบ graph (กราฟ) ก่อนเป็น spec (สเปก) v6.0)
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] — คือ บทบาทที่เพิ่มขึ้นขยายสิทธิ์ของผู้เล่น แต่ไม่มีวันฉีกอัตลักษณ์ของผู้เล่น
| Real actorผู้เล่นจริง | Capacities held at onceCapacity ที่ถือพร้อมกัน | What the single-group model forces todaymodel กลุ่มเดียวบังคับอะไรวันนี้ |
|---|---|---|
| Mill with a service armโรงงานที่มีหน่วยบริการ | mill + contractor | A 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 + contractor | Same duplication; his dispatcher must juggle two logins to serve one network.ซ้ำแบบเดียวกัน; ผู้จัดคิวงานต้องสลับสองบัญชีเพื่อรับใช้เครือข่ายเดียว |
| Quota farmer who grows his own caneหัวหน้าโควต้าที่ปลูกอ้อยเอง | quota + grower | Already fudged informally — his own crops ride inside his network as if he were his own sub-farmer.ทุกวันนี้เลี่ยงแบบไม่เป็นทางการ — อ้อยของตนวิ่งในเครือข่ายราวกับเป็นลูกไร่ของตัวเอง |
| Farmer with a spray droneชาวไร่ที่มีโดรนพ่นยา | grower + contractor | Must onboard twice — a farmer account and a freelance-contractor record — two profiles for one person and one phone.ต้องขึ้นทะเบียนสองครั้ง — บัญชีชาวไร่และเรกคอร์ดผู้รับเหมาฟรีแลนซ์ — สองโปรไฟล์สำหรับคนเดียว เบอร์เดียว |
| Contractor who takes on landผู้รับเหมาที่รับที่ดินมาปลูกเอง | contractor + grower | The 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)
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) เป็นผู้เขียนอัตลักษณ์รายเดียวที่แอปอื่นบริโภคผ่านตัวถอดรหัสกลาง
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]
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 · Permission | What 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) |
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) การเข้าร่วมตลาด และส่วนข้อมูลรายมุมมอง
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
| 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 การออกจากผู้เล่นหนึ่งไม่กระทบสมาชิกภาพอื่นของบุคคล |
| 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) ออกแบบรอสิ่งนี้ไว้พอดี |
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]
| CapacityCapacity | account | mobile | portal | dispatch | crew | finance | regulator |
|---|---|---|---|---|---|---|---|
| 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 — หนึ่งองค์กร ห้าไทล์ ศูนย์อัตลักษณ์ซ้ำ
| 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 ปนกัน
| Partyผู้เล่น | CapacitiesCapacity | Surface tilesไทล์ช่องทาง | Demonstratesสาธิต |
|---|---|---|---|
| Mitr Kaset millโรงงานน้ำตาลมิตรเกษตร org | mill + contractor | account · portal · dispatch · crew | The factory service arm — one org, no affiliated-tenant duplicate; its dispatch profile discloses the mill capacity (Section 8.3).หน่วยบริการโรงงาน — องค์กรเดียว ไม่มี tenant ในเครือซ้ำ; โปรไฟล์ dispatch เปิดเผย capacity โรงงาน (ข้อ 8.3) |
| หจก.โควต้าโคกสูง org | quota + grower + contractor | account · mobile · portal · dispatch · crew | Triple capacity: network head, own cane, machinery pool — the widest legal union.สาม capacity: หัวหน้าเครือข่าย อ้อยของตนเอง กองเครื่องจักร — ยูเนียนกว้างสุดที่ถูกกฎ |
| บุญส่ง (ลูกไร่) individual | grower | account · mobile | The unchanged base case — most parties stay single-capacity.กรณีฐานที่ไม่เปลี่ยน — ผู้เล่นส่วนใหญ่ยังถือ capacity เดียว |
| บุญมี (โดรน) individual | grower + contractor | account · mobile · dispatch · crew | The drone moonlighter — one onboarding, second capacity added in-app (WF-25); ratings and books on one record.ชาวไร่ผันโดรน — ขึ้นทะเบียนครั้งเดียว เพิ่ม capacity ที่สองในแอป (WF-25); คะแนนและบัญชีบนเรกคอร์ดเดียว |
| ธ.ก.ส. org | bank excl. | account · finance | Exclusivity enforced — the invariant, not a convention (NFR-16).เอกสิทธิ์ถูกบังคับ — เป็นกฎคงที่ ไม่ใช่ธรรมเนียม (NFR-16) |
| สอน. org | government excl. | account · regulator | Supervisory neutrality preserved.คงความเป็นกลางเชิงกำกับ |
| Person: สมชายบุคคล: สมชาย PSN | member 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 ของผู้เล่นผู้ปลูกของตน — เบอร์เดียว ลงชื่อครั้งเดียว สลับผู้เล่นระหว่างกัน |
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] |
| # | Mechanismกลไก | Ruleกฎ |
|---|---|---|
| X1 | ConsentGrant (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 คงเดิม |
| X2 | Network 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 เป็นการอ่านตามเรกคอร์ดความสัมพันธ์ ไม่ใช่อภิสิทธิ์ของกลุ่ม — องค์กรโควต้าเห็นแปลงเครือข่ายเพราะเรกคอร์ดความสัมพันธ์ ไม่ว่ามันจะเป็นอะไรอย่างอื่นอีก |
| X3 | Marketplace 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) — สิทธิ์อ่านเกิดจากการเผยแพร่สู่ตลาด และจำกัดเท่าที่เผยแพร่ |
| X4 | Platform view-asview-as ของ platform | Platform 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 — วินัยประกาศช่องว่างตามต้นแบบ |
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 และชื่อผู้สนับสนุน
| 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-as | Persistent 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 คงเดิม) |
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 |
|---|---|---|
| Person | AspNetUsers (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 · Membership | federation'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) |
| SurfaceRoleGrant | AspNetRoles + AspNetUserRoles | SurfaceKey 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 · scope | federation's Identity Permission & Scope [R2] + role claimsIdentity Permission & Scope ของ federation [R2] + role claims | Authored 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] |
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]
| Claim | Carriesบรรทุก |
|---|---|
| sub | The person (PSN id) — stable across every party context (Section 5.2).บุคคล (รหัส PSN) — คงที่ทุกบริบทผู้เล่น (ข้อ 5.2) |
| pty | The active party of this session — exactly one (FR-60); switching parties re-issues the token.ผู้เล่นที่ใช้งานของ session นี้ — หนึ่งเดียว (FR-60); สลับผู้เล่นออก token ใหม่ |
| cap | The party's active capacity set — drives capacity-conditional UI (e.g. the disclosure chip, Section 8.3).ชุด capacity ที่ active ของผู้เล่น — ขับ UI ตามเงื่อนไข capacity (เช่น ชิปเปิดเผยสังกัด ข้อ 8.3) |
| srf | Entitled 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] |
| perm | Permissions and scope, packed by a deterministic codec — no standalone scope claim (token budget) [R1].permission และขอบเขต แพ็กด้วย codec เชิงกำหนด — ไม่มี claim ขอบเขตแยก (งบ token) [R1] |
| ver | Person verification level + per-capacity verification flags — gates locked states (Section 8.3).ระดับการยืนยันบุคคล + ธงยืนยันราย capacity — ประตูสถานะล็อก (ข้อ 8.3) |
| act · vas | View-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) |
| New eventเหตุการณ์ใหม่ | Producerผู้ผลิต | Consumersผู้บริโภค |
|---|---|---|
| PersonRegistered · PersonMerged | federation | all surfaces, audit |
| PartyCreated · CapacityGranted · CapacitySuspended · CapacityRevoked | federation | service_marketplace, lending, regulator reports, audit |
| MembershipActivated · MembershipLeft · SurfaceRoleGranted · SurfaceRoleRevoked | federation | all surfaces (shell nav), audit |
| PartyContextIssued | federation | audit (session forensics)(นิติวิทยา session) |
| ViewAsStarted · ViewAsEnded | federation | the viewed party's audit + platform auditบันทึกของผู้เล่นที่ถูกดู + บันทึก platform |
| ID | Workflowเวิร์กโฟลว์ |
|---|---|
| WF-24 new | Unified 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 new | Capacity 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 new | Session & 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 new | Platform view-as — start (permission gate), banner, dual-logged actions, end; read-only default (Q5).view-as ของ platform — เริ่ม (ประตู permission) แบนเนอร์ บันทึกคู่ จบ; อ่านอย่างเดียวโดยปริยาย (Q5) |
| WF-01 extend | Virtual-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 extend | Consent, scoring & origination run on party↔party ConsentGrant (X1); scorecards select by capacity.ความยินยอม การให้คะแนน และการออกสินเชื่อ วิ่งบน ConsentGrant ผู้เล่น↔ผู้เล่น (X1); เกณฑ์ประเมินเลือกตาม capacity |
| WF-18 extend | Contractor 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) |
| ID | Requirementข้อกำหนด | Surfacesช่องทางใช้งาน | Priorityความสำคัญ |
|---|---|---|---|
| FR-60 | One 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, all | P0 |
| FR-61 | Party & capacity management: found party, request/grant/suspend/revoke capacities, per-capacity verification levels, exclusivity enforcementการจัดการผู้เล่นและ capacity: ตั้งผู้เล่น ขอ/ให้/พัก/ถอน capacity ระดับยืนยันราย capacity บังคับเอกสิทธิ์ | account | P0 |
| FR-62 | Entitlement 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, all | P0 |
| FR-63 | Memberships & surface-role grants: invite by phone, one role per surface per membership, owner fixed-full, template role sets per capacityสมาชิกภาพและสิทธิ์บทบาทรายช่องทาง: เชิญด้วยเบอร์ หนึ่งบทบาทต่อช่องทางต่อสมาชิกภาพ owner เต็มถาวร ชุดบทบาทแม่แบบราย capacity | account | P0 |
| FR-64 | Permission catalogs & role × permission matrix authoring per surface, owner column locked, locked chips for unreachable surfacescatalog permission และการกำหนดตารางบทบาท × permission รายช่องทาง คอลัมน์ owner ล็อก ชิปล็อกสำหรับช่องทางที่เข้าไม่ได้ | account | P1 |
| FR-65 | Scope overrides: province / district / mill_zone / quota_network / field_set, equal-or-narrower enforcedoverride ขอบเขต: จังหวัด / อำเภอ / เขตโรงงาน / เครือข่ายโควต้า / ชุดแปลง บังคับเท่าเดิมหรือแคบกว่า | account | P1 |
| FR-66 | ConsentGrant generalized to party↔party with capacity-aware scopes; grant/revoke UI on account surfaceConsentGrant ขยายเป็นผู้เล่น↔ผู้เล่นพร้อมขอบเขตรับรู้ capacity; UI ให้/ถอนบนช่องทาง account | account, finance | P0 |
| FR-67 | Cross-party audit with dual attribution — acting party + acting person on every entryบันทึกข้ามผู้เล่นพร้อมระบุที่มาคู่ — ผู้เล่นที่กระทำ + บุคคลที่กระทำ ทุกรายการ | all | P0 |
| FR-68 | Platform view-as sessions: permission-gated start, persistent banner, dual logging, session recordsession view-as ของ platform: เริ่มแบบมีประตู permission แบนเนอร์ถาวร บันทึกคู่ เรกคอร์ด session | account, portal, dispatch | P1 |
| FR-69 | Migration & 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 |
| ID | Non-functionalไม่ใช่หน้าที่ |
|---|---|
| NFR-14 | Person 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-15 | Compiler 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-16 | Capacity 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-17 | Token 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] |
| 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 / 02 | Virtual 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) คงรหัสเดิม |
สหพันธ์อัตลักษณ์ (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)
| Artifactเอกสาร | Changeการเปลี่ยนแปลง | Rev |
|---|---|---|
| spec-graph.json | customerGroups → 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-APP | Account 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-PRD | Groups → capacities across goals & segments; onboarding story unified (WF-24)กลุ่ม → capacity ทั้งเป้าหมายและกลุ่มเป้า; เรื่องราวขึ้นทะเบียนรวมเป็นหนึ่ง (WF-24) | 4.0 → 5.0 |
| SPEC-ERD | Federation 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_id | 5.0 → 6.0 |
| SPEC-DDD | federation context, consumption architecture, events Section 11, glossary Section 16บริบท federation สถาปัตยกรรมการบริโภค เหตุการณ์ ข้อ 11 อภิธาน ข้อ 16 | 5.0 → 6.0 |
| SPEC-PWF | WF-24…27 + extensions Section 12; onboarding diagrams re-rooted at the unified entryWF-24…27 + ส่วนขยาย ข้อ 12; แผนภาพขึ้นทะเบียนย้ายรากสู่ทางเข้ารวม | 5.0 → 6.0 |
| SPEC-UIX | Party 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-004 | Amended per Section 14 on the same acceptance train; their perspective documents re-key to capacitiesแก้ตาม ข้อ 14 ในขบวนอนุมัติเดียวกัน; เอกสารรายมุมมองเปลี่ยนคีย์เป็น capacity | — |
| SPEC-INDEX + CLAUDE.md files | Capacity vocabulary, +1 surface, exhibit linksศัพท์ capacity, +1 ช่องทางใช้งาน, ลิงก์เอกสารแนบ | — |
| # | Questionคำถาม | Proposed defaultค่าเริ่มต้นที่เสนอ |
|---|---|---|
| Q1 | Capacity 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 เมื่ออนุมัติ |
| Q2 | External 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 — ศึกษาการเชื่อมก่อนอนุมัติ |
| Q3 | Person 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] |
| Q4 | Does 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) พิสูจน์ว่าการให้ชัดแจ้งถูกและตรวจสอบได้ |
| Q5 | View-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] — เราเลือกค่าปริยายที่เข้มกว่า |
| Q6 | Offline 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 ชั่วโมง ต่ออายุเงียบเมื่อมีสัญญาณ; รายการถอนซิงก์เมื่อกลับมาออนไลน์ |
| Q7 | Does สอน. 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 |
| Rev | Dateวันที่ | Changeการเปลี่ยนแปลง |
|---|---|---|
| 1.0 | 08 Jul 2026 | Accepted. 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.1 | 08 Jul 2026 | First 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 |