Merge pull request #392 from taigaio/redirecting-when-no-access-to-section
Redirecting the user when trying to access to a section not enabledstable
commit
36ca7657ee
|
@ -67,6 +67,9 @@ class MembershipsController extends mixOf(taiga.Controller, taiga.PageMixin, tai
|
|||
|
||||
loadProject: ->
|
||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||
if not project.i_am_owner
|
||||
@location.path(@navUrls.resolve("permission-denied"))
|
||||
|
||||
@scope.project = project
|
||||
@scope.$emit('project:loaded', project)
|
||||
return project
|
||||
|
|
|
@ -65,6 +65,9 @@ class ProjectProfileController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
|
||||
loadProject: ->
|
||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||
if not project.i_am_owner
|
||||
@location.path(@navUrls.resolve("permission-denied"))
|
||||
|
||||
@scope.project = project
|
||||
@scope.pointsList = _.sortBy(project.points, "order")
|
||||
@scope.usStatusList = _.sortBy(project.us_statuses, "order")
|
||||
|
|
|
@ -61,6 +61,9 @@ class ProjectValuesSectionController extends mixOf(taiga.Controller, taiga.PageM
|
|||
|
||||
loadProject: ->
|
||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||
if not project.i_am_owner
|
||||
@location.path(@navUrls.resolve("permission-denied"))
|
||||
|
||||
@scope.project = project
|
||||
@scope.$emit('project:loaded', project)
|
||||
return project
|
||||
|
|
|
@ -63,6 +63,9 @@ class RolesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fil
|
|||
|
||||
loadProject: ->
|
||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||
if not project.i_am_owner
|
||||
@location.path(@navUrls.resolve("permission-denied"))
|
||||
|
||||
@scope.project = project
|
||||
|
||||
@scope.$emit('project:loaded', project)
|
||||
|
|
|
@ -38,10 +38,12 @@ class WebhooksController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.
|
|||
"$tgRepo",
|
||||
"$tgResources",
|
||||
"$routeParams",
|
||||
"$tgLocation",
|
||||
"$tgNavUrls",
|
||||
"$appTitle"
|
||||
]
|
||||
|
||||
constructor: (@scope, @repo, @rs, @params, @appTitle) ->
|
||||
constructor: (@scope, @repo, @rs, @params, @location, @navUrls, @appTitle) ->
|
||||
bindMethods(@)
|
||||
|
||||
@scope.sectionName = "Webhooks" #i18n
|
||||
|
@ -62,6 +64,9 @@ class WebhooksController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.
|
|||
|
||||
loadProject: ->
|
||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||
if not project.i_am_owner
|
||||
@location.path(@navUrls.resolve("permission-denied"))
|
||||
|
||||
@scope.project = project
|
||||
@scope.$emit('project:loaded', project)
|
||||
return project
|
||||
|
|
|
@ -225,6 +225,9 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
|||
|
||||
loadProject: ->
|
||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||
if not project.is_backlog_activated
|
||||
@location.path(@navUrls.resolve("permission-denied"))
|
||||
|
||||
@scope.projectId = project.id
|
||||
@scope.project = project
|
||||
@scope.totalClosedMilestones = project.total_closed_milestones
|
||||
|
|
|
@ -94,6 +94,9 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
|||
|
||||
loadProject: ->
|
||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||
if not project.is_issues_activated
|
||||
@location.path(@navUrls.resolve("permission-denied"))
|
||||
|
||||
@scope.projectId = project.id
|
||||
@scope.project = project
|
||||
@scope.$emit('project:loaded', project)
|
||||
|
|
|
@ -183,6 +183,9 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
|||
|
||||
loadProject: ->
|
||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||
if not project.is_kanban_activated
|
||||
@location.path(@navUrls.resolve("permission-denied"))
|
||||
|
||||
@scope.projectId = project.id
|
||||
@scope.project = project
|
||||
@scope.projectId = project.id
|
||||
|
|
|
@ -104,6 +104,9 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
|
||||
loadProject: ->
|
||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||
if not project.is_backlog_activated
|
||||
@location.path(@navUrls.resolve("permission-denied"))
|
||||
|
||||
@scope.project = project
|
||||
# Not used at this momment
|
||||
@scope.pointsList = _.sortBy(project.points, "order")
|
||||
|
|
|
@ -70,6 +70,9 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
|
||||
loadProject: ->
|
||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||
if not project.is_wiki_activated
|
||||
@location.path(@navUrls.resolve("permission-denied"))
|
||||
|
||||
@scope.projectId = project.id
|
||||
@scope.project = project
|
||||
@scope.$emit('project:loaded', project)
|
||||
|
|
Loading…
Reference in New Issue