diff --git a/app/controllers/mass_builds_controller.rb b/app/controllers/mass_builds_controller.rb index 8f2ec3770..10a59a6cc 100644 --- a/app/controllers/mass_builds_controller.rb +++ b/app/controllers/mass_builds_controller.rb @@ -25,7 +25,7 @@ class MassBuildsController < ApplicationController @mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(:page => params[:page], :per_page => 20) flash[:warning] = mass_build.errors.full_messages.join('. ') flash[:error] = t("flash.platform.build_all_error") - render :action => :index + render :index end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 252bdc476..0dfd99a08 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -84,8 +84,6 @@ class Ability can([:read, :related, :members], Platform, read_relations_for('platforms')) {|platform| local_reader? platform} can([:update, :members], Platform) {|platform| local_admin? platform} can([:destroy, :members, :add_member, :remove_member, :remove_members] , Platform) {|platform| owner?(platform) || local_admin?(platform) } - can([:failed_builds_list, :create], MassBuild) {|mass_build| owner?(mass_build.platform) || local_admin?(mass_build.platform) } - can(:cancel, MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && !mass_build.stop_build } can [:autocomplete_user_uname, :read_advisories, :advisories], Platform can [:read, :projects_list], Repository, :platform => {:visibility => 'open'} @@ -130,8 +128,8 @@ class Ability cannot [:create, :update, :destroy, :clone], Product, :platform => {:platform_type => 'personal'} cannot [:clone], Platform, :platform_type => 'personal' - cannot([:failed_builds_list, :create], MassBuild) {|mass_build| mass_build.platform.platform_type == 'personal'} - cannot(:cancel, MassBuild) { |mass_build| mass_build.platform.platform_type == 'personal' && mass_build.stop_build } + can([:failed_builds_list, :create], MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && (mass_build.platform.platform_type == 'main') } + can(:cancel, MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && !mass_build.stop_build && (mass_build.platform.platform_type == 'main')} can :create, Subscribe do |subscribe| !subscribe.subscribeable.subscribes.exists?(:user_id => user.id) diff --git a/app/models/build_list.rb b/app/models/build_list.rb index a02638635..d5f1db10b 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -220,7 +220,7 @@ class BuildList < ActiveRecord::Base end def self.status_by_human(human) - BuildList::HUMAN_STATUSES.each { |k,v| return k if v == human } + BuildList::HUMAN_STATUSES.key human end def set_items(items_hash)