mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
Can now set admin permissions on the dev environment.
This commit is contained in:
parent
7ff15630fc
commit
594b54a40e
3 changed files with 21 additions and 5 deletions
|
@ -34,6 +34,12 @@ block content
|
|||
label.control-label(for="email", data-i18n="forms.email") Email
|
||||
.controls
|
||||
input#email.input-large(name="email", type="text", value="#{me.get('email')}")
|
||||
if !isProduction
|
||||
.control-group
|
||||
label.control-label(for="email", data-i18n="forms.admin") Admin
|
||||
.controls
|
||||
input#admin.input-large(name="admin", type="checkbox", checked=me.get('permissions').indexOf('admin')>-1))
|
||||
|
||||
|
||||
#picture-pane.tab-pane
|
||||
h3(data-i18n="account_settings.gravatar_select") Select which Gravatar photo to use
|
||||
|
|
|
@ -5,13 +5,13 @@ forms = require('lib/forms')
|
|||
User = require('models/User')
|
||||
|
||||
module.exports = class SettingsView extends View
|
||||
id: "account-settings-view"
|
||||
id: 'account-settings-view'
|
||||
template: template
|
||||
|
||||
events:
|
||||
"click #save-button": "save"
|
||||
"change #settings-panes input": "save"
|
||||
"change input[type='range']": "updateWizardColor"
|
||||
'click #save-button': 'save'
|
||||
'change #settings-panes input': 'save'
|
||||
'change input[type="range"]': 'updateWizardColor'
|
||||
'click #toggle-all-button': 'toggleEmailSubscriptions'
|
||||
|
||||
constructor: (options) ->
|
||||
|
@ -54,7 +54,6 @@ module.exports = class SettingsView extends View
|
|||
$('.tab-pane').removeClass('active')
|
||||
pane.addClass('active')
|
||||
@currentTab = category
|
||||
console.log "chooseTab", category
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
|
@ -128,3 +127,9 @@ module.exports = class SettingsView extends View
|
|||
me.set('email', $('#email', @$el).val())
|
||||
me.set('wizardColor1', @getWizardColor())
|
||||
me.set('emailSubscriptions', @getSubscriptions())
|
||||
|
||||
adminCheckbox = @$el.find('#admin')
|
||||
if adminCheckbox.length
|
||||
permissions = []
|
||||
permissions.push 'admin' if adminCheckbox.prop('checked')
|
||||
me.set('permissions', permissions)
|
||||
|
|
|
@ -6,6 +6,7 @@ User = require('../models/User')
|
|||
Handler = require('./Handler')
|
||||
languages = require '../languages'
|
||||
mongoose = require 'mongoose'
|
||||
config = require '../../server_config'
|
||||
|
||||
serverProperties = ['passwordHash', 'emailLower', 'nameLower', 'passwordReset']
|
||||
privateProperties = ['permissions', 'email', 'firstName', 'lastName', 'gender', 'facebookID', 'music', 'volume']
|
||||
|
@ -20,6 +21,10 @@ UserHandler = class UserHandler extends Handler
|
|||
]
|
||||
|
||||
jsonSchema: schema
|
||||
|
||||
constructor: ->
|
||||
super(arguments...)
|
||||
@editableProperties.push('permissions') unless config.isProduction
|
||||
|
||||
formatEntity: (req, document) ->
|
||||
return null unless document?
|
||||
|
|
Loading…
Reference in a new issue