about summary refs log tree commit diff
path: root/app/policies/application_policy.rb
blob: d1de5e81a211c6cd59d970322147ed68ec3124a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

class ApplicationPolicy
  attr_reader :current_account, :record

  def initialize(current_account, record)
    @current_account = current_account
    @record          = record
  end

  delegate :admin?, :moderator?, :staff?, to: :current_user, allow_nil: true

  private

  def current_user
    current_account&.user
  end

  def user_signed_in?
    !current_user.nil?
  end
end