Refactor AuthenticatedState to store displayName and uid
The AuthenticatedState interface was updated to directly store the `displayName` and `uid` properties. Previously, it stored the entire `CasContent` object, which contained these properties along with others that were not consistently used. This change simplifies the interface and reduces redundancy.
This commit is contained in:
@@ -60,8 +60,8 @@ function getAll(
|
||||
*/
|
||||
function addStudents(database: Database, students: Student[], promoId: string) {
|
||||
const query = `
|
||||
INSERT INTO students
|
||||
(userId, firstName, lastName, mail, promotionId)
|
||||
INSERT INTO students
|
||||
(userId, firstName, lastName, mail, promotionId)
|
||||
VALUES (?, ?, ?, ?, ?)`;
|
||||
|
||||
const statement = database.prepare(query);
|
||||
@@ -92,9 +92,9 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
using connection = connect("students");
|
||||
const database = connection.database;
|
||||
|
||||
if (context.state.session.eduPersonPrimaryAffiliation == "student") {
|
||||
if (context.state.role == "etudiant") {
|
||||
return new Response(
|
||||
JSON.stringify(getItself(database, context.state.session.uid)),
|
||||
JSON.stringify(getItself(database, context.state.uid)),
|
||||
{
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
|
||||
Reference in New Issue
Block a user