Fix project pages for authorized user

This commit is contained in:
Dmitriy Zaporozhets 2015-09-10 17:14:55 +02:00
parent 4e7b47dde1
commit c1de46dbc7
5 changed files with 12 additions and 7 deletions

View file

@ -52,4 +52,8 @@ $nprogress-color: #9BC;
body {
padding-top: 0 !important;
a {
color: #3084bb;
}
}

View file

@ -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

View file

@ -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)

View file

@ -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}

View file

@ -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'