CJVT updates August and September 2026

This commit is contained in:
Luka Romih
2026-10-01 00:49:26 +02:00
parent fd02e25719
commit 83f73aeb58
135 changed files with 6146 additions and 1970 deletions
+28
View File
@@ -27,6 +27,27 @@ router.get(
dictionaries.listDictionaries
)
// Change page in pagination (read-only "Ogled virov" list, any logged-in user).
router.get(
'/listAllViewableDictionaries',
user.isAuthenticated,
dictionaries.listDictionaries
)
// Soft-warning check: does a candidate dictionary name collide with another own dictionary?
router.get(
'/check-name-collision',
user.isAuthenticated,
dictionaries.checkNameCollision
)
// Send a message to all users with a role on the given dictionary.
router.post(
'/:dictionaryId/contact-authors',
user.isAuthenticated,
dictionaries.contactDictionaryAuthors
)
// Change page in pagination
router.get(
'/:dictionaryId/listDomainLabels',
@@ -76,6 +97,13 @@ router.post(
dictionaries.exportBegin
)
// Delete a specific dictionary export.
router.delete(
'/:dictionaryId/export/:exportId',
user.canContentEdit,
dictionaries.deleteExport
)
router.get(
'/:dictionaryId/domainLabels',
user.canContentEdit,
+1
View File
@@ -17,6 +17,7 @@ const {
// All further routes are only available to authenticated users with dictionary content editing rights.
router.use(user.isAuthenticated)
router.use('/delete-entry', setDerivedDictionaryIdFromEntryId)
router.use('/:entryId/version-snapshots', setDerivedDictionaryIdFromEntryId)
router.use(user.canContentEdit)
// Render entry data for the selected entry
+13
View File
@@ -2,6 +2,7 @@ const router = require('express-promise-router')()
const user = require('../../../controllers/users')
const users = require('../../../controllers/api/v1/users')
const userAuth = require('../../../middleware/user')
const oidc = require('../../../controllers/oidc')
// Validate and create a new user.
router.post('/register', user.register)
@@ -15,6 +16,13 @@ router.post('/reset-password-init', user.generateResetPasswordToken)
// Validate new passwords, change if successful and sign the user in.
router.post('/reset-password-submit', user.changePassword)
// Create a brand-new SSO account from the session-stored IdP claims, and sign the user in.
router.post('/create-profile', oidc.createProfileSubmit)
// Confirm the matched local account's password, then permanently convert it into an SSO-only
// account (IdP-derived name/username, local password removed).
router.post('/convert-account', oidc.convertAccountSubmit)
// Find user by username or email in dictionary or admin console.
router.get(
'/addUser',
@@ -41,6 +49,11 @@ router.post('/basic-data', users.updateBasicData)
router.post('/password', users.updatePassword)
// Delete user profile of the requesting user.
// TODO This route has no explicit isAuthenticated middleware, unlike the admin-only routes above
// - it relies entirely on req.user.id throwing inside the controller when req.user is undefined,
// which surfaces as an unhandled 500 rather than a clean 401/403 (see the general API-auth TODO
// in routes/api/index.js). Since this endpoint permanently destroys account data, it deserves an
// explicit auth check of its own rather than an implicit crash-as-guard.
router.delete('/current', users.deleteCurrent)
module.exports = router
+9
View File
@@ -2,6 +2,7 @@ const router = require('express-promise-router')()
const { isAuthenticated: isUserAuthenticated } = require('../middleware/user')
const index = require('../controllers/index')
const user = require('../controllers/users')
const oidc = require('../controllers/oidc')
// TODO Some of these endpoints might need authorization protection. Review and clean up at a later point.
@@ -37,6 +38,14 @@ router.get('/slovarji/xml-schema', (req, res) => {
// Activate user account.
router.get('/users/activate', user.activateAccount)
// SSO/OIDC (University of Ljubljana) login.
router.get('/users/oidc/login', oidc.login)
// Fixed by the already-configured Authentik/University of Ljubljana redirect URI - path must not
// change.
router.get('/users/oidc/callback', oidc.callback)
router.get('/users/create-profile', oidc.createProfileForm)
router.get('/users/convert-account', oidc.convertAccountForm)
// Render privacy policy page
router.get('/politika-zasebnosti', (req, res) => {
res.render(`pages/privacy-policy_${req.language}`, {
+19
View File
@@ -0,0 +1,19 @@
const router = require('express-promise-router')()
const dictionary = require('../controllers/dictionaries')
// All routes require an authenticated user. Redirect to the site root, not
// req.baseUrl - unlike routes/dictionaries.js this router's own root ('/')
// is itself gated, so redirecting to req.baseUrl (== '/ogled-virov') would
// send an anonymous visitor straight back into the same check, looping.
router.use((req, res, next) => {
if (req.isAuthenticated()) return next()
res.redirect(303, '/')
})
// Show a read-only list of all dictionaries on the portal, regardless of status.
router.get('/', dictionary.listViewableDictionaries)
// Show read-only details for a specific dictionary.
router.get('/:dictionaryId/podatki', dictionary.viewDictionaryDetails)
module.exports = router