mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #1513 from sharelatex/sk-migrate-read-and-write-token-prefix-post-deploy
Script to re-activate token access for select projects GitOrigin-RevId: df379f49ec840948ec1afc0864b35b5b5746ebc1
This commit is contained in:
parent
349d731745
commit
e78487922e
1 changed files with 39 additions and 0 deletions
39
services/web/scripts/project-tokens/reactivate_projects.js
Normal file
39
services/web/scripts/project-tokens/reactivate_projects.js
Normal file
|
@ -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)
|
||||
}
|
||||
)
|
Loading…
Reference in a new issue