User now set to admin at signup instead of login

This commit is contained in:
IngridMorstrad 2014-03-16 21:56:29 +05:30
parent 8d9a8aaf73
commit 37e3cd65da

View file

@ -16,13 +16,13 @@ UserSchema.pre('init', (next) ->
return next() unless jsonschema.properties?
for prop, sch of jsonschema.properties
@set(prop, sch.default) if sch.default?
@set('permissions', ['admin']) if not isProduction
next()
)
UserSchema.post('init', ->
@set('anonymous', false) if @get('email')
@currentSubscriptions = JSON.stringify(@get('emailSubscriptions'))
@set('permissions', ['admin']) if not isProduction
)
UserSchema.methods.isAdmin = ->