Module: Katello::Authorization::ContentView::ClassMethods
- Defined in:
- app/models/katello/authorization/content_view.rb
Instance Method Summary collapse
- #creatable ⇒ Object
- #creatable? ⇒ Boolean
- #deletable ⇒ Object
- #editable ⇒ Object
- #exportable ⇒ Object
- #importable ⇒ Object
- #promotable_or_removable ⇒ Object
- #publishable ⇒ Object
- #publishable? ⇒ Boolean
- #readable ⇒ Object
- #readable? ⇒ Boolean
- #readable_as(user) ⇒ Object
- #readable_repositories(repo_ids = nil) ⇒ Object
Instance Method Details
#creatable ⇒ Object
32 33 34 |
# File 'app/models/katello/authorization/content_view.rb', line 32 def creatable (:view_content_views) end |
#creatable? ⇒ Boolean
44 45 46 |
# File 'app/models/katello/authorization/content_view.rb', line 44 def creatable? ::User.current.can?(:create_content_views) end |
#deletable ⇒ Object
56 57 58 |
# File 'app/models/katello/authorization/content_view.rb', line 56 def deletable (:destroy_content_views) end |
#editable ⇒ Object
52 53 54 |
# File 'app/models/katello/authorization/content_view.rb', line 52 def editable (:edit_content_views) end |
#exportable ⇒ Object
69 70 71 |
# File 'app/models/katello/authorization/content_view.rb', line 69 def exportable where(organization: Organization.(:export_content)) end |
#importable ⇒ Object
73 74 75 |
# File 'app/models/katello/authorization/content_view.rb', line 73 def importable where(organization: Organization.(:import_content)) end |
#promotable_or_removable ⇒ Object
64 65 66 67 |
# File 'app/models/katello/authorization/content_view.rb', line 64 def promotable_or_removable return where("1=0") unless Katello::KTEnvironment.any_promotable? (:promote_or_remove_content_views) end |
#publishable ⇒ Object
60 61 62 |
# File 'app/models/katello/authorization/content_view.rb', line 60 def publishable (:publish_content_views) end |
#publishable? ⇒ Boolean
48 49 50 |
# File 'app/models/katello/authorization/content_view.rb', line 48 def publishable? ::User.current.can?(:publish_content_views) end |
#readable ⇒ Object
28 29 30 |
# File 'app/models/katello/authorization/content_view.rb', line 28 def readable (:view_content_views) end |
#readable? ⇒ Boolean
40 41 42 |
# File 'app/models/katello/authorization/content_view.rb', line 40 def readable? ::User.current.can?(:view_content_views) end |
#readable_as(user) ⇒ Object
36 37 38 |
# File 'app/models/katello/authorization/content_view.rb', line 36 def readable_as(user) (user, :view_content_views) end |
#readable_repositories(repo_ids = nil) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'app/models/katello/authorization/content_view.rb', line 77 def readable_repositories(repo_ids = nil) query = Katello::Repository.all content_views = Katello::ContentView.readable if repo_ids query.where(:id => repo_ids) else content_views = content_views.where(:default => false) end query.joins(:content_view_version) .where("#{Katello::ContentViewVersion.table_name}.content_view_id" => content_views.pluck(:id)) end |