#465: Cleanup
This commit is contained in:
parent
07ae486d5b
commit
04b5b77f7c
|
@ -294,8 +294,9 @@ module BuildListsHelper
|
|||
end
|
||||
|
||||
def default_extra_repos(project)
|
||||
project.repositories.joins(:platform).accessible_by(current_ability, :read)
|
||||
.where(platforms: { platform_type: 'personal' }).map do |extra|
|
||||
scope = project.repositories.joins(:platform).where(platforms: { platform_type: 'personal' })
|
||||
scope = PlatformPolicy::Scope.new(current_user, scope).show
|
||||
scope.map do |extra|
|
||||
{
|
||||
id: extra.id,
|
||||
platform_id: extra.platform.id,
|
||||
|
|
|
@ -724,10 +724,6 @@ class BuildList < ActiveRecord::Base
|
|||
save
|
||||
end
|
||||
|
||||
# def current_ability
|
||||
# @current_ability ||= Ability.new(user)
|
||||
# end
|
||||
|
||||
def prepare_extra_repositories
|
||||
if save_to_platform && save_to_platform.main?
|
||||
self.extra_repositories = nil
|
||||
|
|
|
@ -19,9 +19,7 @@ class Search < Struct.new(:query, :user, :paginate_params)
|
|||
User.opened
|
||||
else
|
||||
klass = type.classify.constantize
|
||||
# scope_policy(type.classify.constantize).accessible_by(ability, :show)
|
||||
"#{klass}Policy::Scope".classify.constantize.new(user, klass).show
|
||||
# policy_scope(type.classify.constantize).show
|
||||
"#{klass}Policy::Scope".constantize.new(user, klass).show
|
||||
end
|
||||
scope.search(query).
|
||||
search_order.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
.row.offset10 ng-controller = 'BuildListsController' ng-init = 'init()' ng-cloak = true
|
||||
= hidden_field_tag :name_with_owner, @project.try(:name_with_owner)
|
||||
.col-lg-2.col-sm-12
|
||||
-if @project and can?(:create, @project.build_lists.build)
|
||||
-if @project && policy(@project.build_lists.build).create?
|
||||
|
||||
button.btn.btn-primary.btn-block[ id = 'filter_new_build'
|
||||
type = 'button'
|
||||
|
|
|
@ -12,7 +12,7 @@ module Grack
|
|||
|
||||
return ::Rack::Auth::Basic.new(@app) do |u, p|
|
||||
user = User.auth_by_token_or_login_pass(u, p) and
|
||||
ability = ::Ability.new(user) and ability.can?(action, project) and
|
||||
ability = ProjectPolicy.new(user, project).send("#{action}?") and
|
||||
ENV['GL_ID'] = "user-#{user.id}" and
|
||||
ENV['GL_REPO_NAME'] = project.path
|
||||
end.call(env) unless project.public? && read? # need auth
|
||||
|
|
Loading…
Reference in New Issue