EditorRouter.coffee 1.6 KB

1234567891011121314151617181920212223
  1. EditorHttpController = require('./EditorHttpController')
  2. SecurityManager = require('../../managers/SecurityManager')
  3. AuthenticationController = require "../Authentication/AuthenticationController"
  4. module.exports =
  5. apply: (app) ->
  6. app.post '/project/:Project_id/doc', SecurityManager.requestCanModifyProject, EditorHttpController.addDoc
  7. app.post '/project/:Project_id/folder', SecurityManager.requestCanModifyProject, EditorHttpController.addFolder
  8. app.post '/project/:Project_id/:entity_type/:entity_id/rename', SecurityManager.requestCanModifyProject, EditorHttpController.renameEntity
  9. app.post '/project/:Project_id/:entity_type/:entity_id/move', SecurityManager.requestCanModifyProject, EditorHttpController.moveEntity
  10. app.delete '/project/:Project_id/file/:entity_id', SecurityManager.requestCanModifyProject, EditorHttpController.deleteFile
  11. app.delete '/project/:Project_id/doc/:entity_id', SecurityManager.requestCanModifyProject, EditorHttpController.deleteDoc
  12. app.delete '/project/:Project_id/folder/:entity_id', SecurityManager.requestCanModifyProject, EditorHttpController.deleteFolder
  13. app.post '/project/:Project_id/doc/:doc_id/restore', SecurityManager.requestCanModifyProject, EditorHttpController.restoreDoc
  14. # Called by the real-time API to load up the current project state.
  15. # This is a post request because it's more than just a getting of data. We take actions
  16. # whenever a user joins a project, like updating the deleted status.
  17. app.post '/project/:Project_id/join', AuthenticationController.httpAuth, EditorHttpController.joinProject
  18. app.ignoreCsrf('post', '/project/:Project_id/join')