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