Merge pull request #194 from tms/personal-space

Added restricted route to kick out trespassers on user routes
This commit is contained in:
Robin Ward 2013-02-19 08:08:18 -08:00
commit 8371ff058a
6 changed files with 15 additions and 4 deletions

View File

@ -34,6 +34,7 @@
//= require ./discourse/views/modal/modal_body_view
//= require ./discourse/models/model
//= require ./discourse/routes/discourse_route
//= require ./discourse/routes/discourse_restricted_user_route
//= require_tree ./discourse/controllers
//= require_tree ./discourse/components

View File

@ -0,0 +1,10 @@
window.Discourse.RestrictedUserRoute = Discourse.Route.extend
enter: (router, context) ->
user = @controllerFor('user').get('content')
@allowed = user.can_edit
redirect: ->
@transitionTo('user.activity') unless @allowed

View File

@ -1,4 +1,4 @@
window.Discourse.PreferencesEmailRoute = Discourse.Route.extend
window.Discourse.PreferencesEmailRoute = Discourse.RestrictedUserRoute.extend
renderTemplate: ->
@render into: 'user', outlet: 'userOutlet'
setupController: (controller) ->

View File

@ -1,4 +1,4 @@
window.Discourse.PreferencesRoute = Discourse.Route.extend
window.Discourse.PreferencesRoute = Discourse.RestrictedUserRoute.extend
renderTemplate: ->
@render 'preferences', into: 'user', outlet: 'userOutlet', controller: 'preferences'

View File

@ -1,4 +1,4 @@
window.Discourse.PreferencesUsernameRoute = Discourse.Route.extend
window.Discourse.PreferencesUsernameRoute = Discourse.RestrictedUserRoute.extend
renderTemplate: ->
@render into: 'user', outlet: 'userOutlet'
setupController: (controller) ->

View File

@ -1,4 +1,4 @@
window.Discourse.UserPrivateMessagesRoute = Discourse.Route.extend
window.Discourse.UserPrivateMessagesRoute = Discourse.RestrictedUserRoute.extend
renderTemplate: ->
@render into: 'user', outlet: 'userOutlet'
setupController: (controller, user) ->