[issue #279] Fixes.
* Almost finished permissions fixes * Removed is_template from product * Some fixes in crontab_generator partial
This commit is contained in:
parent
747edb73a5
commit
3c60347a23
|
@ -558,3 +558,13 @@ div.dataTables_processing {
|
|||
div.rightlist textarea {
|
||||
resize: none;
|
||||
}
|
||||
|
||||
div#crontab_generator .leftlist,
|
||||
div#crontab_generator .rightlist {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
div#crontab_generator .leftlist select,
|
||||
div#crontab_generator .rightlist select {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
|
|
@ -73,8 +73,10 @@ class Ability
|
|||
can :read, Platform, :owner_type => 'User', :owner_id => user.id
|
||||
can :read, Platform, :owner_type => 'Group', :owner_id => user.group_ids
|
||||
can(:read, Platform, read_relations_for('platforms')) {|platform| local_reader? platform}
|
||||
can([:update, :build_all], Platform) {|platform| local_admin? platform}
|
||||
can([:freeze, :unfreeze, :destroy], Platform) {|platform| owner? platform}
|
||||
# can([:update, :build_all], Platform) {|platform| local_admin? platform}
|
||||
can([:freeze, :unfreeze, :update], Platform) {|platform| local_admin? platform}
|
||||
#can([:freeze, :unfreeze, :destroy], Platform) {|platform| owner? platform}
|
||||
can(:destroy, Platform) {|platform| owner? platform}
|
||||
can :autocomplete_user_uname, Platform
|
||||
|
||||
can :read, Repository, :platform => {:visibility => 'open'}
|
||||
|
@ -86,7 +88,8 @@ class Ability
|
|||
|
||||
can :read, Product, :platform => {:owner_type => 'User', :owner_id => user.id}
|
||||
can :read, Product, :platform => {:owner_type => 'Group', :owner_id => user.group_ids}
|
||||
can(:manage, Product, read_relations_for('products', 'platforms')) {|product| local_admin? product.platform}
|
||||
# TODO: WTF???
|
||||
#can(:manage, Product, read_relations_for('products', 'platforms')) {|product| local_admin? product.platform}
|
||||
can(:create, ProductBuildList) {|pbl| pbl.product.can_build? and can?(:update, pbl.product)}
|
||||
can(:destroy, ProductBuildList) {|pbl| can?(:destroy, pbl.product)}
|
||||
|
||||
|
@ -111,10 +114,13 @@ class Ability
|
|||
|
||||
# Shared cannot rights for all users (registered, admin)
|
||||
cannot :destroy, Platform, :platform_type => 'personal'
|
||||
cannot :destroy, Repository, :platform => {:platform_type => 'personal'}
|
||||
cannot [:create, :destroy, :add_project, :remove_project], Repository, :platform => {:platform_type => 'personal'}
|
||||
cannot :fork, Project, :owner_id => user.id, :owner_type => user.class.to_s
|
||||
cannot :destroy, Issue
|
||||
|
||||
cannot :manage, Product, :platform => {:platform_type => 'personal'}
|
||||
cannot [:clone, :build_all, :freeze, :unfreeze], Platform, :platform_type => 'personal'
|
||||
|
||||
can :create, Subscribe do |subscribe|
|
||||
!subscribe.subscribeable.subscribes.exists?(:user_id => user.id)
|
||||
end
|
||||
|
|
|
@ -23,13 +23,13 @@ class Product < ActiveRecord::Base
|
|||
@delete_tar = value
|
||||
end
|
||||
|
||||
def can_clone?
|
||||
is_template
|
||||
end
|
||||
# def can_clone?
|
||||
# is_template
|
||||
# end
|
||||
|
||||
def can_build?
|
||||
!is_template
|
||||
end
|
||||
# def can_build?
|
||||
# !is_template
|
||||
# end
|
||||
|
||||
def clone_from!(template)
|
||||
raise "Only templates can be cloned" unless template.can_clone?
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
= link_to t("layout.platforms.about"), platform_path(@platform)
|
||||
%li{:class => (contr == :repositories) ? 'active' : ''}
|
||||
= link_to t("layout.repositories.list_header"), platform_repositories_path(@platform)
|
||||
- if can? :read, @platform.products.build
|
||||
%li{:class => (contr == :products) ? 'active' : ''}
|
||||
= link_to t("layout.products.list_header"), platform_products_path(@platform)
|
||||
-#- if current_user.owner_of? @platform or current_user.admin?
|
||||
|
|
|
@ -29,11 +29,14 @@
|
|||
%td= @platform.distrib_type
|
||||
|
||||
.buttons_block
|
||||
= link_to t("layout.platforms.build_all"), build_all_platform_path(@platform), :confirm => I18n.t("layout.confirm"), :method => :post, :class => "button left_floated" if can? :build_all, @platform
|
||||
- if can? :build_all, @platform
|
||||
= link_to t("layout.platforms.build_all"), build_all_platform_path(@platform), :confirm => I18n.t("layout.confirm"), :method => :post, :class => "button left_floated"
|
||||
- if @platform.released?
|
||||
= link_to t("layout.platforms.unfreeze"), unfreeze_platform_path(@platform), :confirm => I18n.t("layout.platforms.confirm_unfreeze"), :method => :post, :class => "button left_floated" if can? :unfreeze, @platform
|
||||
- if can? :unfreeze, @platform
|
||||
= link_to t("layout.platforms.unfreeze"), unfreeze_platform_path(@platform), :confirm => I18n.t("layout.platforms.confirm_unfreeze"), :method => :post, :class => "button left_floated"
|
||||
- else
|
||||
= link_to t("layout.platforms.freeze"), freeze_platform_path(@platform), :confirm => I18n.t("layout.platforms.confirm_freeze"), :method => :post, :class => "button left_floated" if can? :freeze, @platform
|
||||
- if can? :freeze, @platform
|
||||
= link_to t("layout.platforms.freeze"), freeze_platform_path(@platform), :confirm => I18n.t("layout.platforms.confirm_freeze"), :method => :post, :class => "button left_floated"
|
||||
= link_to "Клонировать", clone_platform_path(@platform), :class => "button left_floated" if can? :clone, @platform
|
||||
.both
|
||||
|
||||
|
|
|
@ -71,8 +71,7 @@
|
|||
%a{ :href => "#" }= t("layout.products.cron_tab_generator.show")
|
||||
|
||||
#crontab_generator{ :style => "display: none;" }
|
||||
.columns.wat-cf
|
||||
.column.left
|
||||
.leftlist
|
||||
%h3.title= t("layout.products.cron_tab_generator.minutes")
|
||||
.group
|
||||
= label_tag :minute_chooser_every, t("layout.products.cron_tab_generator.every_minute"), :class => :label
|
||||
|
@ -86,7 +85,7 @@
|
|||
- (0..59).each do |min|
|
||||
%option{ :value => min, :selected => @product.cron_tab_minutes.include?(min) }= min
|
||||
|
||||
.column.right
|
||||
.rightlist
|
||||
%h3.title= t("layout.products.cron_tab_generator.hours")
|
||||
.group
|
||||
= label_tag :hour_chooser_every, t("layout.products.cron_tab_generator.every_hour"), :class => :label
|
||||
|
@ -99,9 +98,9 @@
|
|||
%select{ :name => :hour, :id => :hour, :multiple => true, :disabled => @product.cron_tab_hours.blank?, :class => "cron" }
|
||||
- (0..23).each do |hour|
|
||||
%option{ :value => hour, :selected => @product.cron_tab_hours.include?(hour) }= hour
|
||||
.both
|
||||
|
||||
.columns.wat-cf
|
||||
.column.left
|
||||
.leftlist
|
||||
%h3.title= t("layout.products.cron_tab_generator.days")
|
||||
.group
|
||||
= label_tag :day_chooser_every, t("layout.products.cron_tab_generator.every_day"), :class => :label
|
||||
|
@ -115,7 +114,7 @@
|
|||
- (1..31).each do |day|
|
||||
%option{ :value => day, :selected => @product.cron_tab_days.include?(day) }= day
|
||||
|
||||
.column.right
|
||||
.rightlist
|
||||
%h3.title= t("layout.products.cron_tab_generator.months")
|
||||
.group
|
||||
= label_tag :month_chooser_every, t("layout.products.cron_tab_generator.every_month"), :class => :label
|
||||
|
@ -128,9 +127,9 @@
|
|||
%select{ :name => "month", :id => "month", :multiple => true, :disabled => @product.cron_tab_months.blank?, :class => "cron" }
|
||||
- (1..12).each do |month|
|
||||
%option{ :value => month, :selected => @product.cron_tab_months.include?(month) }= I18n.localize(Time.local(2000, month), :format => "%B")
|
||||
.both
|
||||
|
||||
.columns.wat-cf
|
||||
.column.left
|
||||
.leftlist
|
||||
%h3.title= t("layout.products.cron_tab_generator.weekdays")
|
||||
.group
|
||||
= label_tag :weekday_chooser_every, t("layout.products.cron_tab_generator.every_weekday"), :class => :label
|
||||
|
@ -143,8 +142,10 @@
|
|||
%select{ :name => "weekday", :id => "weekday", :multiple => true, :disabled => @product.cron_tab_weekdays.blank?, :class => "cron" }
|
||||
- Date::DAYNAMES.each_with_index do |day, index|
|
||||
%option{ :value => index, :selected => @product.cron_tab_weekdays.include?(index) }= t("layout.weekdays.#{day}")
|
||||
.both
|
||||
|
||||
.both
|
||||
.leftlist= form.label :cron_tab, :class => :label
|
||||
.rightlist= form.text_field :cron_tab, :id => "cron", :class => "text_field", :style => "width: 40%", :disabled => !@product.use_cron, :value => @product.cron_tab
|
||||
= @product.cron_command
|
||||
=# @product.cron_command
|
||||
.both
|
||||
|
|
|
@ -37,9 +37,6 @@
|
|||
|
||||
= render :partial => "products/crontab", :locals => { :form => f }
|
||||
|
||||
.leftlist= f.label :is_template, :class => :label
|
||||
.rightlist= f.check_box :is_template, :class => 'check_box'
|
||||
|
||||
- content_for :commented do
|
||||
.leftlist= f.label :system_wide, :class => :label
|
||||
.rightlist= f.check_box :system_wide, :class => 'check_box'
|
||||
|
|
|
@ -41,6 +41,7 @@ en:
|
|||
attributes:
|
||||
product:
|
||||
name: Name
|
||||
description: Description
|
||||
platform_id: Platform
|
||||
build_status: Build status
|
||||
build_path: ISO path
|
||||
|
|
|
@ -41,6 +41,7 @@ ru:
|
|||
attributes:
|
||||
product:
|
||||
name: Название
|
||||
description: Описание
|
||||
platform_id: Платформа
|
||||
build_status: Статус последней сборки
|
||||
build_path: Путь к iso
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class RemoveIsTemplateFromProducts < ActiveRecord::Migration
|
||||
def up
|
||||
remove_column :products, :is_template
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :products, "is_template", :boolean, :default => false
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120314162313) do
|
||||
ActiveRecord::Schema.define(:version => 20120314223151) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -249,7 +249,6 @@ ActiveRecord::Schema.define(:version => 20120314162313) do
|
|||
t.string "tar_content_type"
|
||||
t.integer "tar_file_size"
|
||||
t.datetime "tar_updated_at"
|
||||
t.boolean "is_template", :default => false
|
||||
t.boolean "system_wide", :default => false
|
||||
t.text "cron_tab"
|
||||
t.boolean "use_cron", :default => false
|
||||
|
|
Loading…
Reference in New Issue