2014-04-07 06:02:12 -04:00
|
|
|
AdminController = require('./Features/ServerAdmin/AdminController')
|
2014-04-07 05:55:07 -04:00
|
|
|
HomeController = require('./Features/StaticPages/HomeController')
|
2014-04-08 09:34:03 -04:00
|
|
|
ProjectController = require("./Features/Project/ProjectController")
|
2014-02-12 05:23:40 -05:00
|
|
|
ProjectApiController = require("./Features/Project/ProjectApiController")
|
2014-04-07 05:55:07 -04:00
|
|
|
InfoController = require('./Features/StaticPages/InfoController')
|
2014-02-12 05:23:40 -05:00
|
|
|
SpellingController = require('./Features/Spelling/SpellingController')
|
2014-03-27 13:00:41 -04:00
|
|
|
SecurityManager = require('./managers/SecurityManager')
|
2014-02-12 05:23:40 -05:00
|
|
|
AuthorizationManager = require('./Features/Security/AuthorizationManager')
|
|
|
|
versioningController = require("./Features/Versioning/VersioningApiController")
|
|
|
|
EditorController = require("./Features/Editor/EditorController")
|
|
|
|
EditorUpdatesController = require("./Features/Editor/EditorUpdatesController")
|
|
|
|
Settings = require('settings-sharelatex')
|
|
|
|
TpdsController = require('./Features/ThirdPartyDataStore/TpdsController')
|
|
|
|
dropboxHandler = require('./Features/Dropbox/DropboxHandler')
|
|
|
|
SubscriptionRouter = require './Features/Subscription/SubscriptionRouter'
|
|
|
|
UploadsRouter = require './Features/Uploads/UploadsRouter'
|
|
|
|
metrics = require('./infrastructure/Metrics')
|
|
|
|
ReferalController = require('./Features/Referal/ReferalController')
|
|
|
|
ReferalMiddleware = require('./Features/Referal/ReferalMiddleware')
|
|
|
|
TemplatesController = require('./Features/Templates/TemplatesController')
|
|
|
|
TemplatesMiddlewear = require('./Features/Templates/TemplatesMiddlewear')
|
|
|
|
AuthenticationController = require('./Features/Authentication/AuthenticationController')
|
|
|
|
TagsController = require("./Features/Tags/TagsController")
|
|
|
|
CollaboratorsController = require('./Features/Collaborators/CollaboratorsController')
|
2014-04-09 09:45:46 -04:00
|
|
|
UserInfoController = require('./Features/User/UserInfoController')
|
2014-04-10 12:29:46 -04:00
|
|
|
UserController = require("./Features/User/UserController")
|
2014-04-09 07:17:50 -04:00
|
|
|
UserPagesController = require('./Features/User/UserPagesController')
|
2014-02-12 05:23:40 -05:00
|
|
|
DocumentController = require('./Features/Documents/DocumentController')
|
|
|
|
CompileManager = require("./Features/Compile/CompileManager")
|
|
|
|
CompileController = require("./Features/Compile/CompileController")
|
|
|
|
HealthCheckController = require("./Features/HealthCheck/HealthCheckController")
|
|
|
|
ProjectDownloadsController = require "./Features/Downloads/ProjectDownloadsController"
|
2014-02-20 17:33:12 -05:00
|
|
|
FileStoreController = require("./Features/FileStore/FileStoreController")
|
2014-03-05 11:31:52 -05:00
|
|
|
TrackChangesController = require("./Features/TrackChanges/TrackChangesController")
|
2014-04-07 16:49:22 -04:00
|
|
|
DropboxUserController = require("./Features/Dropbox/DropboxUserController")
|
2014-04-14 01:17:07 -04:00
|
|
|
RestoreController = require("./Features/Restore/RestoreController")
|
2014-05-15 11:20:23 -04:00
|
|
|
PasswordResetRouter = require("./Features/PasswordReset/PasswordResetRouter")
|
|
|
|
|
2014-02-12 05:23:40 -05:00
|
|
|
logger = require("logger-sharelatex")
|
2014-03-12 17:56:58 -04:00
|
|
|
_ = require("underscore")
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
httpAuth = require('express').basicAuth (user, pass)->
|
|
|
|
isValid = Settings.httpAuthUsers[user] == pass
|
|
|
|
if !isValid
|
|
|
|
logger.err user:user, pass:pass, "invalid login details"
|
|
|
|
return isValid
|
|
|
|
|
|
|
|
module.exports = class Router
|
|
|
|
constructor: (app, io, socketSessions)->
|
|
|
|
app.use(app.router)
|
|
|
|
|
|
|
|
app.get '/', HomeController.index
|
|
|
|
|
2014-04-09 07:22:57 -04:00
|
|
|
app.get '/login', UserPagesController.loginPage
|
2014-02-12 05:23:40 -05:00
|
|
|
app.post '/login', AuthenticationController.login
|
2014-04-10 12:29:46 -04:00
|
|
|
app.get '/logout', UserController.logout
|
2014-03-27 13:00:41 -04:00
|
|
|
app.get '/restricted', SecurityManager.restricted
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2014-04-03 06:43:04 -04:00
|
|
|
app.get '/resources', HomeController.externalPage("resources", "LaTeX Resources")
|
|
|
|
app.get '/tos', HomeController.externalPage("tos", "Terms of Service")
|
|
|
|
app.get '/about', HomeController.externalPage("about", "About Us")
|
|
|
|
app.get '/attribution', HomeController.externalPage("attribution", "Attribution")
|
|
|
|
app.get '/security', HomeController.externalPage("security", "Security")
|
|
|
|
app.get '/privacy_policy', HomeController.externalPage("privacy", "Privacy Policy")
|
|
|
|
app.get '/planned_maintenance', HomeController.externalPage("planned_mainteance", "Planned Maintenance")
|
|
|
|
|
2014-02-12 05:23:40 -05:00
|
|
|
app.get '/themes', InfoController.themes
|
|
|
|
app.get '/advisor', InfoController.advisor
|
|
|
|
app.get '/dropbox', InfoController.dropbox
|
|
|
|
|
2014-04-09 07:17:50 -04:00
|
|
|
app.get '/register', UserPagesController.registerPage
|
2014-04-10 12:29:46 -04:00
|
|
|
app.post '/register', UserController.register
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
SubscriptionRouter.apply(app)
|
|
|
|
UploadsRouter.apply(app)
|
2014-05-15 11:20:23 -04:00
|
|
|
PasswordResetRouter.apply(app)
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
if Settings.enableSubscriptions
|
|
|
|
app.get '/user/bonus', AuthenticationController.requireLogin(), ReferalMiddleware.getUserReferalId, ReferalController.bonus
|
|
|
|
|
2014-04-09 10:04:47 -04:00
|
|
|
app.get '/user/settings', AuthenticationController.requireLogin(), UserPagesController.settingsPage
|
2014-04-10 12:29:46 -04:00
|
|
|
app.post '/user/settings', AuthenticationController.requireLogin(), UserController.updateUserSettings
|
|
|
|
app.post '/user/password/update', AuthenticationController.requireLogin(), UserController.changePassword
|
2014-05-15 11:20:23 -04:00
|
|
|
|
2014-04-10 12:29:46 -04:00
|
|
|
app.del '/user/newsletter/unsubscribe', AuthenticationController.requireLogin(), UserController.unsubscribe
|
|
|
|
app.del '/user', AuthenticationController.requireLogin(), UserController.deleteUser
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2014-04-14 01:17:07 -04:00
|
|
|
app.get "/restore", AuthenticationController.requireLogin(), RestoreController.restore
|
|
|
|
app.get "/project/:Project_id/zip", SecurityManager.requestCanAccessProject, RestoreController.getZip
|
|
|
|
|
2014-04-07 16:49:22 -04:00
|
|
|
app.get '/dropbox/beginAuth', DropboxUserController.redirectUserToDropboxAuth
|
|
|
|
app.get '/dropbox/completeRegistration', DropboxUserController.completeDropboxRegistration
|
|
|
|
app.get '/dropbox/unlink', DropboxUserController.unlinkDropbox
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
app.get '/user/auth_token', AuthenticationController.requireLogin(), AuthenticationController.getAuthToken
|
2014-04-09 09:45:46 -04:00
|
|
|
app.get '/user/personal_info', AuthenticationController.requireLogin(allow_auth_token: true), UserInfoController.getLoggedInUsersPersonalInfo
|
|
|
|
app.get '/user/:user_id/personal_info', httpAuth, UserInfoController.getPersonalInfo
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2014-04-08 11:40:12 -04:00
|
|
|
app.get '/project', AuthenticationController.requireLogin(), ProjectController.projectListPage
|
|
|
|
app.post '/project/new', AuthenticationController.requireLogin(), ProjectController.newProject
|
2014-04-28 12:47:47 -04:00
|
|
|
|
2014-02-12 05:23:40 -05:00
|
|
|
app.get '/project/new/template', TemplatesMiddlewear.saveTemplateDataInSession, AuthenticationController.requireLogin(), TemplatesController.createProjectFromZipTemplate
|
|
|
|
|
2014-04-08 12:44:31 -04:00
|
|
|
app.get '/Project/:Project_id', SecurityManager.requestCanAccessProject, ProjectController.loadEditor
|
2014-03-27 13:00:41 -04:00
|
|
|
app.get '/Project/:Project_id/file/:File_id', SecurityManager.requestCanAccessProject, FileStoreController.getFile
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2014-03-27 13:00:41 -04:00
|
|
|
app.get '/Project/:Project_id/output/output.pdf', SecurityManager.requestCanAccessProject, CompileController.downloadPdf
|
2014-02-12 05:23:40 -05:00
|
|
|
app.get /^\/project\/([^\/]*)\/output\/(.*)$/,
|
|
|
|
((req, res, next) ->
|
|
|
|
params =
|
|
|
|
"Project_id": req.params[0]
|
|
|
|
"file": req.params[1]
|
|
|
|
req.params = params
|
|
|
|
next()
|
2014-03-27 13:00:41 -04:00
|
|
|
), SecurityManager.requestCanAccessProject, CompileController.getFileFromClsi
|
|
|
|
app.del "/project/:Project_id/output", SecurityManager.requestCanAccessProject, CompileController.deleteAuxFiles
|
2014-04-08 11:49:21 -04:00
|
|
|
app.get "/project/:Project_id/sync/code", SecurityManager.requestCanAccessProject, CompileController.proxySync
|
|
|
|
app.get "/project/:Project_id/sync/pdf", SecurityManager.requestCanAccessProject, CompileController.proxySync
|
|
|
|
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2014-04-08 09:34:03 -04:00
|
|
|
app.del '/Project/:Project_id', SecurityManager.requestIsOwner, ProjectController.deleteProject
|
2014-04-08 09:53:33 -04:00
|
|
|
app.post '/Project/:Project_id/clone', SecurityManager.requestCanAccessProject, ProjectController.cloneProject
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2014-04-28 12:47:47 -04:00
|
|
|
app.post '/project/:Project_id/rename', SecurityManager.requestIsOwner, ProjectController.renameProject
|
|
|
|
|
2014-03-27 13:00:41 -04:00
|
|
|
app.post '/Project/:Project_id/snapshot', SecurityManager.requestCanModifyProject, versioningController.takeSnapshot
|
|
|
|
app.get '/Project/:Project_id/version', SecurityManager.requestCanAccessProject, versioningController.listVersions
|
|
|
|
app.get '/Project/:Project_id/version/:Version_id', SecurityManager.requestCanAccessProject, versioningController.getVersion
|
|
|
|
app.get '/Project/:Project_id/version', SecurityManager.requestCanAccessProject, versioningController.listVersions
|
|
|
|
app.get '/Project/:Project_id/version/:Version_id', SecurityManager.requestCanAccessProject, versioningController.getVersion
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2014-03-27 13:00:41 -04:00
|
|
|
app.get "/project/:Project_id/updates", SecurityManager.requestCanAccessProject, TrackChangesController.proxyToTrackChangesApi
|
|
|
|
app.get "/project/:Project_id/doc/:doc_id/diff", SecurityManager.requestCanAccessProject, TrackChangesController.proxyToTrackChangesApi
|
|
|
|
app.post "/project/:Project_id/doc/:doc_id/version/:version_id/restore", SecurityManager.requestCanAccessProject, TrackChangesController.proxyToTrackChangesApi
|
2014-03-05 11:31:52 -05:00
|
|
|
|
2014-02-12 05:23:40 -05:00
|
|
|
app.post '/project/:project_id/leave', AuthenticationController.requireLogin(), CollaboratorsController.removeSelfFromProject
|
2014-03-27 13:00:41 -04:00
|
|
|
app.get '/project/:Project_id/collaborators', SecurityManager.requestCanAccessProject(allow_auth_token: true), CollaboratorsController.getCollaborators
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2014-03-27 13:00:41 -04:00
|
|
|
app.get '/Project/:Project_id/download/zip', SecurityManager.requestCanAccessProject, ProjectDownloadsController.downloadProject
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
|
|
|
|
app.get '/tag', AuthenticationController.requireLogin(), TagsController.getAllTags
|
|
|
|
app.post '/project/:project_id/tag', AuthenticationController.requireLogin(), TagsController.processTagsUpdate
|
|
|
|
|
|
|
|
app.get '/project/:project_id/details', httpAuth, ProjectApiController.getProjectDetails
|
|
|
|
|
|
|
|
app.get '/internal/project/:Project_id/zip', httpAuth, ProjectDownloadsController.downloadProject
|
|
|
|
app.get '/internal/project/:project_id/compile/pdf', httpAuth, CompileController.compileAndDownloadPdf
|
|
|
|
|
|
|
|
|
|
|
|
app.get '/project/:Project_id/doc/:doc_id', httpAuth, DocumentController.getDocument
|
|
|
|
app.post '/project/:Project_id/doc/:doc_id', httpAuth, DocumentController.setDocument
|
|
|
|
app.ignoreCsrf('post', '/project/:Project_id/doc/:doc_id')
|
|
|
|
|
2014-04-08 15:52:02 -04:00
|
|
|
app.post '/user/:user_id/update/*', httpAuth, TpdsController.mergeUpdate
|
2014-02-12 05:23:40 -05:00
|
|
|
app.del '/user/:user_id/update/*', httpAuth, TpdsController.deleteUpdate
|
|
|
|
app.ignoreCsrf('post', '/user/:user_id/update/*')
|
|
|
|
app.ignoreCsrf('delete', '/user/:user_id/update/*')
|
|
|
|
|
|
|
|
app.get '/enableversioning/:Project_id', (req, res)->
|
|
|
|
versioningController.enableVersioning req.params.Project_id, -> res.send()
|
|
|
|
|
|
|
|
app.get /^\/project\/([^\/]*)\/version\/([^\/]*)\/file\/(.*)$/,
|
|
|
|
((req, res, next) ->
|
|
|
|
params =
|
|
|
|
"Project_id": req.params[0]
|
|
|
|
"Version_id": req.params[1]
|
|
|
|
"File_id": req.params[2]
|
|
|
|
req.params = params
|
|
|
|
next()
|
|
|
|
),
|
2014-03-27 13:00:41 -04:00
|
|
|
SecurityManager.requestCanAccessProject, versioningController.getVersionFile
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
app.post "/spelling/check", AuthenticationController.requireLogin(), SpellingController.proxyRequestToSpellingApi
|
|
|
|
app.post "/spelling/learn", AuthenticationController.requireLogin(), SpellingController.proxyRequestToSpellingApi
|
|
|
|
|
|
|
|
#Admin Stuff
|
2014-03-27 13:00:41 -04:00
|
|
|
app.get '/admin', SecurityManager.requestIsAdmin, AdminController.index
|
|
|
|
app.post '/admin/closeEditor', SecurityManager.requestIsAdmin, AdminController.closeEditor
|
|
|
|
app.post '/admin/dissconectAllUsers', SecurityManager.requestIsAdmin, AdminController.dissconectAllUsers
|
|
|
|
app.post '/admin/writeAllDocsToMongo', SecurityManager.requestIsAdmin, AdminController.writeAllToMongo
|
|
|
|
app.post '/admin/addquote', SecurityManager.requestIsAdmin, AdminController.addQuote
|
|
|
|
app.post '/admin/syncUserToSubscription', SecurityManager.requestIsAdmin, AdminController.syncUserToSubscription
|
|
|
|
app.post '/admin/flushProjectToTpds', SecurityManager.requestIsAdmin, AdminController.flushProjectToTpds
|
|
|
|
app.post '/admin/pollUsersWithDropbox', SecurityManager.requestIsAdmin, AdminController.pollUsersWithDropbox
|
|
|
|
app.post '/admin/updateProjectCompiler', SecurityManager.requestIsAdmin, AdminController.updateProjectCompiler
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
app.get '/perfTest', (req,res)->
|
|
|
|
res.send("hello")
|
|
|
|
req.session.destroy()
|
|
|
|
|
|
|
|
app.get '/status', (req,res)->
|
|
|
|
res.send("websharelatex is up")
|
|
|
|
req.session.destroy()
|
|
|
|
|
|
|
|
app.get '/health_check', HealthCheckController.check
|
|
|
|
|
2014-03-27 13:00:41 -04:00
|
|
|
app.get "/status/compiler/:Project_id", SecurityManager.requestCanAccessProject, (req, res) ->
|
2014-03-12 17:56:58 -04:00
|
|
|
sendRes = _.once (statusCode, message)->
|
|
|
|
res.writeHead statusCode
|
|
|
|
res.end message
|
2014-02-12 05:23:40 -05:00
|
|
|
CompileManager.compile req.params.Project_id, "test-compile", {}, () ->
|
2014-03-12 17:56:58 -04:00
|
|
|
sendRes 200, "Compiler returned in less than 10 seconds"
|
2014-02-12 05:23:40 -05:00
|
|
|
setTimeout (() ->
|
2014-03-12 17:56:58 -04:00
|
|
|
sendRes 500, "Compiler timed out"
|
2014-02-12 05:23:40 -05:00
|
|
|
), 10000
|
|
|
|
req.session.destroy()
|
|
|
|
|
|
|
|
app.get '/test', (req, res) ->
|
|
|
|
res.render "tests",
|
2014-04-07 15:46:58 -04:00
|
|
|
privilegeLevel: "owner"
|
2014-02-12 05:23:40 -05:00
|
|
|
project:
|
|
|
|
name: "test"
|
|
|
|
date: Date.now()
|
|
|
|
layout: false
|
|
|
|
userCanSeeDropbox: true
|
|
|
|
languages: []
|
|
|
|
|
|
|
|
app.get '/oops-express', (req, res, next) -> next(new Error("Test error"))
|
|
|
|
app.get '/oops-internal', (req, res, next) -> throw new Error("Test error")
|
|
|
|
app.get '/oops-mongo', (req, res, next) ->
|
|
|
|
require("./models/Project").Project.findOne {}, () ->
|
|
|
|
throw new Error("Test error")
|
|
|
|
|
2014-03-14 07:14:02 -04:00
|
|
|
app.post '/error/client', (req, res, next) ->
|
|
|
|
logger.error err: req.body.error, meta: req.body.meta, "client side error"
|
|
|
|
res.send(204)
|
|
|
|
|
2014-02-12 05:23:40 -05:00
|
|
|
app.get '*', HomeController.notFound
|
|
|
|
|
|
|
|
|
|
|
|
socketSessions.on 'connection', (err, client, session)->
|
|
|
|
metrics.inc('socket-io.connection')
|
|
|
|
# This is not ideal - we should come up with a better way of handling
|
|
|
|
# anonymous users, but various logging lines rely on user._id
|
|
|
|
if !session or !session.user?
|
|
|
|
user = {_id: "anonymous-user"}
|
|
|
|
else
|
|
|
|
user = session.user
|
|
|
|
|
|
|
|
client.on 'joinProject', (data, callback) ->
|
|
|
|
EditorController.joinProject(client, user, data.project_id, callback)
|
|
|
|
|
|
|
|
client.on 'disconnect', () ->
|
|
|
|
metrics.inc ('socket-io.disconnect')
|
|
|
|
EditorController.leaveProject client, user
|
|
|
|
|
|
|
|
client.on 'reportError', (error, callback) ->
|
|
|
|
EditorController.reportError client, error, callback
|
|
|
|
|
|
|
|
client.on 'sendUpdate', (doc_id, windowName, change)->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
|
|
|
EditorUpdatesController.applyAceUpdate(client, project_id, doc_id, windowName, change)
|
|
|
|
|
|
|
|
client.on 'applyOtUpdate', (doc_id, update) ->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
|
|
|
EditorUpdatesController.applyOtUpdate(client, project_id, doc_id, update)
|
|
|
|
|
|
|
|
client.on 'clientTracking.updatePosition', (cursorData) ->
|
|
|
|
AuthorizationManager.ensureClientCanViewProject client, (error, project_id) =>
|
|
|
|
EditorController.updateClientPosition(client, cursorData)
|
|
|
|
|
|
|
|
client.on 'addUserToProject', (email, newPrivalageLevel, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanAdminProject client, (error, project_id) =>
|
|
|
|
EditorController.addUserToProject project_id, email, newPrivalageLevel, callback
|
|
|
|
|
|
|
|
client.on 'removeUserFromProject', (user_id, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanAdminProject client, (error, project_id) =>
|
|
|
|
EditorController.removeUserFromProject(project_id, user_id, callback)
|
|
|
|
|
|
|
|
client.on 'setSpellCheckLanguage', (compiler, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
|
|
|
EditorController.setSpellCheckLanguage project_id, compiler, callback
|
|
|
|
|
|
|
|
client.on 'setCompiler', (compiler, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
|
|
|
EditorController.setCompiler project_id, compiler, callback
|
|
|
|
|
|
|
|
client.on 'leaveDoc', (doc_id, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanViewProject client, (error, project_id) =>
|
|
|
|
EditorController.leaveDoc(client, project_id, doc_id, callback)
|
|
|
|
|
|
|
|
client.on 'joinDoc', (args...)->
|
|
|
|
AuthorizationManager.ensureClientCanViewProject client, (error, project_id) =>
|
|
|
|
EditorController.joinDoc(client, project_id, args...)
|
|
|
|
|
|
|
|
client.on 'addDoc', (folder_id, docName, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
|
|
|
EditorController.addDoc(project_id, folder_id, docName, [""], callback)
|
|
|
|
|
|
|
|
client.on 'addFolder', (folder_id, folderName, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
|
|
|
EditorController.addFolder(project_id, folder_id, folderName, callback)
|
|
|
|
|
|
|
|
client.on 'deleteEntity', (entity_id, entityType, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
|
|
|
EditorController.deleteEntity(project_id, entity_id, entityType, callback)
|
|
|
|
|
|
|
|
client.on 'renameEntity', (entity_id, entityType, newName, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
2014-04-04 11:35:02 -04:00
|
|
|
EditorController.renameEntity(project_id, entity_id, entityType, newName, callback)
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
client.on 'moveEntity', (entity_id, folder_id, entityType, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
2014-04-04 11:40:53 -04:00
|
|
|
EditorController.moveEntity(project_id, entity_id, folder_id, entityType, callback)
|
2014-02-12 05:23:40 -05:00
|
|
|
|
2014-04-07 10:37:40 -04:00
|
|
|
client.on 'setProjectName', (newName, callback)->
|
2014-02-12 05:23:40 -05:00
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
2014-04-07 10:37:40 -04:00
|
|
|
EditorController.renameProject(project_id, newName, callback)
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
client.on 'setRootDoc', (newRootDocID, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
2014-04-04 11:59:45 -04:00
|
|
|
EditorController.setRootDoc(project_id, newRootDocID, callback)
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
client.on 'deleteProject', (callback)->
|
|
|
|
AuthorizationManager.ensureClientCanAdminProject client, (error, project_id) =>
|
2014-04-04 11:21:20 -04:00
|
|
|
EditorController.deleteProject(project_id, callback)
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
client.on 'setPublicAccessLevel', (newAccessLevel, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanAdminProject client, (error, project_id) =>
|
2014-04-04 11:53:59 -04:00
|
|
|
EditorController.setPublicAccessLevel(project_id, newAccessLevel, callback)
|
2014-02-12 05:23:40 -05:00
|
|
|
|
|
|
|
client.on 'pdfProject', (opts, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanViewProject client, (error, project_id) =>
|
|
|
|
CompileManager.compile(project_id, user._id, opts, callback)
|
|
|
|
|
|
|
|
client.on 'enableversioningController', (callback)->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
|
|
|
versioningController.enableVersioning project_id, callback
|
|
|
|
|
|
|
|
client.on 'getRootDocumentsList', (callback)->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
|
|
|
EditorController.getListOfDocPaths project_id, callback
|
|
|
|
|
|
|
|
client.on 'forceResyncOfDropbox', (callback)->
|
|
|
|
AuthorizationManager.ensureClientCanAdminProject client, (error, project_id) =>
|
|
|
|
EditorController.forceResyncOfDropbox project_id, callback
|
|
|
|
|
|
|
|
client.on 'getUserDropboxLinkStatus', (owner_id, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanAdminProject client, (error, project_id) =>
|
|
|
|
dropboxHandler.getUserRegistrationStatus owner_id, callback
|
|
|
|
|
|
|
|
client.on 'publishProjectAsTemplate', (user_id, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanAdminProject client, (error, project_id) =>
|
|
|
|
TemplatesController.publishProject user_id, project_id, callback
|
|
|
|
|
|
|
|
client.on 'unPublishProjectAsTemplate', (user_id, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanAdminProject client, (error, project_id) =>
|
|
|
|
TemplatesController.unPublishProject user_id, project_id, callback
|
|
|
|
|
|
|
|
client.on 'updateProjectDescription', (description, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
|
|
|
EditorController.updateProjectDescription project_id, description, callback
|
|
|
|
|
|
|
|
client.on "getLastTimePollHappned", (callback)->
|
|
|
|
EditorController.getLastTimePollHappned(callback)
|
2014-02-27 12:35:35 -05:00
|
|
|
|
|
|
|
client.on "getPublishedDetails", (user_id, callback)->
|
|
|
|
AuthorizationManager.ensureClientCanViewProject client, (error, project_id) =>
|
|
|
|
TemplatesController.getTemplateDetails user_id, project_id, callback
|