feat(project): 4-tier roles (super/admin/pro/user), meeting header 구분
- app.store: role "pro" (ROLES, ROLE_LABELS); admin page grade select Admin / Pro user / User, super admin fixed to one account. - project.access: role_of, is_pro, is_project_admin. - router: _require_admin -> _require_pro (goals, meetings complete/delete, members, reorder, trash restore, assignable users); new project and project edit/owner change need Pro user+; task delete open to any member; project/section delete = Admin+ or creator; comment edit/delete of others and workload summary = Pro user+. Templates get pj_pro / pj_admin. - Weekly meeting table first header "구역" -> "구분". - Docs (CLAUDE.md, PROJECT_MODULE 6-14, overview, help page) and tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -89,6 +89,7 @@ if ENABLED:
|
||||
|
||||
RUN = uuid.uuid4().hex[:6]
|
||||
ADMIN = USERS.add(f"admin-{RUN}@test.local", role="admin")
|
||||
PRO = USERS.add(f"pro-{RUN}@test.local", role="pro") # Pro user(2026-10-12)
|
||||
SUPER = USERS.add("king@dbxcorp.co.kr", role="admin", super_=True)
|
||||
ALICE = USERS.add(f"alice-{RUN}@test.local")
|
||||
BOB = USERS.add(f"bob-{RUN}@test.local")
|
||||
@@ -118,18 +119,19 @@ def _count(sql: str, *args) -> int:
|
||||
|
||||
|
||||
# ════════════════════════════════════════════════════════════
|
||||
# [07] 소유자 변경은 관리자만
|
||||
# [07] 프로젝트 수정·소유자 변경은 Pro user 이상(2026-10-12)
|
||||
# ════════════════════════════════════════════════════════════
|
||||
def test_owner_change_admin_only():
|
||||
# 관리자도 멤버가 아닌 프로젝트는 못 다룬다(2026-10-07) — 소유자를 남에게 넘긴 뒤에도 바꿀 수 있게 멤버로 둔다
|
||||
p = _project("P-owner", ADMIN, (BOB, ADMIN))
|
||||
p = _project("P-owner", ADMIN, (BOB, ADMIN, PRO))
|
||||
r = req("PUT", f"/project/api/projects/{p['id']}", BOB, json={"owner_email": BOB})
|
||||
assert r.status_code == 403, r.text
|
||||
assert ST.get_project(project_id=p["id"])["owner_email"] == ADMIN
|
||||
r = req("PUT", f"/project/api/projects/{p['id']}", BOB, json={"owner_email": CAROL, "name": "x"})
|
||||
assert r.status_code == 403 and ST.get_project(project_id=p["id"])["name"] != "x"
|
||||
# 같은 값을 같이 보내는 건(화면 저장) 통과
|
||||
assert req("PUT", f"/project/api/projects/{p['id']}", BOB, json={"owner_email": ADMIN, "name": "ok"}).status_code == 200
|
||||
# User 는 이름만 바꾸는 것도 안 된다, Pro user 멤버는 된다(같은 소유자 값을 같이 보내는 화면 저장 포함)
|
||||
assert req("PUT", f"/project/api/projects/{p['id']}", BOB, json={"name": "no"}).status_code == 403
|
||||
assert req("PUT", f"/project/api/projects/{p['id']}", PRO, json={"owner_email": ADMIN, "name": "ok"}).status_code == 200
|
||||
# 관리자: 모듈 권한 없는 사람은 소유자 불가, 정상 사용자는 가능
|
||||
assert req("PUT", f"/project/api/projects/{p['id']}", ADMIN, json={"owner_email": EVE}).status_code == 400
|
||||
assert req("PUT", f"/project/api/projects/{p['id']}", ADMIN, json={"owner_email": CAROL}).status_code == 200
|
||||
@@ -137,10 +139,10 @@ def test_owner_change_admin_only():
|
||||
# 소유자에서 빠지면(관리자가 다시 바꿈) 멤버가 아닌 CAROL 은 관리 권한을 잃는다
|
||||
assert req("PUT", f"/project/api/projects/{p['id']}", ADMIN, json={"owner_email": ADMIN}).status_code == 200
|
||||
assert req("GET", f"/project/api/projects/{p['id']}/snapshot", CAROL).status_code == 403
|
||||
# 생성: 비관리자가 남을 소유자로 지정 → 거절, 본인·미지정 → 본인이 소유자
|
||||
assert req("POST", "/project/api/projects", BOB, json={"name": "n1", "owner_email": CAROL}).status_code == 403
|
||||
r = req("POST", "/project/api/projects", BOB, json={"name": "n2"})
|
||||
assert r.status_code == 201 and r.json()["project"]["owner_email"] == BOB
|
||||
# 생성: User 는 새 프로젝트 불가, Pro user 는 본인·미지정 → 본인이 소유자
|
||||
assert req("POST", "/project/api/projects", BOB, json={"name": "n1"}).status_code == 403
|
||||
r = req("POST", "/project/api/projects", PRO, json={"name": "n2"})
|
||||
assert r.status_code == 201 and r.json()["project"]["owner_email"] == PRO
|
||||
|
||||
|
||||
# ════════════════════════════════════════════════════════════
|
||||
@@ -152,8 +154,10 @@ def test_delete_requires_current_access():
|
||||
t = req("POST", f"/project/api/projects/{p['id']}/tasks", ALICE, json={"title": "alice task", "stage_id": s["id"]}).json()["task"]
|
||||
ST.add_comment(task_id=t["id"], author_email=ALICE, author_name="a", body="hi")
|
||||
trash_before = _count("SELECT COUNT(*) AS n FROM project_trash")
|
||||
# 현재 멤버인 타인 → 생성자 규칙으로 거절
|
||||
assert req("DELETE", f"/project/api/tasks/{t['id']}", BOB).status_code == 403
|
||||
# 작업 삭제는 멤버 누구나(2026-10-12) — 남(BOB)이 만든 작업도 ALICE 가 지울 수 있다
|
||||
t_bob = req("POST", f"/project/api/projects/{p['id']}/tasks", BOB, json={"title": "bob task", "stage_id": s["id"]}).json()["task"]
|
||||
assert req("DELETE", f"/project/api/tasks/{t_bob['id']}", ALICE).status_code == 200
|
||||
trash_before = _count("SELECT COUNT(*) AS n FROM project_trash")
|
||||
# 멤버에서 빠진 생성자 → 거절, 행·댓글·휴지통 변화 없음
|
||||
ST.remove_member(project_id=p["id"], user_email=ALICE)
|
||||
assert req("DELETE", f"/project/api/tasks/{t['id']}", ALICE).status_code == 403
|
||||
@@ -360,7 +364,7 @@ def test_date_range_validation():
|
||||
assert req("PUT", pu, BOB, json={"start_date": "2026-11-01", "due_date": "2026-10-01"}).status_code == 400
|
||||
assert req("PUT", pu, BOB, json={"due_date": "2026-10-01"}).status_code == 200
|
||||
assert req("PUT", pu, BOB, json={"start_date": "2026-11-01"}).status_code == 400
|
||||
assert req("POST", "/project/api/projects", BOB, json={"name": "d", "start_date": "2026-11-02", "due_date": "2026-11-01"}).status_code == 400
|
||||
assert req("POST", "/project/api/projects", PRO, json={"name": "d", "start_date": "2026-11-02", "due_date": "2026-11-01"}).status_code == 400
|
||||
|
||||
|
||||
# ════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user