Skip to content

Commit 78b86c7

Browse files
committed
Rename maintainer role to master
Rename AdminAuthGuard to AdminGuard
1 parent 4b08262 commit 78b86c7

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

frontend/src/auth/AdminAuthGuard.tsx renamed to frontend/src/auth/AdminGuard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ interface AuthGuardProps {
66
children: ReactNode;
77
}
88

9-
export default function AdminAuthGuard({ children }: AuthGuardProps) {
9+
export default function AdminGuard({ children }: AuthGuardProps) {
1010
const { user } = useAuth();
11-
if (user?.role !== "admin" && user?.role !== "maintainer") {
11+
if (user?.role !== "admin" && user?.role !== "master") {
1212
return <Navigate to="/login" />;
1313
}
1414
return <>{children}</>;

frontend/src/auth/MaintainerGuard.tsx renamed to frontend/src/auth/MasterGuard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ interface AuthGuardProps {
66
children: ReactNode;
77
}
88

9-
export default function MaintainerGuard({ children }: AuthGuardProps) {
9+
export default function MasterGuard({ children }: AuthGuardProps) {
1010
const { user } = useAuth();
11-
if (user?.role !== 'maintainer') {
11+
if (user?.role !== 'master') {
1212
return <Navigate to="/login" />;
1313
}
1414
return <>{children}</>;

frontend/src/components/Navbar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default function Navbar() {
6969
{ name: "Dashboard", onclick: handleCloseUserMenu },
7070
{ name: "Logout", onclick: logout },
7171
];
72-
if (user?.role === 'maintainer') {
72+
if (user?.role === 'master') {
7373
settings = settings.concat({name: "Create Admin", onclick: () => navigate("/createadmin", { replace: true })})
7474
}
7575

@@ -130,7 +130,7 @@ export default function Navbar() {
130130
<Typography textAlign="center">{page.name}</Typography>
131131
</MenuItem>
132132
))}
133-
{(user?.role === "admin" || user?.role === "maintainer")
133+
{(user?.role === "admin" || user?.role === "master")
134134
&& adminPages.map((page) => (
135135
<MenuItem key={page.name} onClick={() => navigate(page.link)}>
136136
<Typography textAlign="center">{page.name}</Typography>
@@ -172,7 +172,7 @@ export default function Navbar() {
172172
{page.name}
173173
</Button>
174174
))}
175-
{(user?.role === "admin" || user?.role === "maintainer")
175+
{(user?.role === "admin" || user?.role === "master")
176176
&& adminPages.map((page) => (
177177
<Button
178178
key={page.name}

frontend/src/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import App from "./pages/App";
66
import Login from "./pages/login";
77
import SignUp from "./pages/signup";
88
import AuthGuard from "./auth/AuthGuard";
9-
import AdminAuthGuard from "./auth/AdminAuthGuard";
9+
import AdminGuard from "./auth/AdminGuard";
1010
import RedirectIfLoggedIn from "./auth/RedirectIfLoggedIn";
1111
import { DataContextProvider } from "./data/data.context";
1212
import CollabProblemSolver from "./pages/CollabProblemSolver";
@@ -15,7 +15,7 @@ import ProblemSolver from "./pages/ProblemSolver";
1515
import Landing from "./pages/landing";
1616
import Profile from "./pages/profile";
1717
import CreateAdmin from "./pages/createAdmin";
18-
import MaintainerGuard from "./auth/MaintainerGuard";
18+
import MasterGuard from "./auth/MasterGuard";
1919
import QuestionsManage from "./pages/QuestionsManage";
2020
import QuestionsView from "./pages/QuestionsView";
2121

@@ -82,9 +82,9 @@ root.render(
8282
<Route
8383
path="/createadmin"
8484
element={
85-
<MaintainerGuard>
85+
<MasterGuard>
8686
<CreateAdmin />
87-
</MaintainerGuard>
87+
</MasterGuard>
8888
}
8989
/>
9090
<Route
@@ -98,9 +98,9 @@ root.render(
9898
<Route
9999
path="/manage-questions"
100100
element={
101-
<AdminAuthGuard>
101+
<AdminGuard>
102102
<QuestionsManage />
103-
</AdminAuthGuard>
103+
</AdminGuard>
104104
}
105105
/>
106106
</Routes>

frontend/src/pages/profile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default function Profile() {
8181
</Grid>
8282
</Grid>
8383
<DeleteButtonModal/>
84-
{user?.role == 'maintainer' && <AdminUsersTable/>}
84+
{user?.role == 'master' && <AdminUsersTable/>}
8585
</Container>
8686
</Box>
8787
);

0 commit comments

Comments
 (0)