All checks were successful
build-and-push / build (push) Successful in 39s
- config/db/storage/auth/router/perms: eQMS 규약 미러링, 권한 2-tier (관리자 전체 / 구성원 본인·신청만), oauth2-proxy 헤더 인증 + DEV_AUTH mock - 모델: 구성원/부서, 근무(출퇴근·휴가·공가·초과), 프로젝트(회사/제품/버전· 작업자portion·담당자·태스크·계약·첨부·분할입금), 인센티브(설정·단계· 유저배분·분기정산), 회계(거래·세금) - internal/worktime: 근로기준법 월 집계 엔진 - internal/incentive: BE/non-BE × 계약금/중도금/잔금 3단계 계산 + 시뮬레이션 - 시드 데이터, Go 멀티스테이지 Dockerfile - ADMIN_GROUPS 기본값 'admin' (전 내부 앱 공통 그룹) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
62 lines
2.3 KiB
Go
62 lines
2.3 KiB
Go
package httpapi
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
|
|
"spin/internal/models"
|
|
)
|
|
|
|
// MeResponse enriches the proxy identity with the matched Member profile.
|
|
type MeResponse struct {
|
|
User User `json:"user"`
|
|
Member *models.Member `json:"member"`
|
|
IsAdmin bool `json:"isAdmin"`
|
|
}
|
|
|
|
func (s *Server) handleMe(w http.ResponseWriter, r *http.Request) {
|
|
u := currentUser(r.Context())
|
|
writeJSON(w, http.StatusOK, MeResponse{
|
|
User: u,
|
|
Member: s.lookupMember(u.Email),
|
|
IsAdmin: s.isAdmin(r),
|
|
})
|
|
}
|
|
|
|
// NavItem is one sidebar entry; adminOnly entries are filtered for members.
|
|
type NavItem struct {
|
|
Key string `json:"key"`
|
|
Label string `json:"label"`
|
|
Path string `json:"path"`
|
|
Icon string `json:"icon"`
|
|
AdminOnly bool `json:"adminOnly"`
|
|
Section string `json:"section"`
|
|
}
|
|
|
|
var navItems = []NavItem{
|
|
{Key: "dashboard", Label: "대시보드", Path: "/", Icon: "LayoutDashboard", Section: "개요"},
|
|
{Key: "attendance", Label: "근무", Path: "/attendance", Icon: "Clock", Section: "나의 업무"},
|
|
{Key: "projects", Label: "프로젝트", Path: "/projects", Icon: "FolderKanban", Section: "나의 업무"},
|
|
{Key: "incentive", Label: "인센티브", Path: "/incentive", Icon: "Coins", Section: "나의 업무"},
|
|
{Key: "approvals", Label: "승인 관리", Path: "/admin/approvals", Icon: "CheckSquare", AdminOnly: true, Section: "관리자"},
|
|
{Key: "incentive-admin", Label: "인센티브 관리", Path: "/admin/incentive", Icon: "Calculator", AdminOnly: true, Section: "관리자"},
|
|
{Key: "accounting", Label: "회계", Path: "/admin/accounting", Icon: "Wallet", AdminOnly: true, Section: "관리자"},
|
|
{Key: "members", Label: "구성원", Path: "/admin/members", Icon: "Users", AdminOnly: true, Section: "관리자"},
|
|
{Key: "settings", Label: "설정", Path: "/admin/settings", Icon: "Settings", AdminOnly: true, Section: "관리자"},
|
|
}
|
|
|
|
func (s *Server) handleNav(w http.ResponseWriter, r *http.Request) {
|
|
admin := s.isAdmin(r)
|
|
out := make([]NavItem, 0, len(navItems))
|
|
for _, it := range navItems {
|
|
if it.AdminOnly && !admin {
|
|
continue
|
|
}
|
|
out = append(out, it)
|
|
}
|
|
writeJSON(w, http.StatusOK, out)
|
|
}
|
|
|
|
// lc lower-cases & trims a string (small helper used across handlers).
|
|
func lc(s string) string { return strings.ToLower(strings.TrimSpace(s)) }
|