2015-12-16 20:09:22 -05:00
|
|
|
# TODO: Remove once mapping.coffee is refactored out
|
|
|
|
|
2014-06-30 22:16:26 -04:00
|
|
|
Article = require './Article'
|
|
|
|
Handler = require '../commons/Handler'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
ArticleHandler = class ArticleHandler extends Handler
|
|
|
|
modelClass: Article
|
2015-12-16 20:09:22 -05:00
|
|
|
editableProperties: Article.schema.editableProperties
|
|
|
|
jsonSchema: Article.schema.jsonSchema
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
hasAccess: (req) ->
|
2015-03-16 16:54:20 -04:00
|
|
|
req.method is 'GET' or req.user?.isAdmin() or req.user?.isArtisan()
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-04-08 22:26:19 -04:00
|
|
|
hasAccessToDocument: (req, document, method=null) ->
|
2015-02-25 21:41:39 -05:00
|
|
|
return true if req.method is 'GET' or method is 'get' or req.user?.isAdmin() or req.user?.isArtisan()
|
2014-04-08 22:26:19 -04:00
|
|
|
return false
|
|
|
|
|
2014-01-03 13:32:13 -05:00
|
|
|
module.exports = new ArticleHandler()
|