-
-
Save akhilesh26/2c88065a52556d4fa91e1063a35de78b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.get('/reindex', auth.isAuthenticated, (req, res) => { | |
const {orm} = req.app.locals; | |
const indexPromise = new Promise((resolve) => { | |
// TODO: This is hacky, and we should replace it once we switch to SOLR. | |
const trustedUsers = ['Leftmost Cat', 'LordSputnik', 'mastcoder']; | |
const NO_MATCH = -1; | |
if (trustedUsers.indexOf(req.user.name) === NO_MATCH) { | |
throw new error.PermissionDeniedError(null, req); | |
} | |
resolve(); | |
}) | |
.then(() => search.generateIndex(orm)) | |
.then(() => ({success: true})); | |
handler.sendPromiseResult(res, indexPromise); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"error":"You do not have permission to access this page"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment