diff --git a/services/web/scripts/project-tokens/reactivate_projects.js b/services/web/scripts/project-tokens/reactivate_projects.js new file mode 100644 index 0000000000..1c2e3a64ca --- /dev/null +++ b/services/web/scripts/project-tokens/reactivate_projects.js @@ -0,0 +1,39 @@ +const ProjectDetailsHandler = require('../../app/js/Features/Project/ProjectDetailsHandler') +const Async = require('async') + +const projectIds = [ + // put ids here +] + +Async.eachLimit( + projectIds, + 5, + (projectId, cb) => { + ProjectDetailsHandler.setPublicAccessLevel(projectId, 'tokenBased', err => { + if (err) { + return cb(err) + } + console.log( + `>> Set public-access-level to tokenBased for project ${projectId}` + ) + ProjectDetailsHandler.ensureTokensArePresent(projectId, (err, tokens) => { + if (err) { + return cb(err) + } + console.log( + `>> Re-generated tokens for project ${projectId}, ${JSON.stringify( + tokens + )}` + ) + cb() + }) + }) + }, + err => { + if (err) { + throw err + } + console.log('>> Done') + process.exit(0) + } +)