Sha256: 1212cf27a81707b0174e4798b684c289f0366aaf25133b11f44d6d583794c521

Contents?: true

Size: 583 Bytes

Versions: 142

Compression:

Stored size: 583 Bytes

Contents

view_permission = Permission.where(:name => :view_foreman_tasks, :resource_type => ForemanTasks::Task.name).first

# the anonymous role was renamed to default in
# https://github.com/theforeman/foreman/pull/3239
default_role = Role.respond_to?(:default) ? Role.default : Role.anonymous
# the view_permissions can be nil in tests: skipping in that case
if view_permission && !default_role.permissions.include?(view_permission)
  default_role.filters.create(:search => 'owner.id = current_user') do |filter|
    filter.filterings.build { |f| f.permission = view_permission }
  end
end

Version data entries

142 entries across 142 versions & 1 rubygems

Version Path
foreman-tasks-5.3.0 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-5.2.0 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-5.1.1 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-5.1.0 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-4.1.5 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-4.1.4 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-4.1.3 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-3.0.6 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-5.0.0 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-4.1.2 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-4.1.1 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-4.0.1 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-4.1.0 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-3.0.5 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-4.0.0 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-3.0.4 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-2.0.3 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-3.0.3 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-3.0.2 db/seeds.d/20-foreman_tasks_permissions.rb
foreman-tasks-3.0.1 db/seeds.d/20-foreman_tasks_permissions.rb