app/services/hyrax/admin_set_create_service.rb
def valkyrie_create!
      admin_set.creator = [creating_user.user_key] if creating_user
      updated_admin_set = Hyrax.persister.save(resource: admin_set).tap do |result|
        if result
          ActiveRecord::Base.transaction do
            permission_template = permissions_create_service.create_default(collection: result,
                                                                            creating_user: creating_user)
            workflow = create_workflows_for(permission_template: permission_template)
            create_default_access_for(permission_template: permission_template, workflow: workflow) if default_admin_set?(id: admin_set.id)
          end
        end
      end
      Hyrax.publisher.publish('collection.metadata.updated', collection: updated_admin_set, user: creating_user)
      updated_admin_set
    end
# Creates an admin set, setting the creator and the default access controls.
# @return [Hyrax::AdministrativeSet] The fully created admin set.
# @raise [RuntimeError] if admin set cannot be persisted
Creates an admin set, setting the creator and the default access controls.
Creates an admin set setting the creator and the default access controls .
def valkyrie_create!
      admin_set.creator = [creating_user.user_key] if creating_user
      updated_admin_set = Hyrax.persister.save(resource: admin_set).tap do |result|
        if result
          ActiveRecord::Base.transaction do
            permission_template = permissions_create_service.create_default(collection: result,
                                                                            creating_user: creating_user)
            workflow = create_workflows_for(permission_template: permission_template)
            create_default_access_for(permission_template: permission_template, workflow: workflow) if default_admin_set?(id: admin_set.id)
          end
        end
      end
      Hyrax.publisher.publish('collection.metadata.updated', collection: updated_admin_set, user: creating_user)
      updated_admin_set
    end
def valkyrie_create! admin_set . creator = [ creating_user . user_key ] if creating_user updated_admin_set = Hyrax . persister . save ( resource : admin_set ) . tap do | result | if result ActiveRecord :: Base . transaction do permission_template = permissions_create_service . create_default ( collection : result , creating_user : creating_user ) workflow = create_workflows_for ( permission_template : permission_template ) create_default_access_for ( permission_template : permission_template , workflow : workflow ) if default_admin_set? ( id : admin_set . id ) end end end Hyrax . publisher . publish ( 'collection.metadata.updated' , collection : updated_admin_set , user : creating_user ) updated_admin_set end
Creates an admin set, setting the creator and the default access controls.
Creates an admin set setting the creator and the default access controls .
The fully created admin set.
The fully created admin set .
Hyrax::AdministrativeSet
[RuntimeError] if admin set cannot be persisted
[ RuntimeError ] if admin set cannot be persisted