2014-11-06 06:53:59 -05:00
|
|
|
EditorHttpController = require('./EditorHttpController')
|
2015-04-15 06:14:38 -04:00
|
|
|
AuthenticationController = require "../Authentication/AuthenticationController"
|
2016-03-10 12:17:26 -05:00
|
|
|
AuthorizationMiddlewear = require('../Authorization/AuthorizationMiddlewear')
|
2014-11-06 06:53:59 -05:00
|
|
|
|
|
|
|
module.exports =
|
2015-06-30 09:38:32 -04:00
|
|
|
apply: (webRouter, apiRouter) ->
|
2016-03-10 12:17:26 -05:00
|
|
|
webRouter.post '/project/:Project_id/doc', AuthorizationMiddlewear.ensureUserCanWriteProjectContent, EditorHttpController.addDoc
|
|
|
|
webRouter.post '/project/:Project_id/folder', AuthorizationMiddlewear.ensureUserCanWriteProjectContent, EditorHttpController.addFolder
|
2014-11-06 06:53:59 -05:00
|
|
|
|
2016-03-10 12:17:26 -05:00
|
|
|
webRouter.post '/project/:Project_id/:entity_type/:entity_id/rename', AuthorizationMiddlewear.ensureUserCanWriteProjectContent, EditorHttpController.renameEntity
|
|
|
|
webRouter.post '/project/:Project_id/:entity_type/:entity_id/move', AuthorizationMiddlewear.ensureUserCanWriteProjectContent, EditorHttpController.moveEntity
|
2014-11-06 06:53:59 -05:00
|
|
|
|
2016-03-10 12:17:26 -05:00
|
|
|
webRouter.delete '/project/:Project_id/file/:entity_id', AuthorizationMiddlewear.ensureUserCanWriteProjectContent, EditorHttpController.deleteFile
|
|
|
|
webRouter.delete '/project/:Project_id/doc/:entity_id', AuthorizationMiddlewear.ensureUserCanWriteProjectContent, EditorHttpController.deleteDoc
|
|
|
|
webRouter.delete '/project/:Project_id/folder/:entity_id', AuthorizationMiddlewear.ensureUserCanWriteProjectContent, EditorHttpController.deleteFolder
|
2014-11-06 06:53:59 -05:00
|
|
|
|
2016-03-10 12:17:26 -05:00
|
|
|
webRouter.post '/project/:Project_id/doc/:doc_id/restore', AuthorizationMiddlewear.ensureUserCanWriteProjectContent, EditorHttpController.restoreDoc
|
2014-11-07 07:31:47 -05:00
|
|
|
|
|
|
|
# Called by the real-time API to load up the current project state.
|
|
|
|
# This is a post request because it's more than just a getting of data. We take actions
|
|
|
|
# whenever a user joins a project, like updating the deleted status.
|
2015-06-30 09:38:32 -04:00
|
|
|
apiRouter.post '/project/:Project_id/join', AuthenticationController.httpAuth, EditorHttpController.joinProject
|