Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N21-1734 show external id #248

Merged
merged 11 commits into from
Feb 22, 2024
15 changes: 12 additions & 3 deletions controllers/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,19 +357,25 @@ router.get('/search', function (req, res, next) {
$options: 'i',
},
},
{
ldapId: {
$regex: _.escapeRegExp(req.query.q),
$options: 'i',
},
},
],
schoolId: req.query.schoolId ? req.query.schoolId : undefined,
$populate: ['roles', 'schoolId'],
$limit: itemsPerPage,
$skip: itemsPerPage * (currentPage - 1),
$sort: req.query.sort,
$populate: ['roles', 'schoolId'],
},
})
.then((data) => {
api(req)
.get('/roles')
.then((role) => {
const head = ['Vorname', 'Nachname', 'E-Mail-Adresse', 'Rollen', 'Schule', ''];
const head = ['ID', 'Vorname', 'Nachname', 'E-Mail-Adresse', 'Rollen', 'Schule', 'External Id', ''];

const body = data.data.map((item) => {
let roles = item.roles
Expand All @@ -378,11 +384,13 @@ router.get('/search', function (req, res, next) {
})
.join(', ');
return [
item._id || '',
item.firstName || '',
item.lastName || '',
item.email || '',
roles || '',
(item.schoolId || {}).name || '',
item.ldapId || '',
getTableActions(item, '/users/'),
];
});
Expand Down Expand Up @@ -462,7 +470,7 @@ router.get('/', function (req, res, next) {
},
})
.then((data) => {
const head = ['ID', 'Vorname', 'Nachname', 'E-Mail-Adresse', 'Rollen', ''];
const head = ['ID', 'Vorname', 'Nachname', 'E-Mail-Adresse', 'Rollen', 'External Id', ''];

const body = data.data.map((item) => {
if (!item.deletedAt) {
Expand All @@ -477,6 +485,7 @@ router.get('/', function (req, res, next) {
item.lastName || '',
item.email || '',
roles || '',
item.ldapId || '',
getTableActions(item, '/users/'),
];
}
Expand Down
4 changes: 3 additions & 1 deletion static/scripts/schools.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ $(document).ready(function () {
'Migration abgeschlossen': 'userLoginMigration.closedAt',
'Migration final beendet': 'userLoginMigration.finishedAt',
'Login-System': 'systems',
'External Id': 'ldapId',

'subject': 'Titel',
'firstName': 'Vorname',
Expand Down Expand Up @@ -135,7 +136,8 @@ $(document).ready(function () {
'userLoginMigration.mandatorySince': 'Migration verpflichtend',
'userLoginMigration.closedAt': 'Migration abgeschlossen',
'userLoginMigration.finishedAt': 'Migration final beendet',
'systems': 'Login-System'
'systems': 'Login-System',
'ldapId': 'External Id'
};

$('tr th').each(function(i,j) {
Expand Down
2 changes: 1 addition & 1 deletion views/ctltools/ctltools.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<div class="col-sm-3" style="padding-bottom: 20px">
<form class="search-wrapper" action="/ctltools/search/" method="get">
<div class="input-group input-group-sm">
<input type="text" class="form-control search-field" placeholder="Suche nach Tools..." name="q" />
<input type="text" class="form-control search-field" placeholder="Suche nach Tools... (Name)" name="q" />
<span class="input-group-btn">
<button type="submit" class="btn btn-secondary">
<i class="fa fa-search"></i>
Expand Down
2 changes: 1 addition & 1 deletion views/lib/components/table.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<img src="{{this.url}}" alt="{{this.alt}}" height="{{this.height}}" width="{{this.width}}" class="{{this.class}}">
</td>
{{else}}
<td>{{{this}}}</td>
<td style="max-width: 25vw; overflow-wrap: break-word;">{{{this}}}</td>
{{/if}}
{{/ifArray}}
{{/each}}
Expand Down
4 changes: 2 additions & 2 deletions views/schools/forms/add-school.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
</div>

<div class="form-group">
<label class="control-label" for="externalId">External Id</label>
<input id="externalId" name="ldapSchoolIdentifier" class="form-control" readonly>
<label class="control-label" for="ldapId">External Id</label>
<input id="ldapId" name="ldapSchoolIdentifier" class="form-control" readonly>
</div>

<div class="form-group">
Expand Down
2 changes: 1 addition & 1 deletion views/schools/schools.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div class="col-sm-3" style="padding-bottom: 20px">
<form class="search-wrapper" action="/schools/" method="get">
<div class="input-group input-group-sm">
<input type="text" class="form-control search-field" placeholder="Suche nach Schulen..." name="q" />
<input type="text" class="form-control search-field" placeholder="Suche nach Schulen... (Name)" name="q" />
<span class="input-group-btn">
<button type="submit" class="btn btn-secondary">
<i class="fa fa-search"></i>
Expand Down
6 changes: 3 additions & 3 deletions views/users/forms/edit-user.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
</select>
</div>
<div class="form-group">
<label class="control-label" for="externalId">External Id</label>
<input id="externalId" name="ldapId" class="form-control" readonly></input>
</div>
<label class="control-label" for="ldapId">External Id</label>
<input id="ldapId" name="ldapId" class="form-control" readonly></input>
</div>
2 changes: 1 addition & 1 deletion views/users/preselect.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="col-sm-3" style="padding-bottom: 20px">
<form class="search-wrapper" action="/users/search/" method="get">
<div class="input-group input-group-sm">
<input type="text" class="form-control search-field" placeholder="Suche nach Nutzern..." name="q" />
<input type="text" class="form-control search-field" placeholder="Suche nach Nutzenden... (Vor-/Nachname/External Id)" name="q" />
<span class="input-group-btn">
<button type="submit" class="btn btn-secondary">
<i class="fa fa-search"></i>
Expand Down
2 changes: 1 addition & 1 deletion views/users/users.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<form class="search-wrapper" action="/users/search/" method="get">
<div class="input-group input-group-sm">
<input type="hidden" name="schoolId" value="{{schoolId}}">
<input type="text" class="form-control search-field" placeholder="Suche nach Nutzern..." name="q" />
<input type="text" class="form-control search-field" placeholder="Suche nach Nutzenden... (Vor-/Nachname/External Id)" name="q" />
<span class="input-group-btn">
<button type="submit" class="btn btn-secondary">
<i class="fa fa-search"></i>
Expand Down