Module: Authorization::System::ClassMethods

Defined in:
app/models/katello/authorization/system.rb

Instance Method Summary collapse

Instance Method Details

#all_editable?(content_view, environments) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
50
# File 'app/models/katello/authorization/system.rb', line 47

def all_editable?(content_view, environments)
  systems_query = System.where(:content_view_id => content_view, :environment_id => environments)
  systems_query.count == systems_query.editable.count
end

#any_editable?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'app/models/katello/authorization/system.rb', line 43

def any_editable?
  authorized(:edit_content_hosts).count > 0
end

#deletableObject



39
40
41
# File 'app/models/katello/authorization/system.rb', line 39

def deletable
  authorized(:destroy_content_hosts)
end

#editableObject



35
36
37
# File 'app/models/katello/authorization/system.rb', line 35

def editable
  authorized(:edit_content_hosts)
end

#readableObject



27
28
29
# File 'app/models/katello/authorization/system.rb', line 27

def readable
  authorized(:view_content_hosts)
end

#readable?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/models/katello/authorization/system.rb', line 31

def readable?
  User.current.can?(:view_content_hosts)
end

#readable_search_filters(_org) ⇒ Object



20
21
22
23
24
25
# File 'app/models/katello/authorization/system.rb', line 20

def readable_search_filters(_org)
  {:or => [
    {:terms => {:environment_id => KTEnvironment.readable.pluck(:id) }}
  ]
  }
end