backfill_users_sso_attribute.mjs 856 B

123456789101112131415161718192021222324252627282930313233
  1. import SAMLUserIdAttributeBatchHandler from '../modules/saas-authentication/app/src/SAML/SAMLUserIdAttributeBatchHandler.mjs'
  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. try {
  18. const result = await SAMLUserIdAttributeBatchHandler.check(
  19. startInstitutionId,
  20. endInstitutionId
  21. )
  22. console.log(result)
  23. process.exit(0)
  24. } catch (error) {
  25. console.error(error)
  26. process.exit(1)
  27. }