+
{children}
);
diff --git a/src/app/actions/judge.ts b/src/app/actions/judge.ts
index 83af37e..3e60a67 100644
--- a/src/app/actions/judge.ts
+++ b/src/app/actions/judge.ts
@@ -84,7 +84,7 @@ export const judge = async (
const canAccessAssignment =
actor.role === "ADMIN" ||
(actor.role === "TEACHER" && isTeacherOwner) ||
- (actor.role === "GUEST" && isStudentEnrolled);
+ (actor.role === "STUDENT" && isStudentEnrolled);
if (!canAccessAssignment) {
await createSystemErrorSubmission("No permission for assignment", {
@@ -100,7 +100,7 @@ export const judge = async (
return Status.SE;
}
- if (!assignment.published && actor.role === "GUEST") {
+ if (!assignment.published && actor.role === "STUDENT") {
await createSystemErrorSubmission("Assignment is not published", {
assignmentId: assignment.id,
});
diff --git a/src/components/dynamic-breadcrumb.tsx b/src/components/dynamic-breadcrumb.tsx
index 9cec3b3..d8408a4 100644
--- a/src/components/dynamic-breadcrumb.tsx
+++ b/src/components/dynamic-breadcrumb.tsx
@@ -44,7 +44,7 @@ export function DynamicBreadcrumb() {
admin: "管理后台",
teacher: "教师平台",
student: "学生平台",
- usermanagement: "用户管理",
+ usermanagement: "账号管理",
courses: "课程",
assignments: "作业",
userdashboard: "用户仪表板",
diff --git a/src/components/sidebar/admin-sidebar.tsx b/src/components/sidebar/admin-sidebar.tsx
index f6c739c..e3302e4 100644
--- a/src/components/sidebar/admin-sidebar.tsx
+++ b/src/components/sidebar/admin-sidebar.tsx
@@ -26,7 +26,7 @@ const adminData = {
isActive: true,
items: [
{ title: "管理员管理", url: "/dashboard/usermanagement/admin" },
- { title: "用户管理", url: "/dashboard/usermanagement/guest" },
+ { title: "学生管理", url: "/dashboard/usermanagement/student" },
{ title: "教师管理", url: "/dashboard/usermanagement/teacher" },
{ title: "题目管理", url: "/dashboard/usermanagement/problem" },
],
diff --git a/src/components/sidebar/teacher-sidebar.tsx b/src/components/sidebar/teacher-sidebar.tsx
index 95241ba..347522c 100644
--- a/src/components/sidebar/teacher-sidebar.tsx
+++ b/src/components/sidebar/teacher-sidebar.tsx
@@ -26,8 +26,8 @@ const data = {
isActive: true,
items: [
{
- title: "用户管理",
- url: "/dashboard/usermanagement/guest",
+ title: "学生管理",
+ url: "/dashboard/usermanagement/student",
},
{
title: "题目管理",
diff --git a/src/features/user-management/components/generic-page.tsx b/src/features/user-management/components/generic-page.tsx
index 090c63e..79f029b 100644
--- a/src/features/user-management/components/generic-page.tsx
+++ b/src/features/user-management/components/generic-page.tsx
@@ -5,19 +5,19 @@ import { UserConfig } from "./user-table";
import type { User, Problem } from "@/generated/client";
interface GenericPageProps {
- userType: "admin" | "teacher" | "guest" | "problem";
+ resourceType: "admin" | "teacher" | "student" | "problem";
config: UserConfig;
}
export default async function GenericPage({
- userType,
+ resourceType,
config,
}: GenericPageProps) {
- if (userType === "problem") {
+ if (resourceType === "problem") {
const data: Problem[] = await prisma.problem.findMany({});
return ;
} else {
- const role = userType.toUpperCase() as Role;
+ const role = resourceType.toUpperCase() as Role;
const data: User[] = await prisma.user.findMany({ where: { role } });
return ;
}
diff --git a/src/features/user-management/components/user-table.tsx b/src/features/user-management/components/user-table.tsx
index 8fb8cba..fbe24c3 100644
--- a/src/features/user-management/components/user-table.tsx
+++ b/src/features/user-management/components/user-table.tsx
@@ -78,7 +78,7 @@ import {
} from "@/app/(protected)/dashboard/usermanagement/actions/problemActions";
export interface UserConfig {
- userType: string;
+ resourceType: string;
title: string;
apiPath: string;
columns: Array<{
@@ -154,7 +154,7 @@ const addProblemSchema = z.object({
});
export function UserTable(props: UserTableProps) {
- const isProblem = props.config.userType === "problem";
+ const isProblem = props.config.resourceType === "problem";
const router = useRouter();
const problemData = isProblem ? (props.data as Problem[]) : undefined;
@@ -324,7 +324,7 @@ export function UserTable(props: UserTableProps) {
createdAt: "",
image: null,
emailVerified: null,
- role: Role.GUEST,
+ role: Role.STUDENT,
},
});
React.useEffect(() => {
@@ -336,7 +336,7 @@ export function UserTable(props: UserTableProps) {
createdAt: "",
image: null,
emailVerified: null,
- role: Role.GUEST,
+ role: Role.STUDENT,
});
}
}, [open, form]);
@@ -354,19 +354,19 @@ export function UserTable(props: UserTableProps) {
...data,
image: data.image ?? null,
emailVerified: data.emailVerified ?? null,
- role: data.role ?? Role.GUEST,
+ role: data.role ?? Role.STUDENT,
};
if (!submitData.name) submitData.name = "";
if (!submitData.createdAt)
submitData.createdAt = new Date().toISOString();
else
submitData.createdAt = new Date(submitData.createdAt).toISOString();
- if (props.config.userType === "admin")
+ if (props.config.resourceType === "admin")
await createUser("admin", submitData);
- else if (props.config.userType === "teacher")
+ else if (props.config.resourceType === "teacher")
await createUser("teacher", submitData);
- else if (props.config.userType === "guest")
- await createUser("guest", submitData);
+ else if (props.config.resourceType === "student")
+ await createUser("student", submitData);
onOpenChange(false);
toast.success("添加成功", { duration: 1500 });
router.refresh();
@@ -610,7 +610,7 @@ export function UserTable(props: UserTableProps) {
name: user.name ?? "",
email: user.email ?? "",
password: "",
- role: user.role ?? Role.GUEST,
+ role: user.role ?? Role.STUDENT,
createdAt: user.createdAt
? new Date(user.createdAt).toISOString().slice(0, 16)
: "",
@@ -625,7 +625,7 @@ export function UserTable(props: UserTableProps) {
name: user.name ?? "",
email: user.email ?? "",
password: "",
- role: user.role ?? Role.GUEST,
+ role: user.role ?? Role.STUDENT,
createdAt: user.createdAt
? new Date(user.createdAt).toISOString().slice(0, 16)
: "",
@@ -644,15 +644,15 @@ export function UserTable(props: UserTableProps) {
: new Date().toISOString(),
image: data.image ?? null,
emailVerified: data.emailVerified ?? null,
- role: data.role ?? Role.GUEST,
+ role: data.role ?? Role.STUDENT,
};
const id = typeof submitData.id === "string" ? submitData.id : "";
- if (props.config.userType === "admin")
+ if (props.config.resourceType === "admin")
await updateUser("admin", id, submitData);
- else if (props.config.userType === "teacher")
+ else if (props.config.resourceType === "teacher")
await updateUser("teacher", id, submitData);
- else if (props.config.userType === "guest")
- await updateUser("guest", id, submitData);
+ else if (props.config.resourceType === "student")
+ await updateUser("student", id, submitData);
onOpenChange(false);
toast.success("修改成功", { duration: 1500 });
} catch {
@@ -710,7 +710,7 @@ export function UserTable(props: UserTableProps) {
))}
{/* 编辑时显示角色选择 */}
- {props.config.userType !== "problem" && (
+ {props.config.resourceType !== "problem" && (