codecombat/server/levels/components/level_component_handler.coffee
Ruben Vereecken 8e33b6b534 Fixed all server-sided tests
NEVER. AGAIN
2014-06-11 20:17:27 +02:00

28 lines
684 B
CoffeeScript

LevelComponent = require('./LevelComponent')
Handler = require('../../commons/Handler')
LevelComponentHandler = class LevelComponentHandler extends Handler
modelClass: LevelComponent
jsonSchema: require '../../../app/schemas/models/level_component'
editableProperties: [
'system'
'description'
'code'
'js'
'codeLanguage'
'dependencies'
'propertyDocumentation'
'configSchema'
'name'
]
getEditableProperties: (req, document) ->
props = super(req, document)
props.push('official') if req.user?.isAdmin()
props
hasAccess: (req) ->
req.method is 'GET' or req.user?.isAdmin()
module.exports = new LevelComponentHandler()