Sha256: 6f5f84fd5a50bf40a6146af5d46f685b22bbf2184b8b45ff6965d9396f6ba4e6

Contents?: true

Size: 686 Bytes

Versions: 25

Compression:

Stored size: 686 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  # Grants the user's edit access on the provided FileSet
  class GrantEditJob < ApplicationJob
    include PermissionJobBehavior
    # @param file_set_id [String] the identifier of the object to grant access to
    # @param user_key [String] the user to add
    # @param use_valkyrie [Boolean] whether to use valkyrie support
    def perform(file_set_id, user_key, use_valkyrie: Hyrax.config.use_valkyrie?)
      if use_valkyrie
        acl(file_set_id).grant(:edit).to(user(user_key)).save
      else
        file_set = ::FileSet.find(file_set_id)
        file_set.edit_users += [user_key]
        file_set.save!
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
hyrax-5.0.1 app/jobs/hyrax/grant_edit_job.rb
hyrax-5.0.0 app/jobs/hyrax/grant_edit_job.rb
hyrax-5.0.0.rc3 app/jobs/hyrax/grant_edit_job.rb
hyrax-5.0.0.rc2 app/jobs/hyrax/grant_edit_job.rb
hyrax-5.0.0.rc1 app/jobs/hyrax/grant_edit_job.rb
hyrax-3.6.0 app/jobs/hyrax/grant_edit_job.rb
hyrax-4.0.0 app/jobs/hyrax/grant_edit_job.rb
hyrax-4.0.0.rc3 app/jobs/hyrax/grant_edit_job.rb
hyrax-4.0.0.rc2 app/jobs/hyrax/grant_edit_job.rb
hyrax-4.0.0.rc1 app/jobs/hyrax/grant_edit_job.rb
hyrax-3.5.0 app/jobs/hyrax/grant_edit_job.rb
hyrax-4.0.0.beta2 app/jobs/hyrax/grant_edit_job.rb
hyrax-3.4.2 app/jobs/hyrax/grant_edit_job.rb
hyrax-4.0.0.beta1 app/jobs/hyrax/grant_edit_job.rb
hyrax-3.4.1 app/jobs/hyrax/grant_edit_job.rb
hyrax-3.4.0 app/jobs/hyrax/grant_edit_job.rb
hyrax-3.3.0 app/jobs/hyrax/grant_edit_job.rb
hyrax-3.2.0 app/jobs/hyrax/grant_edit_job.rb
hyrax-3.1.0 app/jobs/hyrax/grant_edit_job.rb
hyrax-3.0.2 app/jobs/hyrax/grant_edit_job.rb