diff --git a/fresh.gen.ts b/fresh.gen.ts index a256829..9d9666d 100644 --- a/fresh.gen.ts +++ b/fresh.gen.ts @@ -11,7 +11,6 @@ import * as $_apps_mobility_partials_overview from "./routes/(apps)/mobility/par import * as $_apps_mobility_partials_students from "./routes/(apps)/mobility/partials/students.tsx"; import * as $_apps_notes_index from "./routes/(apps)/notes/index.tsx"; import * as $_apps_notes_partials_admin_courses from "./routes/(apps)/notes/partials/(admin)/courses.tsx"; -import * as $_apps_notes_partials_admin_students from "./routes/(apps)/notes/partials/(admin)/students.tsx"; import * as $_apps_notes_partials_index from "./routes/(apps)/notes/partials/index.tsx"; import * as $_apps_notes_partials_notes from "./routes/(apps)/notes/partials/notes.tsx"; import * as $_apps_students_api_example from "./routes/(apps)/students/api/example.ts"; @@ -52,8 +51,6 @@ const manifest = { "./routes/(apps)/notes/index.tsx": $_apps_notes_index, "./routes/(apps)/notes/partials/(admin)/courses.tsx": $_apps_notes_partials_admin_courses, - "./routes/(apps)/notes/partials/(admin)/students.tsx": - $_apps_notes_partials_admin_students, "./routes/(apps)/notes/partials/index.tsx": $_apps_notes_partials_index, "./routes/(apps)/notes/partials/notes.tsx": $_apps_notes_partials_notes, "./routes/(apps)/students/api/example.ts": $_apps_students_api_example, diff --git a/routes/(apps)/notes/(_props)/props.ts b/routes/(apps)/notes/(_props)/props.ts index c3d9f0f..36b0f28 100644 --- a/routes/(apps)/notes/(_props)/props.ts +++ b/routes/(apps)/notes/(_props)/props.ts @@ -7,7 +7,6 @@ const properties: AppProperties = { index: "Homepage", notes: "Notes", courses: "Courses management", - students: "Students management", }, adminOnly: ["courses", "students"], hint: "Student grading management", diff --git a/routes/(apps)/notes/partials/(admin)/courses.tsx b/routes/(apps)/notes/partials/(admin)/courses.tsx index 9d361cf..3ac215d 100644 --- a/routes/(apps)/notes/partials/(admin)/courses.tsx +++ b/routes/(apps)/notes/partials/(admin)/courses.tsx @@ -1,17 +1,14 @@ -import { Partial } from "$fresh/runtime.ts"; -import { RouteConfig } from "$fresh/server.ts"; +import { + getPartialsConfig, + makePartials, +} from "$root/defaults/makePartials.tsx"; +import { FreshContext } from "$fresh/server.ts"; +import { State } from "$root/routes/_middleware.ts"; -type ModulesProps = Record; - -export const config: RouteConfig = { - skipAppWrapper: true, - skipInheritedLayouts: true, -}; - -export default function Modules(_props: ModulesProps) { - return ( - - notes - - ); +// deno-lint-ignore require-await +async function Courses(_request: Request, context: FreshContext) { + return

Welcome to {context.state.session?.displayName}.

; } + +export const config = getPartialsConfig(); +export default makePartials(Courses); diff --git a/routes/(apps)/notes/partials/(admin)/students.tsx b/routes/(apps)/notes/partials/(admin)/students.tsx deleted file mode 100644 index 9d361cf..0000000 --- a/routes/(apps)/notes/partials/(admin)/students.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { Partial } from "$fresh/runtime.ts"; -import { RouteConfig } from "$fresh/server.ts"; - -type ModulesProps = Record; - -export const config: RouteConfig = { - skipAppWrapper: true, - skipInheritedLayouts: true, -}; - -export default function Modules(_props: ModulesProps) { - return ( - - notes - - ); -} diff --git a/routes/(apps)/notes/partials/index.tsx b/routes/(apps)/notes/partials/index.tsx index 85fcd2b..2971e0e 100644 --- a/routes/(apps)/notes/partials/index.tsx +++ b/routes/(apps)/notes/partials/index.tsx @@ -2,11 +2,12 @@ import { getPartialsConfig, makePartials, } from "$root/defaults/makePartials.tsx"; +import { FreshContext } from "$fresh/server.ts"; +import { State } from "$root/routes/_middleware.ts"; -type NotesIndexProps = Record; - -export function Index(_props: NotesIndexProps) { - return bip boup; +// deno-lint-ignore require-await +export async function Index(_request: Request, context: FreshContext) { + return

Welcome to {context.state.session?.displayName}.

; } export const config = getPartialsConfig(); diff --git a/routes/(apps)/notes/partials/notes.tsx b/routes/(apps)/notes/partials/notes.tsx index 9d361cf..1e3bbc1 100644 --- a/routes/(apps)/notes/partials/notes.tsx +++ b/routes/(apps)/notes/partials/notes.tsx @@ -1,17 +1,14 @@ -import { Partial } from "$fresh/runtime.ts"; -import { RouteConfig } from "$fresh/server.ts"; +import { + getPartialsConfig, + makePartials, +} from "$root/defaults/makePartials.tsx"; +import { FreshContext } from "$fresh/server.ts"; +import { State } from "$root/routes/_middleware.ts"; -type ModulesProps = Record; - -export const config: RouteConfig = { - skipAppWrapper: true, - skipInheritedLayouts: true, -}; - -export default function Modules(_props: ModulesProps) { - return ( - - notes - - ); +// deno-lint-ignore require-await +async function Notes(_request: Request, context: FreshContext) { + return

Welcome to {context.state.session?.displayName}.

; } + +export const config = getPartialsConfig(); +export default makePartials(Notes); diff --git a/routes/about.tsx b/routes/about.tsx index 05fb902..17415ee 100644 --- a/routes/about.tsx +++ b/routes/about.tsx @@ -9,7 +9,169 @@ export default async function About(_request: Request, _context: FreshContext) { PolyMPR is born from the will to enhance Polytech INFO department's HR infrastructure.

-

Terms of Use

+

Terms of Use

+

+ + Last updated: 21th Jan. 2025 + +

+

+ By accessing and using this website through the Aix-Marseille University + (AMU) Single Sign-On (SSO) authentication system, you agree to comply + with these Terms and Conditions. Please read them carefully before + proceeding. +

+

1. Acceptance of Terms

+

By logging in with your AMU SSO credentials, you confirm that:

+
    +
  • + You are an authorized user of Aix-Marseille University's SSO system. +
  • +
  • + You agree to be bound by these Terms and Conditions, as well as any + additional rules, policies, or guidelines applicable to the use of + this website. +
  • +
+

+ If you do not agree with these terms, you are not authorized to access + or use this website. +

+

2. Eligibility

+

+ Access to this website is restricted to authorized individuals + affiliated with Aix-Marseille University, such as students, faculty, + staff, or others explicitly granted access. Unauthorized use is strictly + prohibited and may result in suspension or termination of access. +

+

3. Authentication Through AMU SSO

+
    +
  • + Authentication through AMU's SSO system is required to access this + website. +
  • +
  • + You are responsible for safeguarding your AMU SSO login credentials + and ensuring they are not shared with others. +
  • +
  • + If you suspect unauthorized use of your AMU SSO credentials, you must + immediately notify Aix-Marseille University's IT services at{" "} + + https://dirnum.univ-amu.fr/fr + . +
  • +
+

4. Permitted Use

+

By accessing the website, you agree to:

+
    +
  • + Use the website only for its intended academic, administrative, or + research purposes. +
  • +
  • + Refrain from engaging in any of the following prohibited activities: +
  • +
      +
    • + Sharing your access credentials with unauthorized individuals. +
    • +
    • + Misusing, modifying, or attempting to exploit the website's + services. +
    • +
    • + Uploading or distributing malware, offensive content, or any + material that violates university policies or applicable laws. +
    • +
    +
+

5. Privacy and Data Protection

+

By using this website:

+
    +
  • + You acknowledge that your personal data, including your AMU SSO login + and activity on the website, may be collected, processed, and stored + in accordance with Aix-Marseille University’s privacy policy and + applicable data protection laws (e.g., GDPR). +
  • +
  • + This data is used for authentication, and improving the website's + services. +
  • +
+

6. Intellectual Property

+
    +
  • + All content and materials provided on this website are the + intellectual property of Aix-Marseille University or its licensors. +
  • +
  • + You are granted a limited, non-transferable license to use the content + for personal, academic, or research purposes. Any unauthorized use, + reproduction, or distribution is strictly prohibited. +
  • +
+

7. Termination of Access

+
    +
  • + Aix-Marseille University reserves the right to suspend or terminate + your access without notice if: +
  • +
      +
    • + You violate these Terms and Conditions or university policies. +
    • +
    • + Your AMU affiliation is revoked or your SSO account is deactivated. +
    • +
    +
  • + Unauthorized access attempts may be reported to the appropriate + authorities. +
  • +
+

8. Disclaimers and Limitations of Liability

+
    +
  • + The website and its content are provided "as is" and "as available" + without any warranties, express or implied. +
  • +
  • + Aix-Marseille University and the website administrators are not liable + for: +
  • +
      +
    • Interruptions in service, data loss, or technical issues.
    • +
    • + Any unauthorized use of your AMU SSO credentials resulting from your + negligence. +
    • +
    +
+

9. Modifications to the Terms

+
    +
  • + Aix-Marseille University may update these Terms and Conditions + periodically to reflect changes in laws, policies, or services. +
  • +
  • + Your continued use of the website following any changes constitutes + your acceptance of the updated terms. +
  • +
+

10. Governing Law

+

+ These Terms and Conditions are governed by and construed in accordance + with the laws of France and applicable EU regulations. +

+

11. Contact Information

+

+ For questions or support, please contact:{" "} + + Aix-Marseille University IT Services + . +

); } diff --git a/routes/index.tsx b/routes/index.tsx index a210e9a..f879091 100644 --- a/routes/index.tsx +++ b/routes/index.tsx @@ -4,7 +4,8 @@ import { FreshContext } from "$fresh/server.ts"; export default async function Home(_request: Request, _context: FreshContext) { return ( <> -

Welcome to PolyMPR!

+

PolyMPR

+

The ultimate HR platform

); } diff --git a/routes/login.tsx b/routes/login.tsx index 66dfcb0..dbaa622 100644 --- a/routes/login.tsx +++ b/routes/login.tsx @@ -11,7 +11,6 @@ import { createJwt } from "@popov/jwt"; import { setCookie } from "$std/http/cookie.ts"; import { getKey } from "$root/routes/_middleware.ts"; -const SERVICE = "https://localhost/login"; const CAS = "https://ident.univ-amu.fr/cas"; function getTag(tag: CasTagNode): [string, string] { @@ -57,10 +56,11 @@ export const handler: Handlers = { async GET(request, context) { const url = new URL(request.url); const ticket = url.searchParams.get("ticket"); + const service = `${context.url.origin}/login`; if (ticket) { const response = await fetch( - `${CAS}/serviceValidate?service=${SERVICE}&ticket=${ticket}`, + `${CAS}/serviceValidate?service=${service}&ticket=${ticket}`, ); const body = parse(await response.text()) as [RegularTagNode]; const casResponse = body[0].children[0] as CasResponse; @@ -69,7 +69,7 @@ export const handler: Handlers = { return new Response(null, { status: 302, headers: { - Location: `${CAS}/login?service=${SERVICE}`, + Location: `${CAS}/login?service=${service}`, }, }); } @@ -99,7 +99,7 @@ export const handler: Handlers = { return new Response(null, { status: 302, headers: { - Location: `${CAS}/login?service=${SERVICE}`, + Location: `${CAS}/login?service=${service}`, }, }); } diff --git a/routes/logout.tsx b/routes/logout.tsx index 4481ac3..6111c62 100644 --- a/routes/logout.tsx +++ b/routes/logout.tsx @@ -2,7 +2,6 @@ import { Handlers } from "$fresh/server.ts"; import { State } from "$root/routes/_middleware.ts"; import { deleteCookie } from "$std/http/cookie.ts"; -const SERVICE = "https://localhost/"; const CAS = "https://ident.univ-amu.fr/cas"; // deno-lint-ignore no-explicit-any @@ -12,7 +11,7 @@ export const handler: Handlers = { const headers = new Headers(); deleteCookie(headers, "sessionToken", { path: "/" }); - headers.set("Location", `${CAS}/logout?service=${SERVICE}`); + headers.set("Location", `${CAS}/logout?service=${context.url.origin}`); return new Response(null, { status: 302,