[issue #279] Removed can_clone? and can_build? from Product
This commit is contained in:
parent
548550d355
commit
9911d9f25e
|
@ -92,7 +92,7 @@ class Ability
|
|||
can(:read, Product, read_relations_for('products', 'platforms')) {|product| product.platform.platform_type == 'main'}
|
||||
can([:create, :update, :destroy, :clone], Product) {|product| local_admin? product.platform }
|
||||
|
||||
can(:create, ProductBuildList) {|pbl| pbl.product.can_build? and can?(:update, pbl.product)}
|
||||
can(:create, ProductBuildList) {|pbl| can?(:update, pbl.product)}
|
||||
can(:destroy, ProductBuildList) {|pbl| can?(:destroy, pbl.product)}
|
||||
|
||||
can [:read, :platforms], Category
|
||||
|
|
|
@ -23,18 +23,7 @@ class Product < ActiveRecord::Base
|
|||
@delete_tar = value
|
||||
end
|
||||
|
||||
def can_clone?
|
||||
#is_template
|
||||
false
|
||||
end
|
||||
|
||||
def can_build?
|
||||
# !is_template
|
||||
true
|
||||
end
|
||||
|
||||
def clone_from!(template)
|
||||
raise "Only templates can be cloned" unless template.can_clone?
|
||||
attrs = ATTRS_TO_CLONE.inject({}) {|result, attr|
|
||||
result[attr] = template.send(attr)
|
||||
result
|
||||
|
|
Loading…
Reference in New Issue