feat(M02): 조합 키 하나 읽기 /api/m02/combos/key/{키} — 어느 층이든 · 그 층 읽기 권한(PLAN 27-2c 서버)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BU9gbNE3aWFUvE61pS2WGt
This commit is contained in:
@@ -84,6 +84,17 @@ def find(key: str) -> dict[str, Any] | None:
|
||||
return next((r for r in _rows_at(_file(key)) if str(r.get("키")) == key), None)
|
||||
|
||||
|
||||
def where(key: str) -> tuple[str, str | None] | None:
|
||||
"""키의 층 · 주인 — ("system", None) · ("company", "7") · ("personal", "7/42") · 모르면 None."""
|
||||
key = str(key or "")
|
||||
got, path = _HEAD.match(key), _file(key)
|
||||
if key.startswith(MASTER) or path is None or not got:
|
||||
return ("system", None) if key.startswith(MASTER) else None
|
||||
if got[1] == "C":
|
||||
return ("company", got[2])
|
||||
return ("personal", f"{path.parent.parent.parent.name}/{got[2]}") # {회사}/{사용자}/templates
|
||||
|
||||
|
||||
def names() -> dict[str, str]:
|
||||
"""지금 층이 쓸 수 있는 조합 키 → 이름(마스터 · 회사 · 개인)."""
|
||||
out: dict[str, str] = {}
|
||||
|
||||
Reference in New Issue
Block a user