#211: updated ability.rb, refactoring of BuildList model
This commit is contained in:
parent
5652f2b6d3
commit
61509312a0
|
@ -82,7 +82,7 @@ class Ability
|
|||
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
|
||||
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
|
||||
can([:read, :log, :everything], BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
|
||||
can(:create, BuildList) {|build_list| build_list.project.is_package && can?(:write, build_list.project)}
|
||||
can(:create, BuildList) {|build_list| build_list.project.is_package && can?(:write, build_list.project) && can?(:read, build_list.build_for_platform) }
|
||||
|
||||
can(:publish, BuildList) do |build_list|
|
||||
if build_list.build_published?
|
||||
|
|
|
@ -35,7 +35,7 @@ class BuildList < ActiveRecord::Base
|
|||
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_build_for_platform')) unless build_for_platform.main?
|
||||
}
|
||||
validate lambda {
|
||||
errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_repository')) unless save_to_repository_id.in? save_to_platform.repositories.map(&:id)
|
||||
errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_repository')) unless save_to_repository_id.in? save_to_platform.repositories.pluck(:id)
|
||||
}
|
||||
validate lambda {
|
||||
include_repos.each {|ir|
|
||||
|
|
Loading…
Reference in New Issue