codecombat/server/levels/components/level_component_handler.coffee

29 lines
691 B
CoffeeScript
Raw Normal View History

2014-06-30 22:16:26 -04:00
LevelComponent = require './LevelComponent'
Handler = require '../../commons/Handler'
2014-01-03 13:32:13 -05:00
LevelComponentHandler = class LevelComponentHandler extends Handler
modelClass: LevelComponent
jsonSchema: require '../../../app/schemas/models/level_component'
2014-01-03 13:32:13 -05:00
editableProperties: [
'system'
'description'
'code'
'js'
'codeLanguage'
2014-01-03 13:32:13 -05:00
'dependencies'
'propertyDocumentation'
'configSchema'
2014-02-05 14:03:32 -05:00
'name'
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) ->
req.method in ['GET', 'PUT'] or req.user?.isAdmin()
2014-01-03 13:32:13 -05:00
module.exports = new LevelComponentHandler()