Commit c1de46db authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix project pages for authorized user

parent 4e7b47dd
......@@ -52,4 +52,8 @@ $nprogress-color: #9BC;
body {
padding-top: 0 !important;
a {
color: #3084bb;
}
}
......@@ -8,7 +8,6 @@ module Ci
rescue_from Ci::Network::UnauthorizedError, with: :invalid_token
before_filter :default_headers
#before_filter :check_config
helper_method :gl_project
protect_from_forgery
......@@ -38,7 +37,7 @@ module Ci
end
def authorize_manage_builds!
unless can?(current_user, :manage_builds, gl_project)
unless can?(current_user, :admin_project, gl_project)
return page_404
end
end
......@@ -48,7 +47,7 @@ module Ci
end
def authorize_manage_project!
unless can?(current_user, :manage_project, gl_project)
unless can?(current_user, :admin_project, gl_project)
return page_404
end
end
......
......@@ -10,7 +10,9 @@ module Ci
def index
@runners = @project.runners.order('id DESC')
@specific_runners = current_user.authorized_runners.
@specific_runners =
Ci::Runner.specific.includes(:runner_projects).
where(Ci::RunnerProject.table_name => { project_id: current_user.authorized_projects } ).
where.not(id: @runners).order("#{Ci::Runner.table_name}.id DESC").page(params[:page]).per(20)
@shared_runners = Ci::Runner.shared.active
@shared_runners_count = @shared_runners.count(:all)
......
......@@ -2,7 +2,7 @@
= link_to ci_project_path(@project)
@
= @commit.short_sha
%p
= link_to ci_project_ref_commits_path(@project, @commit.ref, @commit.sha) do
← Back to project commit
......@@ -104,7 +104,7 @@
#{time_ago_in_words(@build.finished_at)} ago
%p
%span.attr-name Runner:
- if @build.runner && current_user && current_user.is_admin
- if @build.runner && current_user && current_user.admin
\#{link_to "##{@build.runner.id}", ci_admin_runner_path(@build.runner.id)}
- elsif @build.runner
\##{@build.runner.id}
......
......@@ -17,7 +17,7 @@
%hr
.container.container-body
.content
- if current_user && can?(current_user, :manage_project, gl_project)
- if current_user && can?(current_user, :admin_project, gl_project)
.row
.col-md-2.append-bottom-20
= render 'layouts/ci/nav_project'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment