rosa-build/app/policies/product_policy.rb

20 lines
403 B
Ruby
Raw Normal View History

2015-03-12 22:43:13 +00:00
class ProductPolicy < ApplicationPolicy
def index?
record.platform.main?
end
def show?
is_admin? || PlatformPolicy.new(user, record.platform).show?
end
alias_method :read?, :show?
def create?
is_admin? || record.platform.main? && local_admin?(record.platform)
end
alias_method :clone?, :create?
alias_method :destroy?, :create?
alias_method :update?, :create?
2015-03-12 22:43:13 +00:00
end