logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

application_policy.rb (410B)


  1. # frozen_string_literal: true
  2. class ApplicationPolicy
  3. attr_reader :current_account, :record
  4. def initialize(current_account, record)
  5. @current_account = current_account
  6. @record = record
  7. end
  8. delegate :admin?, :moderator?, :staff?, to: :current_user, allow_nil: true
  9. private
  10. def current_user
  11. current_account&.user
  12. end
  13. def user_signed_in?
  14. !current_user.nil?
  15. end
  16. end