Skip to content

Commit 9b06d01

Browse files
committed
add initial draft
1 parent 7e81dcc commit 9b06d01

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

public/officer/new/index.html

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!-- All those who modify this file shall be of honour and the most excellence. -->
2+
3+
<!doctype html>
4+
<html>
5+
<head>
6+
<title>Input Officer Info</title>
7+
<meta charset="utf-8">
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
9+
<link rel="icon" type="image/png" href="/static/icons/favicon_white.png" />
10+
11+
<!-- fonts -->
12+
<link rel="preconnect" href="https://fonts.googleapis.com">
13+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
14+
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
15+
<link href="https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
16+
<link rel="stylesheet" href="/admin/style.css">
17+
<link rel="stylesheet" href="/admin/officers.css">
18+
</head>
19+
20+
<script>
21+
// scripts should wait until hasPermission is non-null (& true)
22+
var hasPermission = null;
23+
24+
// TODO: check if page has a query parameter. If not, redirect to home.
25+
hasPermission = false;
26+
window.location.replace("/");
27+
28+
// TODO: implement an endpoint to get the current user's info
29+
const DEBUG = true;
30+
if (!DEBUG) {
31+
fetch("/api/auth/info").then(response => {
32+
if (!response.ok) {
33+
// TODO: redirect the user to the sfu login api
34+
hasPermission = false;
35+
window.location.replace("/");
36+
} else {
37+
// check if user has same computing_id as query param
38+
response.json().then(json => {
39+
hasPermission = json.is_admin;
40+
if (!hasPermission)
41+
window.location.replace("/");
42+
});
43+
}
44+
});
45+
}
46+
</script>
47+
48+
<body>
49+
<div id="header">
50+
<b>Input Officer Info</b>
51+
</div>
52+
<div id="content">
53+
TODO: this
54+
</div>
55+
</body>
56+
57+
</html>

0 commit comments

Comments
 (0)