Skip to content

Commit

Permalink
Merge pull request #48 from udzuki/fix-47-eppn-unique-constraint-error
Browse files Browse the repository at this point in the history
fix: 重複するalternatenameのePPN登録処理で一意性制約に違反
  • Loading branch information
savvan0h authored Sep 14, 2022
2 parents 424d7f4 + 221a366 commit 9cf3e8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion xapi_stmt_gen/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:12.22.0

LABEL version="2.9.1"
LABEL version="2.9.2"

WORKDIR /usr/local/src
RUN mkdir xapi_stmt_gen
Expand Down
5 changes: 3 additions & 2 deletions xapi_stmt_gen/xapi_stmt_gen/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3723,7 +3723,7 @@ module.exports = async function main() { // eslint-disable-line max-statements
// if authenticated using GakuNinLMS's LTI plugin
const username = (
(user.auth === 'lti' && config.LRS.ePPNScoped)
? user.alternatename
? user.alternatename // Can be null and not unique
: user.username
);
const eppn = eppns.find((eppn) => {
Expand All @@ -3742,7 +3742,8 @@ module.exports = async function main() { // eslint-disable-line max-statements
scope: scope, // nullable
acl: scope ? scope.replace(/[.-]/g, '_') : null // used for RLS
};
if (scope) {
// Exclude duplicates
if (scope && !newEppns.find(e => e.username === username)) {
newEppns.push(userAttrs[user.id]);
}
}
Expand Down

0 comments on commit 9cf3e8e

Please sign in to comment.