diff --git a/apps/common/features/src/entities/auth/lib/auth-wrapper.tsx b/apps/common/features/src/entities/auth/lib/auth-wrapper.tsx index 6af88ae96..e518f938a 100644 --- a/apps/common/features/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/common/features/src/entities/auth/lib/auth-wrapper.tsx @@ -17,7 +17,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } const response = await client.get( - `${ENDPOINT.USER_SERVICE.USERS}/${userId}`, + `${ENDPOINT.USER_SERVICE.USERS}/info/me`, ); if (!userInfo) setUserInfo(response.data); } diff --git a/apps/common/features/src/shared/store/user-store.ts b/apps/common/features/src/shared/store/user-store.ts index 00379fb1f..65d897cf1 100644 --- a/apps/common/features/src/shared/store/user-store.ts +++ b/apps/common/features/src/shared/store/user-store.ts @@ -5,6 +5,7 @@ export interface IUserInfo { mdfcnDt: string; rgtr: string; mdfr: string; + adminRoleYn: string; userUnqId: string; userId: string; userName: string; diff --git a/apps/common/features/src/widgets/post/ui/post-action.tsx b/apps/common/features/src/widgets/post/ui/post-action.tsx index f0296138f..c74c76482 100644 --- a/apps/common/features/src/widgets/post/ui/post-action.tsx +++ b/apps/common/features/src/widgets/post/ui/post-action.tsx @@ -1,7 +1,7 @@ import { useRouter, usePathname } from "next/navigation"; import { useConfirm } from "@frontend-opensource/use-react-hooks"; import { Button } from "@common/components"; -import { useMenuStore } from "@/shared/lib"; +import { useMenuStore, useUserStore } from "@/shared/lib"; type PostActionProps = { bbsId: string; @@ -15,11 +15,25 @@ function PostAction({ children, handleDelete }: PostActionProps) { const pathname = usePathname(); const { confirm } = useConfirm(); const { bbsInfo } = useMenuStore((state) => state); + const { userInfo } = useUserStore((state) => state); const onDelete = async () => { if (await confirm("삭제하시겠습니까?")) handleDelete(); }; + const checkAnsUseAuthrt = () => { + // 관리자 + if (bbsInfo?.ansUseAuthrt === "A") { + return userInfo?.adminRoleYn === "Y"; + } + // 회원 + if (bbsInfo?.ansUseAuthrt === "M") { + return !!userInfo; + } + // 비회원 + return true; + }; + return (
{children} @@ -45,6 +59,7 @@ function PostAction({ children, handleDelete }: PostActionProps) { type="button" color="gray" onClick={() => router.push(`${pathname}/answer`)} + disabled={!checkAnsUseAuthrt()} > 답글 diff --git a/apps/cs/src/entities/auth/lib/auth-wrapper.tsx b/apps/cs/src/entities/auth/lib/auth-wrapper.tsx index 705c03231..c0be4c2dd 100644 --- a/apps/cs/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/cs/src/entities/auth/lib/auth-wrapper.tsx @@ -19,7 +19,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } const response = await client.get( - `${ENDPOINT.USER_SERVICE.USERS}/${userId}`, + `${ENDPOINT.USER_SERVICE.USERS}/info/me`, ); if (!userInfo) setUserInfo(response.data); } diff --git a/apps/cs/src/entities/menu-authority/ui/management-authority-dialog.tsx b/apps/cs/src/entities/menu-authority/ui/management-authority-dialog.tsx index a6d4d2128..1d9e6cb57 100644 --- a/apps/cs/src/entities/menu-authority/ui/management-authority-dialog.tsx +++ b/apps/cs/src/entities/menu-authority/ui/management-authority-dialog.tsx @@ -82,7 +82,9 @@ function ManagementAuthorityDialog({ 그룹별 메뉴 권한 - +
+ +