[refs #441] Merge master into 441-key_pairs
This commit is contained in:
commit
f7f848e878
|
@ -17,7 +17,7 @@ class Ability
|
||||||
can :archive, Project, :visibility => 'open'
|
can :archive, Project, :visibility => 'open'
|
||||||
can :read, Issue, :project => {:visibility => 'open'}
|
can :read, Issue, :project => {:visibility => 'open'}
|
||||||
can :search, BuildList
|
can :search, BuildList
|
||||||
can :read, BuildList, :project => {:visibility => 'open'}
|
can [:read, :everything], BuildList, :project => {:visibility => 'open'}
|
||||||
can :read, ProductBuildList#, :product => {:platform => {:visibility => 'open'}} # double nested hash don't work
|
can :read, ProductBuildList#, :product => {:platform => {:visibility => 'open'}} # double nested hash don't work
|
||||||
can :read, Advisory
|
can :read, Advisory
|
||||||
can(:advisories, Platform) {APP_CONFIG['anonymous_access']}
|
can(:advisories, Platform) {APP_CONFIG['anonymous_access']}
|
||||||
|
@ -62,10 +62,10 @@ class Ability
|
||||||
can(:destroy, Project) {|project| project.owner_type == 'Group' and project.owner.actors.exists?(:actor_type => 'User', :actor_id => user.id, :role => 'admin')}
|
can(:destroy, Project) {|project| project.owner_type == 'Group' and project.owner.actors.exists?(:actor_type => 'User', :actor_id => user.id, :role => 'admin')}
|
||||||
can :remove_user, Project
|
can :remove_user, Project
|
||||||
|
|
||||||
can [:read, :owned], BuildList, :user_id => user.id
|
can [:read, :owned, :everything], BuildList, :user_id => user.id
|
||||||
can [:read, :related], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
|
can [:read, :related, :everything], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
|
||||||
can [:read, :related], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
|
can [:read, :related, :everything], 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([:read, :everything], BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
|
||||||
can([:create, :update], BuildList) {|build_list| build_list.project.is_package && can?(:write, build_list.project)}
|
can([:create, :update], BuildList) {|build_list| build_list.project.is_package && can?(:write, build_list.project)}
|
||||||
|
|
||||||
can(:publish, BuildList) do |build_list|
|
can(:publish, BuildList) do |build_list|
|
||||||
|
|
|
@ -106,14 +106,16 @@ class BuildList < ActiveRecord::Base
|
||||||
|
|
||||||
# WTF? around_transition -> infinite loop
|
# WTF? around_transition -> infinite loop
|
||||||
before_transition do |build_list, transition|
|
before_transition do |build_list, transition|
|
||||||
if build_list.mass_build && MassBuild::COUNT_STATUSES.include?(build_list.status)
|
status = BuildList::HUMAN_STATUSES[build_list.status]
|
||||||
MassBuild.decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
|
if build_list.mass_build && MassBuild::COUNT_STATUSES.include?(status)
|
||||||
|
MassBuild.decrement_counter "#{status.to_s}_count", build_list.mass_build_id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
after_transition do |build_list, transition|
|
after_transition do |build_list, transition|
|
||||||
if build_list.mass_build && MassBuild::COUNT_STATUSES.include?(build_list.status)
|
status = BuildList::HUMAN_STATUSES[build_list.status]
|
||||||
MassBuild.increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
|
if build_list.mass_build && MassBuild::COUNT_STATUSES.include?(status)
|
||||||
|
MassBuild.increment_counter "#{status.to_s}_count", build_list.mass_build_id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,10 @@ class BuildList::Filter
|
||||||
:mass_build_id => nil
|
:mass_build_id => nil
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@options[:ownership] = @options[:ownership].presence || (@project || !@user ? 'index' : 'owned')
|
@options[:ownership] = @options[:ownership].presence || (@project || !@user ? 'everything' : 'owned')
|
||||||
@options[:status] = @options[:status].try(:to_i)
|
@options[:status] = @options[:status].present? ? @options[:status].to_i : nil
|
||||||
|
@options[:created_at_start] = build_date_from_params(:created_at_start, @options)
|
||||||
|
@options[:created_at_end] = build_date_from_params(:created_at_end, @options)
|
||||||
@options[:updated_at_start] = build_date_from_params(:updated_at_start, @options)
|
@options[:updated_at_start] = build_date_from_params(:updated_at_start, @options)
|
||||||
@options[:updated_at_end] = build_date_from_params(:updated_at_end, @options)
|
@options[:updated_at_end] = build_date_from_params(:updated_at_end, @options)
|
||||||
@options[:project_version] = @options[:project_version].presence
|
@options[:project_version] = @options[:project_version].presence
|
||||||
|
|
|
@ -37,13 +37,13 @@
|
||||||
- @mass_builds.each do |mass_build|
|
- @mass_builds.each do |mass_build|
|
||||||
%tr
|
%tr
|
||||||
%td= mass_build.id
|
%td= mass_build.id
|
||||||
%td= link_to mass_build.name, build_lists_path(:filter => {:mass_build_id => mass_build.id})
|
%td= link_to mass_build.name, build_lists_path(:filter => {:mass_build_id => mass_build.id, :ownership => 'everything'})
|
||||||
%td.min_width_120
|
%td.min_width_120
|
||||||
- MassBuild::COUNT_STATUSES.each do |status|
|
- MassBuild::COUNT_STATUSES.each do |status|
|
||||||
= link_to t("layout.build_lists.statuses.#{status}") + ": ", build_lists_path(:filter => {:mass_build_id => mass_build.id, :ownership => 'index'}.merge(status != :build_lists ? {:status => BuildList.status_by_human(status)} : {}))
|
= link_to t("layout.build_lists.statuses.#{status}") + ": ", build_lists_path(:filter => {:mass_build_id => mass_build.id, :ownership => 'everything'}.merge(status != :build_lists ? {:status => BuildList.status_by_human(status)} : {}))
|
||||||
= mass_build.read_attribute "#{status}_count"
|
= mass_build.read_attribute "#{status}_count"
|
||||||
.both
|
.both
|
||||||
%td= link_to t("layout.mass_builds.failed_builds_list"), failed_builds_list_platform_mass_build_path(@platform, mass_build.id), :target => "_blank" if can?(:failed_builds_list, mass_build)
|
%td= link_to t("layout.mass_builds.failed_builds_list"), failed_builds_list_platform_mass_build_path(@platform, mass_build.id, :format => :txt), :target => "_blank" if can?(:failed_builds_list, mass_build)
|
||||||
%td= link_to image_tag('x.png'), cancel_platform_mass_build_path(@platform, mass_build.id), :method => :post, :confirm => t("layout.mass_builds.cancel_confirm") if can?(:cancel, mass_build)
|
%td= link_to image_tag('x.png'), cancel_platform_mass_build_path(@platform, mass_build.id), :method => :post, :confirm => t("layout.mass_builds.cancel_confirm") if can?(:cancel, mass_build)
|
||||||
%td
|
%td
|
||||||
%a.toggle_btn{:href => "#toggle_#{ mass_build.id }", :'data-target' => "#toggle_#{ mass_build.id }"}= t("layout.mass_builds.extended_data")
|
%a.toggle_btn{:href => "#toggle_#{ mass_build.id }", :'data-target' => "#toggle_#{ mass_build.id }"}= t("layout.mass_builds.extended_data")
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
.lefter= t("layout.build_lists.ownership.related")
|
.lefter= t("layout.build_lists.ownership.related")
|
||||||
.both
|
.both
|
||||||
.table
|
.table
|
||||||
.lefter= f.radio_button :ownership, 'index', :class => 'niceRadio', :id => 'myradio3'
|
.lefter= f.radio_button :ownership, 'everything', :class => 'niceRadio', :id => 'myradio3'
|
||||||
.lefter= t("layout.build_lists.ownership.index")
|
.lefter= t("layout.build_lists.ownership.everything")
|
||||||
.both
|
.both
|
||||||
%br
|
%br
|
||||||
= f.submit t("layout.search.header")
|
= f.submit t("layout.search.header")
|
||||||
|
|
|
@ -80,7 +80,7 @@ en:
|
||||||
header: Build list ownership
|
header: Build list ownership
|
||||||
owned: My
|
owned: My
|
||||||
related: Related
|
related: Related
|
||||||
index: All
|
everything: All
|
||||||
|
|
||||||
build_server_status:
|
build_server_status:
|
||||||
header: Build server status
|
header: Build server status
|
||||||
|
|
|
@ -79,7 +79,7 @@ ru:
|
||||||
header: Принадлежность заданий
|
header: Принадлежность заданий
|
||||||
owned: Мне
|
owned: Мне
|
||||||
related: Связанные со мной
|
related: Связанные со мной
|
||||||
index: Все
|
everything: Все
|
||||||
|
|
||||||
build_server_status:
|
build_server_status:
|
||||||
header: Статус сборочного сервера
|
header: Статус сборочного сервера
|
||||||
|
|
25
db/schema.rb
25
db/schema.rb
|
@ -159,12 +159,12 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "flash_notifies", :force => true do |t|
|
create_table "flash_notifies", :force => true do |t|
|
||||||
t.text "body_ru", :null => false
|
t.text "body_ru"
|
||||||
t.text "body_en", :null => false
|
t.text "body_en"
|
||||||
t.string "status", :null => false
|
t.string "status"
|
||||||
t.boolean "published", :default => true, :null => false
|
t.boolean "published", :default => true
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "groups", :force => true do |t|
|
create_table "groups", :force => true do |t|
|
||||||
|
@ -321,19 +321,17 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.string "ancestry"
|
t.string "ancestry"
|
||||||
t.boolean "has_issues", :default => true
|
t.boolean "has_issues", :default => true
|
||||||
|
t.boolean "has_wiki", :default => false
|
||||||
t.string "srpm_file_name"
|
t.string "srpm_file_name"
|
||||||
t.string "srpm_content_type"
|
t.string "srpm_content_type"
|
||||||
t.integer "srpm_file_size"
|
t.integer "srpm_file_size"
|
||||||
t.datetime "srpm_updated_at"
|
t.datetime "srpm_updated_at"
|
||||||
t.boolean "has_wiki", :default => false
|
|
||||||
t.string "default_branch", :default => "master"
|
t.string "default_branch", :default => "master"
|
||||||
t.boolean "is_package", :default => true, :null => false
|
t.boolean "is_package", :default => true, :null => false
|
||||||
t.integer "average_build_time", :default => 0, :null => false
|
t.integer "average_build_time", :default => 0, :null => false
|
||||||
t.integer "build_count", :default => 0, :null => false
|
t.integer "build_count", :default => 0, :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false
|
|
||||||
|
|
||||||
create_table "register_requests", :force => true do |t|
|
create_table "register_requests", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "email"
|
t.string "email"
|
||||||
|
@ -395,6 +393,7 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "email", :default => "", :null => false
|
t.string "email", :default => "", :null => false
|
||||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||||
|
t.string "password_salt", :default => "", :null => false
|
||||||
t.string "reset_password_token"
|
t.string "reset_password_token"
|
||||||
t.datetime "remember_created_at"
|
t.datetime "remember_created_at"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
|
@ -402,8 +401,11 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
|
||||||
t.string "uname"
|
t.string "uname"
|
||||||
t.string "role"
|
t.string "role"
|
||||||
t.string "language", :default => "en"
|
t.string "language", :default => "en"
|
||||||
t.datetime "reset_password_sent_at"
|
t.string "confirmation_token"
|
||||||
|
t.datetime "confirmed_at"
|
||||||
|
t.datetime "confirmation_sent_at"
|
||||||
t.integer "own_projects_count", :default => 0, :null => false
|
t.integer "own_projects_count", :default => 0, :null => false
|
||||||
|
t.datetime "reset_password_sent_at"
|
||||||
t.text "professional_experience"
|
t.text "professional_experience"
|
||||||
t.string "site"
|
t.string "site"
|
||||||
t.string "company"
|
t.string "company"
|
||||||
|
@ -415,9 +417,6 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
|
||||||
t.integer "failed_attempts", :default => 0
|
t.integer "failed_attempts", :default => 0
|
||||||
t.string "unlock_token"
|
t.string "unlock_token"
|
||||||
t.datetime "locked_at"
|
t.datetime "locked_at"
|
||||||
t.string "confirmation_token"
|
|
||||||
t.datetime "confirmed_at"
|
|
||||||
t.datetime "confirmation_sent_at"
|
|
||||||
t.string "authentication_token"
|
t.string "authentication_token"
|
||||||
t.integer "build_priority", :default => 50
|
t.integer "build_priority", :default => 50
|
||||||
end
|
end
|
||||||
|
|
|
@ -125,7 +125,7 @@ describe Projects::BuildListsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should show only accessible build_lists' do
|
it 'should show only accessible build_lists' do
|
||||||
get :index, :filter => {:ownership => 'index'}
|
get :index, :filter => {:ownership => 'everything'}
|
||||||
assigns(:build_lists).should include(@build_list1)
|
assigns(:build_lists).should include(@build_list1)
|
||||||
assigns(:build_lists).should_not include(@build_list2)
|
assigns(:build_lists).should_not include(@build_list2)
|
||||||
assigns(:build_lists).should include(@build_list3)
|
assigns(:build_lists).should include(@build_list3)
|
||||||
|
@ -210,7 +210,7 @@ describe Projects::BuildListsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should show only accessible build_lists' do
|
it 'should show only accessible build_lists' do
|
||||||
get :index, :filter => {:ownership => 'index'}
|
get :index, :filter => {:ownership => 'everything'}
|
||||||
assigns(:build_lists).should include(@build_list1)
|
assigns(:build_lists).should include(@build_list1)
|
||||||
assigns(:build_lists).should_not include(@build_list2)
|
assigns(:build_lists).should_not include(@build_list2)
|
||||||
assigns(:build_lists).should include(@build_list3)
|
assigns(:build_lists).should include(@build_list3)
|
||||||
|
@ -297,17 +297,17 @@ describe Projects::BuildListsController do
|
||||||
|
|
||||||
it 'should filter by project_name' do
|
it 'should filter by project_name' do
|
||||||
# Project.where(:id => build_list2.project.id).update_all(:name => 'project_name')
|
# Project.where(:id => build_list2.project.id).update_all(:name => 'project_name')
|
||||||
get :index, :filter => {:project_name => @build_list2.project.name, :ownership => 'index'}
|
get :index, :filter => {:project_name => @build_list2.project.name, :ownership => 'everything'}
|
||||||
assigns[:build_lists].should_not include(@build_list1)
|
assigns[:build_lists].should_not include(@build_list1)
|
||||||
assigns[:build_lists].should include(@build_list2)
|
assigns[:build_lists].should include(@build_list2)
|
||||||
assigns[:build_lists].should_not include(@build_list3)
|
assigns[:build_lists].should_not include(@build_list3)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should filter by project_name and start_date' do
|
it 'should filter by project_name and start_date' do
|
||||||
get :index, :filter => {:project_name => @build_list3.project.name, :ownership => 'index',
|
get :index, :filter => {:project_name => @build_list3.project.name, :ownership => 'everything',
|
||||||
:"updated_at_start(1i)" => @build_list3.updated_at.year.to_s,
|
"created_at_start(1i)" => @build_list3.created_at.year.to_s,
|
||||||
:"updated_at_start(2i)" => @build_list3.updated_at.month.to_s,
|
"created_at_start(2i)" => @build_list3.created_at.month.to_s,
|
||||||
:"updated_at_start(3i)" => @build_list3.updated_at.day.to_s}
|
"created_at_start(3i)" => @build_list3.created_at.day.to_s}
|
||||||
assigns[:build_lists].should_not include(@build_list1)
|
assigns[:build_lists].should_not include(@build_list1)
|
||||||
assigns[:build_lists].should_not include(@build_list2)
|
assigns[:build_lists].should_not include(@build_list2)
|
||||||
assigns[:build_lists].should include(@build_list3)
|
assigns[:build_lists].should include(@build_list3)
|
||||||
|
|
Loading…
Reference in New Issue