Class: PrintHostPolicy

Inherits:
ApplicationPolicy show all
Defined in:
app/policies/print_host_policy.rb

Constant Summary

Constants inherited from ApplicationPolicy

ApplicationPolicy::STANDARD_EDIT_PERMISSIONS, ApplicationPolicy::STANDARD_VIEW_PERMISSIONS

Instance Attribute Summary

Attributes inherited from ApplicationPolicy

#record, #user

Instance Method Summary collapse

Methods inherited from ApplicationPolicy

#destroy_all?, #edit?, #initialize, #new?, #show?

Constructor Details

This class inherits a constructor from ApplicationPolicy

Instance Method Details

#create? ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/policies/print_host_policy.rb', line 11

def create?
  index?
end

#destroy? ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/policies/print_host_policy.rb', line 19

def destroy?
  index?
end

#index? ⇒ Boolean

Returns:

  • (Boolean)


2
3
4
5
6
7
8
9
# File 'app/policies/print_host_policy.rb', line 2

def index?
  all_of(
    @user&.is_administrator?,
    none_of(
      SiteSettings.demo_mode_enabled?
    )
  )
end

#print? ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
# File 'app/policies/print_host_policy.rb', line 23

def print?
  all_of(
    @user&.is_printer?,
    none_of(
      SiteSettings.demo_mode_enabled?
    )
  )
end

#update? ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/policies/print_host_policy.rb', line 15

def update?
  index?
end