diff --git a/app/modules/cupang/templates/cupang/index.html b/app/modules/cupang/templates/cupang/index.html index 71ee8b4..0c7d16f 100644 --- a/app/modules/cupang/templates/cupang/index.html +++ b/app/modules/cupang/templates/cupang/index.html @@ -2,7 +2,7 @@ {% block head_extra %} {# 출고리스트 작성 팝업의 날짜 칸은 프로젝트 화면의 날짜 팝업을 그대로 쓴다 — project.js 는 PJ_LIB_ONLY 로 부품만 #} - + @@ -249,7 +249,7 @@ {% endblock %} {% block scripts %} - + {% endblock %} @@ -64,7 +64,7 @@ - + {% endif %} {% endblock %} diff --git a/app/modules/project/CLAUDE.md b/app/modules/project/CLAUDE.md index 509277a..be83feb 100644 --- a/app/modules/project/CLAUDE.md +++ b/app/modules/project/CLAUDE.md @@ -24,7 +24,8 @@ - **수퍼관리자(`SUPER_ADMIN_EMAIL` 한 명 고정, 추가 불가) > Admin(`role=admin`) > Pro user(`role=pro`) > User**. - 판단: `access.is_pro`(Pro user 이상)·`access.is_project_admin`(Admin 이상), 라우터 `_require_pro`, 화면 `pj_pro`·`pj_admin`(`_role_ctx`). `is_admin` 은 ERP 상단 관리자 메뉴용 그대로. pro 는 프로젝트 모듈 밖에서는 user 와 같다. -- Pro user 이상: 새 프로젝트·프로젝트 이름/색/아이콘/소유자 수정·멤버 배정(자기가 멤버인 프로젝트)·사이드바 순서·남의 댓글 수정/삭제·휴지통·전체 보기·담당자별 합계·전체 멤버·소유자 변경. +- Pro user 이상: 새 프로젝트·프로젝트 이름/색/아이콘/소유자 수정·멤버 배정(자기가 멤버인 프로젝트)·사이드바 순서·남의 댓글 수정/삭제·휴지통·담당자별 합계·전체 멤버·소유자 변경. +- 전체 보기 메뉴 = Project 옵션 대상자(아래 "Project 옵션" 절, `access.can_all_view`, 화면 `pj_all_view`). - Admin 이상 또는 만든 사람: 프로젝트·섹션 삭제. 멤버 누구나: 작업 삭제·서브프로젝트(표는 6-14). - 진입 권한키 `project`(관리자 페이지 토글로 직원별 부여, admin 자동). - 배정 멤버(또는 owner)만 그 프로젝트를 조회 — **관리자도 멤버가 아니면 안 보임, 예외는 슈퍼관리자뿐**(2026-10-07, `access.sees_all_projects`; 사이드바 목록·검색·휴지통·알림도 같은 기준, 화면·API 모두 비멤버 403). @@ -47,7 +48,7 @@ - 첫 화면(`/project/`)은 **내 작업 목록**(프로젝트 홈 카드 화면은 폐지). 내 업무 화면 줄 클릭 = 오른쪽 업무 창(iframe). - 프로젝트 화면은 캘린더(FullCalendar)/타임라인(vis-timeline)/보드/목록/대시보드 뷰 토글. - 좌측 사이드바는 수신함·내 작업·휴지통·프로젝트 화면 공용(`templates/project/_side.html` + 프로젝트 목록 동작 `initSideTree`, 새 프로젝트/수정 모달 `_side_modals.html`) — 프로젝트 목록(순서 변경·✎·×)은 어느 화면에서나 같다. -- 사이드바 메뉴: 수신함·전체 보기(Pro user 이상 — 예전 오른쪽 위 "전체 프로젝트" 토글, `?scope=all`, 기본 대시보드)·내 작업(접이식)·목표. +- 사이드바 메뉴: 수신함·전체 보기(Project 옵션 대상자 — 예전 오른쪽 위 "전체 프로젝트" 토글, `?scope=all`, 기본 대시보드)·내 작업(접이식)·목표. - 보드는 아사나처럼 섹션이 가로로 계속 늘어나고(넘치면 가로 스크롤) 카드의 담당자·마감일을 클릭해 그 자리에서 바꾼다. - 보드 카드 끌기 = 실시간 미리보기(2026-10-19, `startCardDrag`·`placeCardPh`): 원래 카드는 숨기고 점선 자리 표시(`.pj-card-ph`)가 카드 사이로 FLIP 애니메이션, 끄는 모양은 기울어진 복제(`setDragImage`). 놓은 자리 그대로 — 다른 섹션도 PUT stage 뒤 `stages/{id}/tasks/order`(정렬 "기본"일 때만, 전체 보기는 섹션 맨 끝). **필터를 켜도 순서 변경 가능**(2026-10-19 버그 수정 — 필터는 브라우저별 localStorage `pj_filter_` 라 필터를 켜 둔 컴퓨터에서만 섹션 안 카드가 늘 제자리로 돌아갔다). 숨은 업무는 제자리(`orderWithHidden`). 카드 속 이미지 끌기가 "Files" 로 오인돼 카드 놓기를 가로채지 않게 `dragHasFiles` 는 카드·세부 업무 끌기 중 false, 카드 img 는 `-webkit-user-drag: none`. 끄는 중엔 실시간 동기화 쉼(`html.pj-card-dragging`). 컬럼 body 는 dragenter 도 preventDefault(안 하면 자리 표시가 들어온 직후 놓을 때 drop 거부). @@ -111,6 +112,9 @@ - 왼쪽 분류 | 오른쪽 설정. 새 옵션도 이 창에. - 폰트 = 누구나·이 브라우저(localStorage `pj_font`). - 처음 여는 탭·보드 카드 표지 = **수퍼관리자·Admin 만 수정·모든 사용자에게 적용**(서버 `project_options` 마이그레이션 029, `GET/PUT /project/api/options`, `store.normalize_project_options`). +- **"전체 보기" 메뉴를 볼 사람**(2026-11-11) = 프로젝트 화면 분류에 처음 여는 탭과 묶음. 옵션 키 `all_view_users`(이메일 목록, DB 변경 없음 — 029 키·값 표), + `null`(설정 전) = 예전처럼 Pro user 이상. 후보 = `GET /api/assignable-users`(아이콘+이름 `memberPickHtml`, `pro` 표시로 기본 체크) + [전체 선택/해제]. + 메뉴 표시만 정함(데이터는 멤버 범위 그대로) — 사이드바 `pj_all_view`(`_role_ctx(user, request)`), `project.js canAllView`(`data-all-view`). 대시보드 담당자별 합계는 여전히 Pro user 이상. - 긴급 공지 = 수퍼관리자만. ## 연간 목표 (마이그레이션 013, `goal_*` 테이블, 6-9) diff --git a/app/modules/project/access.py b/app/modules/project/access.py index 79a3f9b..f06ee36 100644 --- a/app/modules/project/access.py +++ b/app/modules/project/access.py @@ -70,6 +70,14 @@ def is_pro(user: dict[str, Any] | None) -> bool: return role_of(user) in ("super", "admin", "pro") +def can_all_view(user: dict[str, Any] | None, allowed: list[str] | None) -> bool: + """왼쪽 "전체 보기" 메뉴를 보는가 — Project 옵션 all_view_users(목록에 든 사람만), 설정 전(None)이면 Pro user 이상. + 메뉴 표시만 정한다 — 전체 보기도 멤버인 프로젝트 범위라 데이터 권한은 그대로(모듈 권한은 화면 진입에서 이미 확인).""" + if allowed is None: + return is_pro(user) + return str((user or {}).get("email") or "").strip().lower() in allowed + + def sees_all_projects(user: dict[str, Any] | None) -> bool: """멤버가 아니어도 모든 프로젝트를 보는가 — 슈퍼관리자만(모듈 권한도 있어야).""" return can_use_module(user) and _is_super(user) diff --git a/app/modules/project/router.py b/app/modules/project/router.py index ab646b6..ef181f4 100644 --- a/app/modules/project/router.py +++ b/app/modules/project/router.py @@ -105,12 +105,15 @@ def _require_pro(request: Request) -> dict[str, Any]: return user -def _role_ctx(user: dict[str, Any]) -> dict[str, Any]: - """화면 공용 등급 값 — is_admin 은 ERP 공통(상단 관리자 메뉴), pj_pro·pj_admin 은 프로젝트 모듈 버튼용.""" +def _role_ctx(user: dict[str, Any], request: Request | None = None) -> dict[str, Any]: + """화면 공용 등급 값 — is_admin 은 ERP 공통(상단 관리자 메뉴), pj_pro·pj_admin 은 프로젝트 모듈 버튼용, + pj_all_view 는 왼쪽 "전체 보기" 메뉴(Project 옵션 all_view_users — request 가 없으면 옵션 기본값 기준).""" from app.store import is_admin # noqa: WPS433 + opts = _project_options(_store(request) if request is not None else None) return {"is_admin": is_admin(user), "pj_pro": access.is_pro(user), - "pj_admin": access.is_project_admin(user)} + "pj_admin": access.is_project_admin(user), + "pj_all_view": access.can_all_view(user, opts["all_view_users"])} def _can_manage(request: Request, st: Any, user: dict[str, Any], project_id: int) -> bool: @@ -429,7 +432,7 @@ def _render_config_needed(request: Request, user: dict[str, Any]) -> HTMLRespons "scripts/sql/project_db_init.sql 로 project_db 를 초기화한 뒤 " "컨테이너를 재기동하세요.", "user": user, - **_role_ctx(user), + **_role_ctx(user, request), "nav_items": build_erp_nav(user, active="project"), }, status_code=503, @@ -678,7 +681,7 @@ def my_tasks_page(request: Request) -> HTMLResponse: "project/mytasks.html", { "user": user, - **_role_ctx(user), + **_role_ctx(user, request), "nav_items": build_erp_nav(user, active="project"), "page_title": "내 업무", "page_subtitle": "내가 담당자인 업무를 한 곳에서 봅니다.", @@ -726,7 +729,7 @@ def task_permalink(request: Request, task_id: int): { "reason": reason, "user": user, - **_role_ctx(user), + **_role_ctx(user, request), "nav_items": build_erp_nav(user, active="project"), }, status_code=status, @@ -806,7 +809,7 @@ def project_page(request: Request, project_id: int) -> HTMLResponse: "reason": "이 프로젝트의 멤버만 볼 수 있습니다. " "프로젝트 관리자에게 멤버 배정을 요청하세요.", "user": user, - **_role_ctx(user), + **_role_ctx(user, request), "nav_items": build_erp_nav(user, active="project"), }, status_code=403, @@ -896,7 +899,7 @@ def project_page(request: Request, project_id: int) -> HTMLResponse: "project/project.html", { "user": user, - **_role_ctx(user), + **_role_ctx(user, request), "pj_options": _project_options(st), "can_manage": can_manage, "nav_items": build_erp_nav(user, active="project"), @@ -967,7 +970,7 @@ def _db_or_503(request: Request) -> Any: def _project_options(st: Any) -> dict[str, Any]: - """시스템 Project 옵션(처음 여는 탭·보드 카드 표지) — 읽기 실패해도 화면은 기본값으로 연다.""" + """시스템 Project 옵션(처음 여는 탭·보드 카드 표지·전체 보기 대상자) — 읽기 실패해도 화면은 기본값으로 연다.""" if st is None: return store.normalize_project_options(None) try: @@ -1218,6 +1221,7 @@ def api_assignable_users(request: Request) -> JSONResponse: "name": u.get("name") or u["email"].split("@")[0], "id": u["email"].split("@")[0], "avatar": u.get("picture") or "", + "pro": access.is_pro(u), # Project 옵션 "전체 보기" 대상자 기본값(설정 전 = Pro user 이상) } for u in user_store.list_all() if has_module(u, "project") @@ -2963,7 +2967,7 @@ def notifier_page(request: Request) -> Any: "project/notifier.html", { "user": user, - **_role_ctx(user), + **_role_ctx(user, request), "nav_items": build_erp_nav(user, active="project"), "nav_projects": _nav_projects(st, user, admin), "goal_years": _goal_years_nav(st), @@ -3114,7 +3118,7 @@ def trash_page(request: Request) -> HTMLResponse: "project/trash.html", { "user": user, - **_role_ctx(user), + **_role_ctx(user, request), "nav_items": build_erp_nav(user, active="project"), "nav_projects": _nav_projects(st, user, True), "goal_years": _goal_years_nav(st), @@ -3191,7 +3195,7 @@ def help_page(request: Request) -> HTMLResponse: "project/help.html", { "user": user, - **_role_ctx(user), + **_role_ctx(user, request), "nav_items": build_erp_nav(user, active="project"), "page_title": "프로젝트 관리 도움말", "page_subtitle": "처음 쓰는 분을 위한 기능 안내", @@ -3240,7 +3244,7 @@ def inbox_page(request: Request) -> HTMLResponse: "project/inbox.html", { "user": user, - **_role_ctx(user), + **_role_ctx(user, request), "nav_items": build_erp_nav(user, active="project"), "nav_projects": nav_projects, "goal_years": _goal_years_nav(st), @@ -3450,7 +3454,7 @@ def goals_page(request: Request, year: int) -> HTMLResponse: "project/goals.html", { "user": user, - **_role_ctx(user), + **_role_ctx(user, request), "nav_items": build_erp_nav(user, active="project"), "nav_projects": _nav_projects(st, user, admin), "goal_years": _goal_years_nav(st), @@ -4001,7 +4005,7 @@ def goal_meeting_page(request: Request, year: int, month: int, week: str | None "project/goal_meeting.html", { "user": user, - **_role_ctx(user), + **_role_ctx(user, request), "nav_items": build_erp_nav(user, active="project"), "nav_projects": _nav_projects(st, user, admin), "goal_years": _goal_years_nav(st), diff --git a/app/modules/project/store.py b/app/modules/project/store.py index a4d6d81..1e685c8 100644 --- a/app/modules/project/store.py +++ b/app/modules/project/store.py @@ -383,7 +383,21 @@ PROJECT_VIEWS: tuple[str, ...] = ("board", "list", "calendar", "timeline", "dash PROJECT_OPTION_DEFAULTS: dict[str, Any] = { "default_view": "board", # 왼쪽에서 프로젝트를 열 때 처음 보이는 탭 "board_cover": True, # 보드 카드 표지(설명의 첫 이미지) + "all_view_users": None, # 왼쪽 "전체 보기" 메뉴를 볼 사람(이메일 목록) — None = 예전처럼 Pro user 이상 } +ALL_VIEW_USERS_MAX = 2000 + + +def _email_list(raw: Any) -> list[str] | None: + """이메일 목록 → 소문자·중복 제거·정렬. 목록이 아니거나 이상한 값이 끼면 None.""" + if not isinstance(raw, list) or len(raw) > ALL_VIEW_USERS_MAX: + return None + out: set[str] = set() + for e in raw: + if not isinstance(e, str) or "@" not in e or len(e) > 254: + return None + out.add(e.strip().lower()) + return sorted(out) def normalize_project_options(raw: dict[str, Any] | None) -> dict[str, Any]: @@ -394,6 +408,8 @@ def normalize_project_options(raw: dict[str, Any] | None) -> dict[str, Any]: out["default_view"] = raw["default_view"] if isinstance(raw.get("board_cover"), bool): out["board_cover"] = raw["board_cover"] + if raw.get("all_view_users") is not None: + out["all_view_users"] = _email_list(raw["all_view_users"]) return out @@ -413,6 +429,11 @@ def validate_project_options(payload: Any) -> dict[str, Any]: if not isinstance(payload["board_cover"], bool): raise ValueError("카드 표지 값이 올바르지 않습니다.") out["board_cover"] = payload["board_cover"] + if "all_view_users" in payload: + v = payload["all_view_users"] + out["all_view_users"] = None if v is None else _email_list(v) + if v is not None and out["all_view_users"] is None: + raise ValueError("전체 보기 대상자 값이 올바르지 않습니다.") return out diff --git a/app/modules/project/templates/project/_options.html b/app/modules/project/templates/project/_options.html index 7df3d66..c4b732c 100644 --- a/app/modules/project/templates/project/_options.html +++ b/app/modules/project/templates/project/_options.html @@ -1,6 +1,6 @@ {# Project 옵션 — 상단 바 톱니. 왼쪽 분류(일반·프로젝트 화면·보드·관리자) | 오른쪽 설정. 저장 버튼을 눌러야 한꺼번에 반영된다. · 일반(폰트) — 모두에게 보이고 이 브라우저에만 저장(localStorage pj_font, 아래 인라인 스크립트가 복원). - · 프로젝트 화면(처음 여는 탭)·보드(카드 표지) — 수퍼관리자·Admin(pj_admin)만 보이고, 서버(project_options, 마이그레이션 029)에 + · 프로젝트 화면(처음 여는 탭·"전체 보기" 메뉴 대상자)·보드(카드 표지) — 수퍼관리자·Admin(pj_admin)만 보이고, 서버(project_options, 마이그레이션 029)에 저장해 모든 사용자에게 적용. 창을 열 때 GET /project/api/options, 저장은 PUT. project.html 이 data-default-view· data-board-cover 로 받아 project.js 가 쓴다. 저장하면 "pj-options-change" 이벤트로 보던 보드에 바로 반영. · 관리자(긴급 공지) — 수퍼관리자만(공지 화면이 수퍼관리자 전용). #} @@ -62,7 +62,16 @@ - 왼쪽 "전체 보기"는 지금처럼 대시보드로 열립니다. + + {# 전체 보기 대상자(2026-11-11) — 체크한 사람에게만 왼쪽 "전체 보기" 메뉴가 보인다. 설정 전(all_view_users=null)이면 + Pro user 이상이 체크된 채로 열린다. 후보 = project 권한 보유자(GET /project/api/assignable-users). #} +
+
+ "전체 보기" 메뉴를 볼 사람체크한 사람에게만 왼쪽 "전체 보기"가 보입니다(멤버인 프로젝트만 모아 봄, 대시보드로 열림) + +
+
+
@@ -105,4 +114,4 @@ document.documentElement.dataset.pjFont = pf; } catch (_) {} - + diff --git a/app/modules/project/templates/project/_side.html b/app/modules/project/templates/project/_side.html index 07928f6..2d7bdea 100644 --- a/app/modules/project/templates/project/_side.html +++ b/app/modules/project/templates/project/_side.html @@ -10,7 +10,8 @@ side_active 'inbox' | 'mytasks' | 'trash' | 'goals' | '' — 개인 메뉴 활성 표시 goal_years "목표" 아래 연도 목록(router._goal_years_nav — 올해는 항상 포함) goal_year_active 목표 화면에서 보고 있는 연도 - pj_pro Pro user 이상 — 프로젝트 생성·수정·순서·전체 보기·휴지통·전체 멤버·연도 추가 + pj_pro Pro user 이상 — 프로젝트 생성·수정·순서·휴지통·전체 멤버·연도 추가 + pj_all_view "전체 보기" 메뉴 — Project 옵션 대상자(설정 전이면 Pro user 이상, router._role_ctx) pj_admin Admin 이상 — 남이 만든 프로젝트도 삭제(그 밖은 만든 사람만) 목록 동작은 project.js 의 initSideTree(첫 화면을 같은 마크업으로 다시 그림), 새 프로젝트/수정 모달은 각 화면이 include 하는 project/_side_modals.html. #} @@ -39,9 +40,9 @@ {{ mention_unread }} - {# 전체 보기(2026-10-08, Pro user 이상 — 멤버인 프로젝트 범위) — 예전 프로젝트 화면 오른쪽 위 "전체 프로젝트" 토글. 지금 프로젝트(없으면 목록 첫 프로젝트) + {# 전체 보기(2026-10-08 — 멤버인 프로젝트 범위, 2026-11-11 부터 볼 사람은 Project 옵션 "프로젝트 화면" 대상자) — 예전 프로젝트 화면 오른쪽 위 "전체 프로젝트" 토글. 지금 프로젝트(없으면 목록 첫 프로젝트) 화면을 ?scope=all 로 연다 — 볼 수 있는 모든 프로젝트의 작업. 프로젝트 화면에서는 project.js 가 새로고침 없이 바꾼다. #} - {% if pj_pro %} + {% if pj_all_view %} {% set _all_pid = current_pid or ((nav_projects | rejectattr("status", "equalto", "completed") | list | first or {}).id or 0) %} {% if _all_pid %} diff --git a/app/modules/project/templates/project/goal_meeting.html b/app/modules/project/templates/project/goal_meeting.html index c46bf6f..cd34f7b 100644 --- a/app/modules/project/templates/project/goal_meeting.html +++ b/app/modules/project/templates/project/goal_meeting.html @@ -1,7 +1,7 @@ {% extends "project/_meeting_content_base.html" if meeting_embedded else "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -289,5 +289,5 @@ - + {% endblock %} diff --git a/app/modules/project/templates/project/goals.html b/app/modules/project/templates/project/goals.html index 06ddbac..d78d00a 100644 --- a/app/modules/project/templates/project/goals.html +++ b/app/modules/project/templates/project/goals.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -207,5 +207,5 @@ {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/help.html b/app/modules/project/templates/project/help.html index 48e00fa..68d15e3 100644 --- a/app/modules/project/templates/project/help.html +++ b/app/modules/project/templates/project/help.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -96,7 +96,7 @@

2화면 구성

왼쪽 사이드바

@@ -120,7 +120,7 @@ 일반: 폰트(기본 시스템 폰트·프리텐다드·나눔 스퀘어·나눔 스퀘어 네오·나눔 스퀘어 라운드, 미리보기) — 누구나 바꿀 수 있고 이 브라우저에만 적용됩니다. 아래 프로젝트 화면·보드 분류는 수퍼관리자·Admin 에게만 보이고, 바꾸면 모든 사용자에게 적용됩니다(다른 사람은 다음에 화면을 열 때부터). 관리자(긴급 공지) 분류는 수퍼관리자에게만 보입니다. 분류 제목 옆 표시(이 브라우저에만 / 모든 사용자에게)로 적용 범위를 알 수 있습니다. - 프로젝트 화면: 처음 여는 탭 — 왼쪽에서 프로젝트를 고르면 바로 보일 보기(보드·목록·캘린더·타임라인·대시보드). 왼쪽 "전체 보기"는 늘 대시보드로 열립니다. + 프로젝트 화면: 처음 여는 탭 — 왼쪽에서 프로젝트를 고르면 바로 보일 보기(보드·목록·캘린더·타임라인·대시보드). "전체 보기" 메뉴를 볼 사람 — 직원 아이콘을 체크한 사람에게만 왼쪽 "전체 보기"가 보입니다([전체 선택]으로 한 번에, 처음엔 Pro user 이상이 체크돼 있음). "전체 보기"는 늘 대시보드로 열립니다. 보드: 카드 표지 이미지 — 끄면 메인 업무 설명에 이미지가 있어도 보드 카드에 표지를 보여 주지 않습니다(보던 보드에 바로 반영). 기본값으로는 창 안의 값만 처음으로 돌립니다(저장해야 반영). 취소는 변경을 적용하지 않고 닫습니다. @@ -151,7 +151,7 @@ 사이드바 프로젝트 순서 바꾸기 (⣿)OOX 댓글 고치기·지우기O남의 댓글도본인 댓글만 휴지통 보기·복구OOX - 전체 보기(모든 프로젝트 업무 함께 보기)OO (멤버인 프로젝트 범위)X + 전체 보기(모든 프로젝트 업무 함께 보기)Project 옵션 → 프로젝트 화면에서 고른 사람(처음엔 Pro user 이상, 멤버인 프로젝트 범위) 대시보드 “담당자별 업무 합계”OOX (안 보임) 사이드바 “전체 멤버”OOX 수신함·내 업무·PC 알림OOO (자기 것) @@ -230,7 +230,7 @@ 대시보드완료·미완료·지연 숫자와 차트로 진행 상황을 볼 때. (
14장)

범위: 이 프로젝트 / 전체 프로젝트

-

프로젝트 화면은 지금 프로젝트만 보여줍니다. Pro user 이상은 왼쪽 메뉴 수신함 아래 전체 보기를 누르면 내가 볼 수 있는 모든 프로젝트의 업무를 함께 봅니다 +

프로젝트 화면은 지금 프로젝트만 보여줍니다. Project 옵션에서 고른 사람(처음엔 Pro user 이상)은 왼쪽 메뉴 수신함 아래 전체 보기를 누르면 내가 볼 수 있는 모든 프로젝트의 업무를 함께 봅니다 (왼쪽 프로젝트 목록에서 프로젝트를 누르면 다시 그 프로젝트만). 전체 프로젝트일 때는 위 제목이 전체 프로젝트로 바뀌고, 카드 위에는 어느 프로젝트 업무인지 이름이 붙습니다. 다른 프로젝트에서 연결돼 와 읽기만 되는 업무도 한 번씩 함께 보입니다.

diff --git a/app/modules/project/templates/project/inbox.html b/app/modules/project/templates/project/inbox.html index 3e4bbc7..d6afac0 100644 --- a/app/modules/project/templates/project/inbox.html +++ b/app/modules/project/templates/project/inbox.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -106,5 +106,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/mytasks.html b/app/modules/project/templates/project/mytasks.html index 7e20853..0d08955 100644 --- a/app/modules/project/templates/project/mytasks.html +++ b/app/modules/project/templates/project/mytasks.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -100,5 +100,5 @@ "today": {{ today | tojson }} } - + {% endblock %} diff --git a/app/modules/project/templates/project/notifier.html b/app/modules/project/templates/project/notifier.html index 2f58768..2f46102 100644 --- a/app/modules/project/templates/project/notifier.html +++ b/app/modules/project/templates/project/notifier.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -108,5 +108,5 @@ }); })(); - + {% endblock %} diff --git a/app/modules/project/templates/project/project.html b/app/modules/project/templates/project/project.html index de951d3..51eab6d 100644 --- a/app/modules/project/templates/project/project.html +++ b/app/modules/project/templates/project/project.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + @@ -27,7 +27,7 @@
- + {% endblock %} diff --git a/app/modules/project/templates/project/trash.html b/app/modules/project/templates/project/trash.html index a8fa30b..21506d3 100644 --- a/app/modules/project/templates/project/trash.html +++ b/app/modules/project/templates/project/trash.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -70,5 +70,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/static/project-options.js b/app/static/project-options.js index eaa8975..b81c15e 100644 --- a/app/static/project-options.js +++ b/app/static/project-options.js @@ -7,7 +7,8 @@ "nanum-square-neo": "NanumSquareNeo", "nanum-square-round": "NanumSquareRound" }; const VIEWS = ["board", "list", "calendar", "timeline", "dashboard"]; const FONT_DEFAULT = "system"; - const SYS_DEFAULTS = { default_view: "board", board_cover: true }; // 서버 store.PROJECT_OPTION_DEFAULTS 와 같게 + // 서버 store.PROJECT_OPTION_DEFAULTS 와 같게 — all_view_users null = Pro user 이상(후보 목록의 pro 표시) + const SYS_DEFAULTS = { default_view: "board", board_cover: true, all_view_users: null }; const form = document.getElementById("pj-options-form"); const select = document.getElementById("pj-options-font"), preview = document.getElementById("pj-options-preview"); const error = document.getElementById("pj-options-error"), save = document.getElementById("pj-options-save"); @@ -20,6 +21,11 @@ const cover = document.getElementById("pj-options-cover"); const views = form.elements.default_view || null; const sysControls = [cover].concat(Array.from(views || [])).filter(Boolean); + // "전체 보기" 메뉴 대상자 — 프로젝트 화면 분류(수퍼관리자·Admin 창에만) + const allPicker = document.getElementById("pj-options-allview"); + const allBtn = document.getElementById("pj-options-allview-all"); + const allCount = document.getElementById("pj-options-allview-count"); + let users = null; // 후보(project 권한자) — 못 읽었으면 null(그때는 대상자를 저장하지 않음) const localControls = [select, cancel, closeX, reset]; let sys = null; // 서버에서 읽은 시스템 옵션 — 못 읽었으면 null(그때는 폰트만 저장) let openSeq = 0; // 창을 다시 열면 앞의 늦은 응답은 버린다 @@ -35,9 +41,41 @@ return data || {}; } function currentFont() { const f = document.documentElement.dataset.pjFont; return Object.hasOwn(names, f) ? f : FONT_DEFAULT; } + // 서버 응답 → 비교용 값. 대상자는 지금 후보에 있는 사람만, 설정 전(null)이면 Pro user 이상. + function sysFrom(o) { + return { default_view: o.default_view, board_cover: !!o.board_cover, all_view_users: resolveAllView(o.all_view_users) }; + } + function resolveAllView(list) { + if (!users) return null; + return users.filter(function (u) { return list ? list.indexOf(u.email.toLowerCase()) >= 0 : u.pro; }) + .map(function (u) { return u.email.toLowerCase(); }).sort(); + } + function allBoxes() { return allPicker ? Array.from(allPicker.querySelectorAll("input[type=checkbox]")) : []; } + function pickedAllView() { return allBoxes().filter(function (b) { return b.checked; }).map(function (b) { return b.value.toLowerCase(); }).sort(); } + function paintAllView() { + if (!allPicker) return; + const boxes = allBoxes(), on = boxes.filter(function (b) { return b.checked; }).length; + const all = boxes.length > 0 && on === boxes.length; + allBtn.textContent = all ? "전체 해제" : "전체 선택"; + allCount.textContent = users ? on + "명 / " + boxes.length + "명" : ""; + } + function renderAllView() { + if (!allPicker) return; + const pick = window.PJLib && window.PJLib.memberPickHtml; + allPicker.innerHTML = (users || []).map(function (u) { + return pick ? pick(u) : '"; + }).join(""); + allPicker.querySelectorAll("label").forEach(function (l, i) { l.title = users[i].email; }); + } function fillSys(o) { if (views) views.value = o.default_view; if (cover) cover.checked = o.board_cover; + if (allPicker && users) { + const on = Array.isArray(o.all_view_users) ? o.all_view_users : resolveAllView(null); + allBoxes().forEach(function (b) { b.checked = on.indexOf(b.value.toLowerCase()) >= 0; }); + } + paintAllView(); } function paint() { const font = names[select.value]; @@ -57,6 +95,7 @@ save.disabled = on; localControls.forEach(function (c) { c.disabled = on; }); sysControls.forEach(function (c) { c.disabled = on || !sys; }); + allBoxes().concat(allBtn ? [allBtn] : []).forEach(function (c) { c.disabled = on || !sys || !users; }); } function close() { if (!save.disabled) dialog.close(); } async function loadSys() { @@ -64,9 +103,15 @@ const seq = ++openSeq; sys = null; busy(false); // 읽는 동안 시스템 칸은 잠금 try { - const data = await request("GET"); + // 대상자 후보는 따로 — 못 읽어도 처음 여는 탭·카드 표지는 저장할 수 있게 + const people = allPicker ? fetch("/project/api/assignable-users").then(function (r) { + if (!r.ok) throw new Error(r.statusText); return r.json(); + }).then(function (d) { return d.users || []; }).catch(function () { return null; }) : Promise.resolve(null); + const [data, list] = await Promise.all([request("GET"), people]); if (seq !== openSeq) return; - sys = { default_view: data.options.default_view, board_cover: !!data.options.board_cover }; + users = list; renderAllView(); + if (allPicker && !users) setError('"전체 보기" 대상자 후보를 불러오지 못했습니다. 대상자는 저장되지 않습니다.'); + sys = sysFrom(data.options); fillSys(sys); } catch (err) { if (seq !== openSeq) return; @@ -76,7 +121,7 @@ } button.addEventListener("click", function () { - select.value = currentFont(); fillSys(SYS_DEFAULTS); paint(); setError(""); + select.value = currentFont(); users = null; renderAllView(); fillSys(SYS_DEFAULTS); paint(); setError(""); showPane(tabs[0].dataset.pane); dialog.showModal(); tabs[0].focus(); loadSys(); }); @@ -92,6 +137,14 @@ showPane(tabs[(i + (e.key === "ArrowDown" ? 1 : tabs.length - 1)) % tabs.length].dataset.pane, true); }); select.addEventListener("change", paint); + if (allPicker) { + allPicker.addEventListener("change", paintAllView); + allBtn.addEventListener("click", function () { + const boxes = allBoxes(), all = boxes.every(function (b) { return b.checked; }); + boxes.forEach(function (b) { b.checked = !all; }); + paintAllView(); + }); + } reset.addEventListener("click", function () { select.value = FONT_DEFAULT; paint(); if (sys) fillSys(SYS_DEFAULTS); @@ -109,6 +162,10 @@ if (sys) { if (views && VIEWS.indexOf(views.value) >= 0 && views.value !== sys.default_view) sysChanges.default_view = views.value; if (cover && cover.checked !== sys.board_cover) sysChanges.board_cover = cover.checked; + if (allPicker && users && sys.all_view_users) { + const picked = pickedAllView(); + if (picked.join(",") !== sys.all_view_users.join(",")) sysChanges.all_view_users = picked; + } } busy(true); setError(""); try { @@ -119,12 +176,13 @@ const changed = Object.keys(sysChanges); if (changed.length) { const data = await request("PUT", sysChanges); - sys = { default_view: data.options.default_view, board_cover: !!data.options.board_cover }; + sys = sysFrom(data.options); } if (fontValue !== currentFont()) changed.push("font"); localStorage.setItem("pj_font", fontValue); document.documentElement.dataset.pjFont = fontValue; // project.js 가 듣는다 — 보드 표지가 바뀌면 보던 보드를 다시 그린다(다른 사용자는 다음에 화면을 열 때부터). + // "전체 보기" 메뉴 대상자는 다음에 화면을 열 때부터(왼쪽 메뉴는 서버가 그린다). if (changed.length) { window.dispatchEvent(new CustomEvent("pj-options-change", { detail: { options: Object.assign({ font: fontValue }, sys || {}), changed: changed }, diff --git a/app/static/project.css b/app/static/project.css index 8188720..c4e847b 100644 --- a/app/static/project.css +++ b/app/static/project.css @@ -3282,6 +3282,11 @@ label.pj-options-row[for] { cursor: pointer; } .pj-options-views label:has(input:checked) { border-color: var(--pj-accent); background: var(--pj-accent-tint); color: var(--pj-accent-dark); font-weight: 600; box-shadow: 0 0 0 1px var(--pj-accent) inset; } .pj-options-views label:has(input:checked) .material-symbols-outlined { color: var(--pj-accent); } .pj-options-views label:has(input:focus-visible) { outline: 2px solid var(--pj-accent); outline-offset: 2px; } +/* 프로젝트 화면 — "전체 보기" 메뉴 대상자(아이콘+이름 체크, 멤버 배정 창과 같은 모양) */ +.pj-options-allview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; } +.pj-options-allview-all { flex: none; white-space: nowrap; } +.pj-options-allview { max-height: 220px; margin-top: 0; } +.pj-options-allview:empty::before { content: "불러오는 중…"; padding: 6px; font-size: 12px; color: var(--pj-ink-soft); } /* 켜기/끄기 스위치 */ .pj-switch { position: relative; flex: none; display: inline-block; width: 40px; height: 22px; } .pj-switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; } diff --git a/app/static/project.js b/app/static/project.js index 3fc51d1..1a7d14c 100644 --- a/app/static/project.js +++ b/app/static/project.js @@ -3479,6 +3479,7 @@ // 등급(2026-10-12) — isPro = Pro user 이상(프로젝트 수정·멤버 배정·전체 보기·담당자별 합계·남의 댓글 수정), // isPAdmin = Admin 이상(남이 만든 섹션도 삭제). const isPro = root.dataset.isPro === "true"; + const canAllView = root.dataset.allView === "true"; // 왼쪽 "전체 보기" 메뉴 — Project 옵션 대상자(서버 pj_all_view) const isPAdmin = root.dataset.isPadmin === "true"; // 시스템 Project 옵션(서버 project_options, 수퍼관리자·Admin 이 바꾸면 모든 사용자에게) — 보드 카드 표지 켬/끔. // 옵션 창에서 저장하면 pj-options-change 로 바로 바뀐다(아래). @@ -3653,7 +3654,7 @@ const saved = localStorage.getItem(VIEW_KEY); const preferred = root.dataset.defaultView; // 시스템 옵션(서버가 넣어 줌) if ((qs.has("y") || qs.has("m")) && saved && VIEWS.indexOf(saved) >= 0) currentView = saved; - else if (isPro && qs.get("scope") === "all") currentView = "dashboard"; + else if (canAllView && qs.get("scope") === "all") currentView = "dashboard"; else if (qs.get("embed") !== "1" && VIEWS.indexOf(preferred) >= 0) currentView = preferred; // 업무 창 패널(iframe)은 그대로 보드 } catch (_) {} @@ -3815,7 +3816,7 @@ }); } if (moveScopeHighlight) moveScopeHighlight(false); - // 전체 보기(2026-10-08) — 오른쪽 위 토글 대신 왼쪽 메뉴 "전체 보기"(관리자만, ?scope=all). 토글은 숨겨 두고 상태만 쓴다. + // 전체 보기(2026-10-08) — 오른쪽 위 토글 대신 왼쪽 메뉴 "전체 보기"(Project 옵션 대상자만, ?scope=all). 토글은 숨겨 두고 상태만 쓴다. const allViewLink = el("pj-side-allview"); function applyAllScope(on) { viewScope = on ? "all" : "project"; @@ -3829,8 +3830,8 @@ r.classList.toggle("is-active", !on); }); } - if (isPro && new URLSearchParams(location.search).get("scope") === "all") applyAllScope(true); // 첫 그리기 전에 - if (allViewLink && isPro) { + if (canAllView && new URLSearchParams(location.search).get("scope") === "all") applyAllScope(true); // 첫 그리기 전에 + if (allViewLink && canAllView) { allViewLink.addEventListener("click", function (e) { if (e.ctrlKey || e.metaKey || e.shiftKey || e.button === 1) return; e.preventDefault(); // 같은 화면 안에서 바로 전환 diff --git a/tests/js/render_goals.py b/tests/js/render_goals.py index 2b856af..ef4b3e3 100644 --- a/tests/js/render_goals.py +++ b/tests/js/render_goals.py @@ -46,7 +46,7 @@ def board() -> dict: def goals_ctx(admin: bool) -> dict: return { - "user": {"email": ME, "is_super_admin": False}, "is_admin": admin, "pj_pro": admin, "pj_admin": admin, "nav_projects": [], "goal_years": [2026], + "user": {"email": ME, "is_super_admin": False}, "is_admin": admin, "pj_pro": admin, "pj_admin": admin, "pj_all_view": admin, "nav_projects": [], "goal_years": [2026], "goal_year_active": 2026, "my_open_total": 0, "mention_unread": 0, "color_palette": ["#4573d2"], "project_icons": ["folder"], "goals_enabled": True, "goal_year": 2026, "board": board(), "months": list(range(1, 13)), @@ -106,7 +106,7 @@ def meeting_view(err: bool) -> dict: def meeting_ctx(admin: bool, err: bool, can_sync: bool = True) -> dict: view = meeting_view(err) ctx = { - "user": {"email": ME, "is_super_admin": False}, "is_admin": admin, "pj_pro": admin, "pj_admin": admin, "nav_projects": [], "goal_years": [2026], + "user": {"email": ME, "is_super_admin": False}, "is_admin": admin, "pj_pro": admin, "pj_admin": admin, "pj_all_view": admin, "nav_projects": [], "goal_years": [2026], "goal_year_active": 2026, "my_open_total": 0, "mention_unread": 0, "color_palette": ["#4573d2"], "project_icons": ["folder"], "goal_year": 2026, "goal_month": 9, "meetings_enabled": True, "weeks": [{"start": "2026-09-28", "end": "2026-10-04", "n": 4, "label": "9/28~10/4", "has": True, "now": False, diff --git a/tests/js/render_project.py b/tests/js/render_project.py index 3628f7e..95db6f4 100644 --- a/tests/js/render_project.py +++ b/tests/js/render_project.py @@ -105,7 +105,7 @@ def render_inbox(env) -> None: def render_one(env, name: str, admin: bool, sup: bool = False) -> None: html = env.get_template("project/project.html").render( - user={"email": ME, "is_super_admin": sup}, is_admin=admin, pj_pro=admin, pj_admin=admin, can_manage=True, + user={"email": ME, "is_super_admin": sup}, is_admin=admin, pj_pro=admin, pj_admin=admin, pj_all_view=admin, can_manage=True, project=PROJECTS[0], current_project_id=1, stages=STAGES[1], tasks=TASKS, members=[{"user_email": ME, "role": "member"}, {"user_email": "bob@test.local", "role": "member"}], projects_meta=PROJECTS, nav_projects=PROJECTS, stages_by_project=STAGES, board_stage_names=["할 일", "완료"], diff --git a/tests/test_project_options_api.py b/tests/test_project_options_api.py index 1d080fb..43b4672 100644 --- a/tests/test_project_options_api.py +++ b/tests/test_project_options_api.py @@ -16,6 +16,7 @@ store = importlib.import_module("app.modules.project.store") ADMIN = {"email": "Boss@Test.local", "role": "admin"} USER = {"email": "me@test.local", "role": "user"} PRO = {"email": "pro@test.local", "role": "pro"} +D = dict(store.PROJECT_OPTION_DEFAULTS) class FakeStore: @@ -39,22 +40,40 @@ class FakeStore: class NormalizeTests(unittest.TestCase): def test_defaults_when_nothing_saved(self): - self.assertEqual(store.normalize_project_options(None), {"default_view": "board", "board_cover": True}) - self.assertEqual(store.normalize_project_options({}), {"default_view": "board", "board_cover": True}) + self.assertEqual(store.normalize_project_options(None), D) + self.assertEqual(store.normalize_project_options({}), D) def test_bad_or_unknown_saved_values_fall_back(self): out = store.normalize_project_options({"default_view": "gantt", "board_cover": "no", "x": 1}) - self.assertEqual(out, {"default_view": "board", "board_cover": True}) + self.assertEqual(out, D) def test_saved_values_used(self): out = store.normalize_project_options({"default_view": "timeline", "board_cover": False}) - self.assertEqual(out, {"default_view": "timeline", "board_cover": False}) + self.assertEqual(out, dict(D, default_view="timeline", board_cover=False)) + + def test_all_view_users_normalized(self): + out = store.normalize_project_options({"all_view_users": ["B@x.kr", "a@x.kr", "b@x.kr"]}) + self.assertEqual(out["all_view_users"], ["a@x.kr", "b@x.kr"]) + self.assertEqual(store.normalize_project_options({"all_view_users": []})["all_view_users"], []) + self.assertIsNone(store.normalize_project_options({"all_view_users": "x"})["all_view_users"]) + self.assertEqual(store.validate_project_options({"all_view_users": ["Me@X.kr"]}), {"all_view_users": ["me@x.kr"]}) + self.assertEqual(store.validate_project_options({"all_view_users": None}), {"all_view_users": None}) + + def test_can_all_view(self): + access = importlib.import_module("app.modules.project.access") + self.assertTrue(access.can_all_view(PRO, None)) # 설정 전 = Pro user 이상(예전 그대로) + self.assertFalse(access.can_all_view(USER, None)) + self.assertTrue(access.can_all_view(USER, ["me@test.local"])) + self.assertFalse(access.can_all_view(ADMIN, ["me@test.local"])) + self.assertTrue(access.can_all_view(ADMIN, ["boss@test.local"])) # 대소문자 무시 + self.assertFalse(access.can_all_view(ADMIN, [])) def test_validate_keeps_only_sent_keys(self): self.assertEqual(store.validate_project_options({"board_cover": False}), {"board_cover": False}) def test_validate_rejects(self): - for bad in ({}, None, [], {"default_view": "gantt"}, {"board_cover": 0}, {"board_cover": "false"}, {"font": "x"}): + for bad in ({}, None, [], {"default_view": "gantt"}, {"board_cover": 0}, {"board_cover": "false"}, {"font": "x"}, + {"all_view_users": "a@x.kr"}, {"all_view_users": ["noemail"]}, {"all_view_users": [1]}): with self.subTest(bad=bad), self.assertRaises(ValueError): store.validate_project_options(bad) @@ -73,7 +92,7 @@ class OptionsApiTests(unittest.TestCase): def test_anyone_with_module_reads_with_can_edit_flag(self): st = FakeStore({"default_view": "list"}) out = self.call("GET", USER, st).json() - self.assertEqual(out, {"options": {"default_view": "list", "board_cover": True}, "can_edit": False}) + self.assertEqual(out, {"options": dict(D, default_view="list"), "can_edit": False}) self.assertTrue(self.call("GET", ADMIN, st).json()["can_edit"]) def test_admin_saves_only_sent_keys(self): @@ -81,7 +100,7 @@ class OptionsApiTests(unittest.TestCase): res = self.call("PUT", ADMIN, st, {"board_cover": False}) self.assertEqual(res.status_code, 200) self.assertEqual(st.writes, [({"board_cover": False}, "Boss@Test.local")]) - self.assertEqual(res.json()["options"], {"default_view": "calendar", "board_cover": False}) + self.assertEqual(res.json()["options"], dict(D, default_view="calendar", board_cover=False)) def test_user_and_pro_cannot_save(self): for who in (USER, PRO): @@ -92,21 +111,21 @@ class OptionsApiTests(unittest.TestCase): def test_invalid_payload_400_without_write(self): st = FakeStore() - for body in ({"default_view": "gantt"}, {"board_cover": "yes"}, {}, {"font": "pretendard"}): + for body in ({"default_view": "gantt"}, {"board_cover": "yes"}, {}, {"font": "pretendard"}, {"all_view_users": ["x"]}): with self.subTest(body=body): self.assertEqual(self.call("PUT", ADMIN, st, body).status_code, 400) self.assertEqual(st.writes, []) def test_migration_missing_read_defaults_write_503(self): st = FakeStore(missing=True) - self.assertEqual(self.call("GET", USER, st).json()["options"], {"default_view": "board", "board_cover": True}) + self.assertEqual(self.call("GET", USER, st).json()["options"], D) res = self.call("PUT", ADMIN, st, {"board_cover": False}) self.assertEqual(res.status_code, 503) self.assertIn("029", res.json()["detail"]) def test_page_reader_never_fails(self): - self.assertEqual(api._project_options(None), {"default_view": "board", "board_cover": True}) - self.assertEqual(api._project_options(FakeStore(broken=True)), {"default_view": "board", "board_cover": True}) + self.assertEqual(api._project_options(None), D) + self.assertEqual(api._project_options(FakeStore(broken=True)), D) if __name__ == "__main__": diff --git a/tests/test_project_roles.py b/tests/test_project_roles.py index 4d4454b..8fd6775 100644 --- a/tests/test_project_roles.py +++ b/tests/test_project_roles.py @@ -72,9 +72,10 @@ class RoleHelperTests(unittest.TestCase): self.assertFalse(api._can_delete(USER, None)) def test_role_ctx(self): - self.assertEqual(api._role_ctx(PRO), {"is_admin": False, "pj_pro": True, "pj_admin": False}) - self.assertEqual(api._role_ctx(ADMIN), {"is_admin": True, "pj_pro": True, "pj_admin": True}) - self.assertEqual(api._role_ctx(USER), {"is_admin": False, "pj_pro": False, "pj_admin": False}) + # pj_all_view — 옵션(전체 보기 대상자) 설정 전이면 Pro user 이상(request 없음 = 기본값) + self.assertEqual(api._role_ctx(PRO), {"is_admin": False, "pj_pro": True, "pj_admin": False, "pj_all_view": True}) + self.assertEqual(api._role_ctx(ADMIN), {"is_admin": True, "pj_pro": True, "pj_admin": True, "pj_all_view": True}) + self.assertEqual(api._role_ctx(USER), {"is_admin": False, "pj_pro": False, "pj_admin": False, "pj_all_view": False}) class UserStoreRoleTests(unittest.TestCase):