From 944626d59ae833747df0f3618a82a0ff71920a9f Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Mon, 14 May 2012 16:51:08 +0600 Subject: [PATCH] [refs #455] add ability for build lists --- app/models/ability.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index d1fe8928d..0a11e7b7f 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -64,7 +64,8 @@ class Ability can [:read, :related], BuildList, :project => {:owner_type => 'User', :owner_id => user.id} can [:read, :related], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids} can(:read, BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project} - can(:create, BuildList) {|build_list| build_list.project.is_rpm && can?(:write, build_list.project)} + can([:create, :update], BuildList) {|build_list| build_list.project.is_rpm && 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) end