backfill_users_sso_attribute.js 855 B

12345678910111213141516171819202122232425262728293031
  1. const SAMLUserIdAttributeBatchHandler = require('../modules/overleaf-integration/app/src/SAML/SAMLUserIdAttributeBatchHandler')
  2. const startInstitutionId = parseInt(process.argv[2])
  3. const endInstitutionId = parseInt(process.argv[3])
  4. process.env.LOG_LEVEL = 'info'
  5. process.env.MONGO_CONNECTION_STRING =
  6. process.env.READ_ONLY_MONGO_CONNECTION_STRING
  7. console.log('Checking users at institutions')
  8. console.log(
  9. 'Start institution ID:',
  10. startInstitutionId ||
  11. 'none provided, will start at beginning of ordered list.'
  12. )
  13. console.log(
  14. 'End institution ID:',
  15. endInstitutionId || 'none provided, will go to end of ordered list.'
  16. )
  17. SAMLUserIdAttributeBatchHandler.check(startInstitutionId, endInstitutionId)
  18. .then(result => {
  19. console.log(result)
  20. process.exit(0)
  21. })
  22. .catch(error => {
  23. console.error(error)
  24. process.exit(1)
  25. })