1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/policies/application_policy.rb

76 lines
836 B
Ruby
Raw Normal View History

2018-11-29 19:02:04 -05:00
# frozen_string_literal: true
class ApplicationPolicy
2018-12-12 22:09:49 -05:00
attr_reader :account, :record
2018-11-29 19:02:04 -05:00
2018-12-12 22:09:49 -05:00
def initialize(account, record)
@account = account
2018-11-29 19:02:04 -05:00
@record = record
end
2018-12-01 06:17:55 -05:00
# :nocov:
2018-11-29 19:02:04 -05:00
def index?
false
end
def show?
false
end
def create?
false
end
def new?
create?
end
def update?
false
end
def edit?
update?
end
def destroy?
false
end
2018-12-01 06:17:55 -05:00
# :nocov:
def policy(record)
2018-12-12 22:09:49 -05:00
Pundit.policy account, record
end
2018-11-29 19:02:04 -05:00
class Scope
2018-12-12 22:09:49 -05:00
attr_reader :account, :scope
2018-11-29 19:02:04 -05:00
2018-12-12 22:09:49 -05:00
def initialize(account, scope)
@account = account
2018-11-29 19:02:04 -05:00
@scope = scope
end
2018-12-01 06:17:55 -05:00
# :nocov:
2018-11-29 19:02:04 -05:00
def resolve
2018-11-29 19:17:26 -05:00
scope.none
2018-11-29 19:02:04 -05:00
end
2018-12-01 06:17:55 -05:00
2019-09-09 18:22:17 -04:00
# :nocov:
2019-09-09 18:02:46 -04:00
private
def restricted?
Rails.application.restricted?
end
end
private
def restricted?
Rails.application.restricted?
2018-11-29 19:02:04 -05:00
end
end