mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-20 20:42:44 -05:00
29 lines
689 B
CoffeeScript
29 lines
689 B
CoffeeScript
|
winston = require('winston')
|
||
|
request = require('request')
|
||
|
LevelComponent = require('../models/LevelComponent')
|
||
|
Handler = require('./Handler')
|
||
|
|
||
|
LevelComponentHandler = class LevelComponentHandler extends Handler
|
||
|
modelClass: LevelComponent
|
||
|
editableProperties: [
|
||
|
'system'
|
||
|
'description'
|
||
|
'code'
|
||
|
'js'
|
||
|
'language'
|
||
|
'dependencies'
|
||
|
'propertyDocumentation'
|
||
|
'configSchema'
|
||
|
]
|
||
|
postEditableProperties: ['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()
|