Skip to content

Commit 8a93de7

Browse files
committed
feat: Introduce core UI components including header with user profile and avatar upload, and define client-side navigation modules.
1 parent cce23b6 commit 8a93de7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/client/controller/upload.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ import { Controller } from "./controller.js";
44
export class UploadController extends Controller {
55
public static get(request: Request, response: Response, next: NextFunction) {
66
const currentPath = request.path;
7+
const user = (request as any).user;
8+
9+
if (!user || (user.role !== "admin" && user.role !== "user")) {
10+
response.status(403).render('layouts/main', {
11+
...Controller.defaultConfig,
12+
page: 'error',
13+
title: `Forbidden - ${Controller.defaultConfig.title}`,
14+
currentPath,
15+
message: "Author or Admin access required to upload files."
16+
});
17+
return;
18+
}
719

820
const pageData = {
921
...Controller.defaultConfig,

0 commit comments

Comments
 (0)