mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-10 14:26:32 +00:00
Merge pull request #7214 from overleaf/jpa-refactor-insecure-endpoint
[web] refactor an insecure web-api endpoint into a script GitOrigin-RevId: ba565a41d11fdaeb919dbf3cfe80c6f2e2474df1
This commit is contained in:
parent
f4d17f78f7
commit
d993144fec
1 changed files with 24 additions and 0 deletions
24
services/web/scripts/undelete_project_to_user.js
Normal file
24
services/web/scripts/undelete_project_to_user.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
const minimist = require('minimist')
|
||||
const ProjectDeleter = require('../app/src/Features/Project/ProjectDeleter')
|
||||
|
||||
async function main() {
|
||||
const argv = minimist(process.argv.slice(2))
|
||||
const projectId = argv['project-id']
|
||||
const userId = argv['user-id']
|
||||
|
||||
if (!projectId || !userId) {
|
||||
throw new Error('set --project-id and --user-id')
|
||||
}
|
||||
console.log(`Restoring project ${projectId} to user ${userId}`)
|
||||
await ProjectDeleter.promises.undeleteProject(projectId, { userId })
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => {
|
||||
console.log('Done.')
|
||||
process.exit(0)
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
})
|
Loading…
Add table
Reference in a new issue