[refs #442] Ability rights refactor. status_by_human refactor
This commit is contained in:
parent
6afe8c0375
commit
4eac2a232f
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue