diff --git a/src/app/(pages)/aup/AupCard/index.tsx b/src/app/(pages)/aup/AupCard/index.tsx
new file mode 100644
index 0000000..81e8c3f
--- /dev/null
+++ b/src/app/(pages)/aup/AupCard/index.tsx
@@ -0,0 +1,37 @@
+import { Aup } from "@/models/aup";
+
+const calculate = (aup: Aup) => {
+ const newDate = new Date(aup.lastUpdateTime as string);
+ return new Date(
+ newDate.setDate(newDate.getDate() + aup.signatureValidityInDays + 900)
+ );
+};
+
+export const AupCard = (props: { aup: Aup }) => {
+ const { aup } = props;
+ const nextSignDate = aup.signatureValidityInDays == 0 ? calculate(aup) : "";
+ return (
+
+
+ Acceptable Usage Policy URL
+
+
{aup?.url}
+
+ The URL above is presented to users at registration time or periodically
+ if the AUP is configured for periodic reacceptance
+
+
+ Created
+
+
{new Date(aup.creationTime).toISOString()}
+
+ Last updated
+
+
{new Date(aup?.lastUpdateTime as string)?.toISOString()}
+
+ Signature Validity (in days)
+
+
{aup?.signatureValidityInDays}
+
+ );
+};
diff --git a/src/app/(pages)/aup/page.tsx b/src/app/(pages)/aup/page.tsx
new file mode 100644
index 0000000..57b734d
--- /dev/null
+++ b/src/app/(pages)/aup/page.tsx
@@ -0,0 +1,39 @@
+import { Button } from "@/components/Button";
+import { fetchAup } from "@/services/aup";
+import { DocumentTextIcon } from "@heroicons/react/16/solid";
+import { AupCard } from "./AupCard";
+
+export default async function Aup() {
+ const aup = await fetchAup();
+ return (
+
+
+
+
+
+
+
Acceptable Usage Policy
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/app/(pages)/components/UserCard/index.tsx b/src/app/(pages)/components/UserCard/index.tsx
index c96c33e..14bc1f8 100644
--- a/src/app/(pages)/components/UserCard/index.tsx
+++ b/src/app/(pages)/components/UserCard/index.tsx
@@ -57,6 +57,7 @@ const User = (props: { me: Me }) => {
["Status", me.active ? "active" : "disabled"],
["Created", created],
["Last Modified", lastModified],
+ ["AUP expired at", lastModified],
];
return (
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index ce94689..51df5e9 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -15,6 +15,7 @@ import {
UserIcon,
ShieldCheckIcon,
InformationCircleIcon,
+ DocumentTextIcon,
} from "@heroicons/react/20/solid";
const AccountManagement = () => {
@@ -30,6 +31,7 @@ const OrganizationManagement = () => {
} />
} />
+ } />
} />
} />
diff --git a/src/models/aup-signature.ts b/src/models/aup-signature.ts
new file mode 100644
index 0000000..9d2f5c8
--- /dev/null
+++ b/src/models/aup-signature.ts
@@ -0,0 +1,20 @@
+type Aup = {
+ url: string;
+ text?: string | null;
+ description?: string | null;
+ signatureValidityInDays: number;
+ creationTime: string;
+ lastUpdateTime?: string | null;
+};
+
+type Account = {
+ uuid: string;
+ username: string;
+ name: string;
+};
+
+export interface AupSignature {
+ aup: Aup;
+ account: Account;
+ signatureTime: string;
+}
diff --git a/src/models/aup.ts b/src/models/aup.ts
new file mode 100644
index 0000000..0c50115
--- /dev/null
+++ b/src/models/aup.ts
@@ -0,0 +1,8 @@
+export interface Aup {
+ url: string;
+ text?: string | null;
+ description?: string | null;
+ signatureValidityInDays: number;
+ creationTime: string;
+ lastUpdateTime?: string | null;
+}
diff --git a/src/services/aup/index.ts b/src/services/aup/index.ts
new file mode 100644
index 0000000..ef7d5e1
--- /dev/null
+++ b/src/services/aup/index.ts
@@ -0,0 +1,26 @@
+import { Aup } from "@/models/aup";
+import getConfig from "@/utils/config";
+import { getItem } from "@/utils/fetch";
+
+const { BASE_URL } = getConfig();
+
+export const fetchAup = async () => {
+ let url = `${BASE_URL}/iam/aup`;
+
+ return await getItem(url);
+};
+
+export const fetchAupSignature = async () => {
+ let url = `${BASE_URL}/iam/aup/signature`;
+
+ return await getItem(url);
+};
+
+// export const editAup = async (_: string | undefined, formData: FormData) => {
+// const urlAup = formData.get("url") as string | undefined;
+// const validity = formData.get("validity") as string | undefined;
+
+// let url = `${BASE_URL}/iam/aup`;
+
+// // return await putItem(url);
+// };
diff --git a/src/utils/fetch/index.ts b/src/utils/fetch/index.ts
index 15704de..b6d9f50 100644
--- a/src/utils/fetch/index.ts
+++ b/src/utils/fetch/index.ts
@@ -21,3 +21,6 @@ export const getItem: GetItem = async (endpoint: string | URL) => {
const response = await authFetch(endpoint);
return response.json();
};
+
+// type PatchItem = (endpoint: string | URL, body: T) => Promise;
+// export const patchItem: PatchItem = async (body: T) => {};