[refs #631] Fix right for publication build list using publish button

This commit is contained in:
Vladimir Sharshov 2012-09-07 22:45:03 +04:00
parent 8652cf3612
commit 8c06b0c18d
3 changed files with 6 additions and 5 deletions

View File

@ -73,10 +73,10 @@ class Ability
can([:create, :update], BuildList) {|build_list| build_list.project.is_package && can?(:write, build_list.project)}
can(:publish, BuildList) do |build_list|
build_list.can_publish? and build_list.save_to_platform.released ? local_admin?(build_list.save_to_platform) : can?(:write, build_list.project)
build_list.can_publish? and build_list.save_to_repository.publish_without_qa ? can?(:write, build_list.project) : local_admin?(build_list.save_to_platform)
end
can(:reject_publish, BuildList) do |build_list|
build_list.can_reject_publish? and build_list.save_to_platform.released and local_admin?(build_list.save_to_platform)
build_list.can_reject_publish? and not build_list.save_to_repository.publish_without_qa and local_admin?(build_list.save_to_platform)
end
can(:cancel, BuildList) {|build_list| build_list.can_cancel? && can?(:write, build_list.project)}

View File

@ -224,7 +224,7 @@ class BuildList < ActiveRecord::Base
end
def can_reject_publish?
can_publish? and save_to_platform.released
can_publish? and not save_to_repository.publish_without_qa
end

View File

@ -128,10 +128,11 @@
= render :partial => 'projects/build_lists/log'
- if (can_publish = @build_list.can_publish? && can?(:publish, @build_list)) || (can_reject = @build_list.can_reject_publish? && can?(:reject_publish, @build_list))
- if (can_publish = @build_list.can_publish? && can?(:publish, @build_list))
.hr
= submit_tag t("layout.publish"), :confirm => t("layout.confirm"), :name => 'publish' if can_publish
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish' if can_reject
- if @build_list.can_reject_publish? && can?(:reject_publish, @build_list)
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish'
.hr
%h3= t("layout.build_lists.items_header")