2016-04-07 12:40:53 -04:00
|
|
|
LevelSystem = require './../models/LevelSystem'
|
|
|
|
Handler = require '../commons/Handler'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
LevelSystemHandler = class LevelSystemHandler extends Handler
|
|
|
|
modelClass: LevelSystem
|
|
|
|
editableProperties: [
|
|
|
|
'description'
|
|
|
|
'code'
|
|
|
|
'js'
|
2014-06-09 06:26:47 -04:00
|
|
|
'codeLanguage'
|
2014-01-03 13:32:13 -05:00
|
|
|
'dependencies'
|
|
|
|
'propertyDocumentation'
|
|
|
|
'configSchema'
|
|
|
|
]
|
|
|
|
postEditableProperties: ['name']
|
2016-04-07 12:40:53 -04:00
|
|
|
jsonSchema: require '../../app/schemas/models/level_system'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
getEditableProperties: (req, document) ->
|
|
|
|
props = super(req, document)
|
|
|
|
props.push('official') if req.user?.isAdmin()
|
|
|
|
props
|
|
|
|
|
|
|
|
hasAccess: (req) ->
|
2015-02-25 21:41:39 -05:00
|
|
|
req.method is 'GET' or req.user?.isAdmin() or req.user?.isArtisan()
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2015-06-14 15:49:45 -04:00
|
|
|
hasAccessToDocument: (req, document, method) ->
|
|
|
|
if req.user?.isArtisan() then true else super req, document, method
|
|
|
|
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
module.exports = new LevelSystemHandler()
|