Merge pull request #194 from tms/personal-space
Added restricted route to kick out trespassers on user routes
This commit is contained in:
commit
8371ff058a
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
window.Discourse.PreferencesEmailRoute = Discourse.Route.extend
|
||||
window.Discourse.PreferencesEmailRoute = Discourse.RestrictedUserRoute.extend
|
||||
renderTemplate: ->
|
||||
@render into: 'user', outlet: 'userOutlet'
|
||||
setupController: (controller) ->
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
window.Discourse.PreferencesUsernameRoute = Discourse.Route.extend
|
||||
window.Discourse.PreferencesUsernameRoute = Discourse.RestrictedUserRoute.extend
|
||||
renderTemplate: ->
|
||||
@render into: 'user', outlet: 'userOutlet'
|
||||
setupController: (controller) ->
|
||||
|
|
|
@ -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) ->
|
||||
|
|
Loading…
Reference in New Issue