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; ...@@ -52,4 +52,8 @@ $nprogress-color: #9BC;
body { body {
padding-top: 0 !important; padding-top: 0 !important;
a {
color: #3084bb;
}
} }
...@@ -8,7 +8,6 @@ module Ci ...@@ -8,7 +8,6 @@ module Ci
rescue_from Ci::Network::UnauthorizedError, with: :invalid_token rescue_from Ci::Network::UnauthorizedError, with: :invalid_token
before_filter :default_headers before_filter :default_headers
#before_filter :check_config
helper_method :gl_project helper_method :gl_project
protect_from_forgery protect_from_forgery
...@@ -38,7 +37,7 @@ module Ci ...@@ -38,7 +37,7 @@ module Ci
end end
def authorize_manage_builds! def authorize_manage_builds!
unless can?(current_user, :manage_builds, gl_project) unless can?(current_user, :admin_project, gl_project)
return page_404 return page_404
end end
end end
...@@ -48,7 +47,7 @@ module Ci ...@@ -48,7 +47,7 @@ module Ci
end end
def authorize_manage_project! def authorize_manage_project!
unless can?(current_user, :manage_project, gl_project) unless can?(current_user, :admin_project, gl_project)
return page_404 return page_404
end end
end end
......
...@@ -10,7 +10,9 @@ module Ci ...@@ -10,7 +10,9 @@ module Ci
def index def index
@runners = @project.runners.order('id DESC') @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) where.not(id: @runners).order("#{Ci::Runner.table_name}.id DESC").page(params[:page]).per(20)
@shared_runners = Ci::Runner.shared.active @shared_runners = Ci::Runner.shared.active
@shared_runners_count = @shared_runners.count(:all) @shared_runners_count = @shared_runners.count(:all)
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
#{time_ago_in_words(@build.finished_at)} ago #{time_ago_in_words(@build.finished_at)} ago
%p %p
%span.attr-name Runner: %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)} \#{link_to "##{@build.runner.id}", ci_admin_runner_path(@build.runner.id)}
- elsif @build.runner - elsif @build.runner
\##{@build.runner.id} \##{@build.runner.id}
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
%hr %hr
.container.container-body .container.container-body
.content .content
- if current_user && can?(current_user, :manage_project, gl_project) - if current_user && can?(current_user, :admin_project, gl_project)
.row .row
.col-md-2.append-bottom-20 .col-md-2.append-bottom-20
= render 'layouts/ci/nav_project' = 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