mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
30 lines
824 B
CoffeeScript
30 lines
824 B
CoffeeScript
LevelSystem = require './../models/LevelSystem'
|
|
Handler = require '../commons/Handler'
|
|
|
|
LevelSystemHandler = class LevelSystemHandler extends Handler
|
|
modelClass: LevelSystem
|
|
editableProperties: [
|
|
'description'
|
|
'code'
|
|
'js'
|
|
'codeLanguage'
|
|
'dependencies'
|
|
'propertyDocumentation'
|
|
'configSchema'
|
|
]
|
|
postEditableProperties: ['name']
|
|
jsonSchema: require '../../app/schemas/models/level_system'
|
|
|
|
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() or req.user?.isArtisan()
|
|
|
|
hasAccessToDocument: (req, document, method) ->
|
|
if req.user?.isArtisan() then true else super req, document, method
|
|
|
|
|
|
module.exports = new LevelSystemHandler()
|