Skip to content
Snippets Groups Projects
Commit 7f8909a7 authored by Ewen Le Bihan's avatar Ewen Le Bihan
Browse files

feat(oauth): add ldapInternalEmail field to /identity for peertube

parent b07c0b4b
Branches
Tags v1.38.2
No related merge requests found
......@@ -7,6 +7,7 @@ export const MajorType = builder.prismaObject('Major', {
uid: t.exposeString('uid'),
shortName: t.exposeString('shortName'),
schools: t.relation('schools', { query: { orderBy: { name: 'asc' } } }),
ldapSchool: t.relation('ldapSchool'),
minors: t.relation('minors', { query: { orderBy: { name: 'asc' } } }),
subjects: t.relation('subjects', { query: { orderBy: { name: 'asc' } } }),
}),
......
......@@ -12,6 +12,7 @@ export const SchoolType = builder.prismaObject('School', {
description: t.exposeString('description'),
address: t.exposeString('address'),
services: t.relation('services'),
internalMailDomain: t.exposeString('internalMailDomain'),
}),
});
......
......@@ -8,6 +8,11 @@ export const GET = async ({ fetch, request }) => {
uid: true,
fullName: true,
email: true,
major: {
ldapSchool: {
internalMailDomain: true,
},
},
},
},
{
......@@ -20,9 +25,15 @@ export const GET = async ({ fetch, request }) => {
},
);
return new Response(JSON.stringify(me), {
headers: {
'Content-Type': 'application/json',
return new Response(
JSON.stringify({
...me,
ldapInternalEmail: `${me.uid}@${me.major?.ldapSchool?.internalMailDomain ?? 'external'}`,
}),
{
headers: {
'Content-Type': 'application/json',
},
},
});
);
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment