260716_03_ENH: 권한 별 노출에 대한 수정
This commit is contained in:
@@ -27,7 +27,7 @@ import {
|
||||
useSaveAssignedFieldworkMutation,
|
||||
useProjectTopQuery,
|
||||
} from "@/query/project";
|
||||
import { isFieldWorkUser } from "@/utils/userRole";
|
||||
import { isExternalManager, isFieldWorkUser } from "@/utils/userRole";
|
||||
|
||||
const ProjectAssignPage = () => {
|
||||
const mounted = useMounted();
|
||||
@@ -36,6 +36,8 @@ const ProjectAssignPage = () => {
|
||||
|
||||
const prjctIdx = selectedProject?.prjctIdx ?? 0;
|
||||
const enabled = mounted && prjctIdx > 0;
|
||||
// 외주사 계정은 자기 회사 배정만 봐야 하므로 회사 select 자체를 조작하지 못하게 막는다.
|
||||
const isExternalUser = isExternalManager(auth.user?.userRole);
|
||||
|
||||
const companyQuery = useCmpnListQuery();
|
||||
const fwUsersQuery = useFieldworkUsersQuery(enabled);
|
||||
@@ -282,6 +284,7 @@ const ProjectAssignPage = () => {
|
||||
placeholder="회사 선택"
|
||||
className="w-56 h-9"
|
||||
useAll={false}
|
||||
disabled={isExternalUser}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ import MessageSendDialog, { type MessageSendMode } from '@/components/dialog/Mes
|
||||
import MessageHistoryDialog from '@/components/dialog/MessageHistoryDialog'
|
||||
import { downloadBase64File, downloadFile, XLSX_MIME_TYPE } from '@kri/common/browser'
|
||||
import {CONTACT_INTERVIEWER_ROLE} from "@/const/userConst";
|
||||
import { isManager } from "@/utils/userRole";
|
||||
import { isInternalManager, isManager } from "@/utils/userRole";
|
||||
import { applyListAccessFilter } from "@/utils/listAccess";
|
||||
|
||||
const toDateTimeRange = (from?: string, to?: string) => {
|
||||
@@ -103,6 +103,8 @@ const ListManagePage = () => {
|
||||
const prjctIdx = selectedProject?.prjctIdx ?? 0
|
||||
const enabled = mounted && prjctIdx > 0
|
||||
const canManageList = isManager(userRole);
|
||||
// 리스트 초기화/헤더 관리/업로드는 내부 관리자 전용 — 외주사 계정에는 노출되면 안 됨.
|
||||
const isInternal = isInternalManager(userRole);
|
||||
|
||||
const resultCodesQuery = useResultCodesQuery(prjctIdx, enabled)
|
||||
const listHeaderQuery = useListHeaderQuery(prjctIdx, enabled)
|
||||
@@ -261,6 +263,7 @@ const ListManagePage = () => {
|
||||
<div className="space-y-6 text-sm">
|
||||
{canManageList && (
|
||||
<ListManageActions
|
||||
showAdminActions={isInternal}
|
||||
onReset={() => showDialog('listResetDialog')}
|
||||
onHeaderManage={() => showDialog('listHeaderManageDialog')}
|
||||
onUpload={() => showDialog('listUploadDialog')}
|
||||
@@ -296,7 +299,7 @@ const ListManagePage = () => {
|
||||
focusRowId={restoredForThisProject?.sid}
|
||||
/>
|
||||
|
||||
{canManageList && (
|
||||
{isInternal && (
|
||||
<>
|
||||
<ListResetDialog filterSummary={filterSummary} onConfirm={handleResetConfirm} />
|
||||
<ListUploadDialog
|
||||
@@ -310,6 +313,11 @@ const ListManagePage = () => {
|
||||
headerRows={headerManageRows}
|
||||
/>
|
||||
<ListHeaderManageDialog prjctIdx={prjctIdx} rows={headerManageRows} onConfirm={handleHeaderManageConfirm} />
|
||||
</>
|
||||
)}
|
||||
|
||||
{canManageList && (
|
||||
<>
|
||||
<ListDownloadDialog mode={downloadMode} filterSummary={filterSummary} onDownload={handleDownloadConfirm} />
|
||||
<MessageSendDialog
|
||||
mode={messageSendMode}
|
||||
|
||||
@@ -13,6 +13,8 @@ import type { ListDownloadMode } from '@/types/list'
|
||||
import type { MessageSendMode } from '@/components/dialog/MessageSendDialog'
|
||||
|
||||
export type ListManageActionsProps = {
|
||||
/** 리스트 초기화/헤더 관리/업로드처럼 내부 관리자 전용 버튼 노출 여부 (외주사 계정에는 숨겨야 함) */
|
||||
showAdminActions: boolean
|
||||
onReset: () => void
|
||||
onHeaderManage: () => void
|
||||
onUpload: () => void
|
||||
@@ -22,6 +24,7 @@ export type ListManageActionsProps = {
|
||||
}
|
||||
|
||||
export function ListManageActions({
|
||||
showAdminActions,
|
||||
onReset,
|
||||
onHeaderManage,
|
||||
onUpload,
|
||||
@@ -32,17 +35,21 @@ export function ListManageActions({
|
||||
return (
|
||||
<div className="flex gap-2 items-center">
|
||||
<div className="flex flex-1 items-center gap-2 flex-wrap">
|
||||
<Button variant="destructive" className="text-base gap-2" onClick={onReset}>
|
||||
<RotateCcw className="w-4 h-4" />
|
||||
리스트 초기화
|
||||
</Button>
|
||||
<Button className="text-base" onClick={onHeaderManage}>
|
||||
헤더 관리
|
||||
</Button>
|
||||
<Button className="text-base gap-2" onClick={onUpload}>
|
||||
<Upload className="w-4 h-4" />
|
||||
리스트 업로드
|
||||
</Button>
|
||||
{showAdminActions && (
|
||||
<>
|
||||
<Button variant="destructive" className="text-base gap-2" onClick={onReset}>
|
||||
<RotateCcw className="w-4 h-4" />
|
||||
리스트 초기화
|
||||
</Button>
|
||||
<Button className="text-base" onClick={onHeaderManage}>
|
||||
헤더 관리
|
||||
</Button>
|
||||
<Button className="text-base gap-2" onClick={onUpload}>
|
||||
<Upload className="w-4 h-4" />
|
||||
리스트 업로드
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
<Button className="text-base bg-excel gap-2" onClick={() => onDownload('list')}>
|
||||
<Download className="w-4 h-4" />
|
||||
리스트
|
||||
|
||||
Reference in New Issue
Block a user