You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
392 B

  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. private
  9. def current_user
  10. current_account&.user
  11. end
  12. def user_signed_in?
  13. !current_user.nil?
  14. end
  15. def role
  16. current_user&.role || UserRole.nobody
  17. end
  18. end