source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/event.rb
Ruby
apache-2.0
197
main
965
# frozen_string_literal: true module Hyrax ## # Events are timestamped, named actions that provide a streamed 'paper trail' # of certain repository activities. # # Not to be confused with the +Dry::Events+-based pub/sub interface at # {Hyrax::Publisher}. # # @see Hyrax::RedisEventStore class Event ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/base.rb
Ruby
apache-2.0
197
main
339
# frozen_string_literal: true module Hyrax # Isolate calls to ActiveFedora::Base class Base def self.uncached(&block) ActiveFedora::Base.uncached(&block) end def self.uri_to_id(uri) ActiveFedora::Base.uri_to_id(uri) end def self.id_to_uri(id) ActiveFedora::Base.id_to_uri(id)...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/pcdm_collection.rb
Ruby
apache-2.0
197
main
2,546
# frozen_string_literal: true require_dependency 'hyrax/collection_name' module Hyrax ## # Valkyrie model for Collection domain objects in the Hydra Works model. # # ## Relationships # # ### Collection and Collection (TBA) # # ### Collection and Work # # * Defined: The relationship is defined by t...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/permission.rb
Ruby
apache-2.0
197
main
760
# frozen_string_literal: true module Hyrax ## # Valkyrie native permissions (access policies) for Hyrax # # Permissions are persisted independently from `Hyrax::Resource`s (works, # collections, file sets, etc...) since their scope is different. Access policies # may be application-specific and tend to upd...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/pageview.rb
Ruby
apache-2.0
197
main
204
# frozen_string_literal: true module Hyrax class Pageview extend ::Legato::Model metrics :pageviews dimensions :date filter :for_path, &->(path) { contains(:pagePath, path) } end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/embargo.rb
Ruby
apache-2.0
197
main
996
# frozen_string_literal: true module Hyrax ## # The Valkyrie model for embargoes. # # @note Embargo and Lease can, in principle, be collapsed into a single model # with a `#visibility_during`, `#visibility_after`, `#end_date`, and # `#history`. We haven't made this transition in order to simplify legac...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/workflow_action_info.rb
Ruby
apache-2.0
197
main
844
# frozen_string_literal: true module Hyrax ## # A simple data object for holding a user, work and their workflow proxies # # this is a glorified Struct that resolves +Sipity::Enitity(work)+ # and +Sipity::Agent(user)+ for the input given, then provides readers # for its instance variables. # # @example ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/permission_template.rb
Ruby
apache-2.0
197
main
10,242
# frozen_string_literal: true module Hyrax ## # Holds policy data about the workflow and permissions applied objects when # they are deposited through an Administrative Set or a Collection. Each # template record has a {#source} (through {#source_id}); the template's # rules inform the behavior of objects dep...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/collection_type.rb
Ruby
apache-2.0
197
main
8,854
# frozen_string_literal: true module Hyrax class CollectionType < ActiveRecord::Base # rubocop:disable Metrics/ClassLength # @!method id # @return [Integer] # @!method description # @return [String] # @!method machine_id # @return [String] # @!method title # @return [String] ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/uploaded_file.rb
Ruby
apache-2.0
197
main
1,127
# frozen_string_literal: true module Hyrax ## # Store a file uploaded by a user. # # Eventually these files get attached to {FileSet}s and pushed into Fedora. class UploadedFile < ActiveRecord::Base self.table_name = 'uploaded_files' mount_uploader :file, UploadedFileUploader alias uploader file ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/flexible_schema.rb
Ruby
apache-2.0
197
main
6,429
# frozen_string_literal: true # rubocop:disable Metrics/ClassLength class Hyrax::FlexibleSchema < ApplicationRecord serialize :profile, coder: YAML serialize :contexts, coder: YAML validate :validate_profile validate :validate_property_name_conflicts before_save :update_contexts def warnings @warning...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/riiif/file_resolver.rb
Ruby
apache-2.0
197
main
1,910
# frozen_string_literal: true if defined?(Riiif::Image) module Hyrax module Riiif # Adds file locking to Riiif::File # @see Riiif::FileResolver class FileResolver include ActiveSupport::Benchmarkable # @param [String] id from iiif manifest # @return [Riiif::File] ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/riiif/file.rb
Ruby
apache-2.0
197
main
991
# frozen_string_literal: true if defined?(::Riiif::File) module Hyrax module Riiif class File < ::Riiif::File include ActiveSupport::Benchmarkable attr_reader :id def initialize(input_path, tempfile = nil, id:) super(input_path, tempfile) raise(ArgumentError, "m...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/vocab/fedora_resource_status.rb
Ruby
apache-2.0
197
main
458
# frozen_string_literal: true require 'rdf' module Vocab class FedoraResourceStatus < RDF::StrictVocabulary('http://fedora.info/definitions/1/0/access/ObjState#') term :objState, label: 'Object State', type: 'owl:ObjectProperty' term :active, label: 'active', type: 'owl:NamedIndividual' term :dele...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/with_events.rb
Ruby
apache-2.0
197
main
827
# frozen_string_literal: true module Hyrax # A mixin module intended to provide an interface into creating the paper trail # of activity on the target model of the mixin. # # @see Hyrax::Event module WithEvents def stream Nest.new(event_class)[to_param] end # @return [String] def event_...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/human_readable_type.rb
Ruby
apache-2.0
197
main
574
# frozen_string_literal: true module Hyrax module HumanReadableType extend ActiveSupport::Concern module ClassMethods def human_readable_type I18n.translate("activefedora.models.#{model_name.i18n_key}", default: name.demodulize.titleize) end end def human_readable_type self...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/collection_behavior.rb
Ruby
apache-2.0
197
main
3,475
# frozen_string_literal: true module Hyrax module CollectionBehavior extend ActiveSupport::Concern include Hydra::AccessControls::WithAccessRight include Hydra::WithDepositor # for access to apply_depositor_metadata include Hyrax::CoreMetadata include Hydra::Works::CollectionBehavior include H...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/in_admin_set.rb
Ruby
apache-2.0
197
main
205
# frozen_string_literal: true module Hyrax module InAdminSet extend ActiveSupport::Concern included do belongs_to :admin_set, predicate: Hyrax.config.admin_set_predicate end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/solr_document_behavior.rb
Ruby
apache-2.0
197
main
4,956
# frozen_string_literal: true module Hyrax ## # @api public # # Hyrax extensions for +Blacklight+'s generated +SolrDocument+. # # @example using with +Blacklight::Solr::Document+ # class SolrDocument # include Blacklight::Solr::Document # include Hyrax::SolrDocumentBehavior # end # #...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/nested_works.rb
Ruby
apache-2.0
197
main
297
# frozen_string_literal: true module Hyrax module NestedWorks extend ActiveSupport::Concern included do class_attribute :valid_child_concerns self.valid_child_concerns = Hyrax.config.curation_concerns end def in_works_ids in_works.map(&:id) end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/has_representative.rb
Ruby
apache-2.0
197
main
413
# frozen_string_literal: true module Hyrax::HasRepresentative extend ActiveSupport::Concern included do belongs_to :representative, predicate: ::RDF::Vocab::EBUCore.hasRelatedMediaFragment, class_name: 'ActiveFedora::Base' belongs_to :thumbnail, predicate: ::RD...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/virus_check.rb
Ruby
apache-2.0
197
main
516
# frozen_string_literal: true module Hyrax module VirusCheck extend ActiveSupport::Concern included do validate :must_not_detect_viruses def viruses? return false unless original_file&.new_record? # We have a new file to check VirusCheckerService.file_has_virus?(original_file) ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/suppressible.rb
Ruby
apache-2.0
197
main
1,018
# frozen_string_literal: true module Hyrax # A work should be able to be filtered out of search results if it's inactive module Suppressible extend ActiveSupport::Concern included do # This holds the workflow state property :state, predicate: Vocab::FedoraResourceStatus.objState, multiple: fals...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/core_metadata.rb
Ruby
apache-2.0
197
main
1,316
# frozen_string_literal: true module Hyrax # These are the metadata elements that Hyrax internally requires of # all managed Collections, Works and FileSets will have. module CoreMetadata extend ActiveSupport::Concern included do property :depositor, predicate: ::RDF::URI.new('http://id.loc.gov/voc...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/user.rb
Ruby
apache-2.0
197
main
5,981
# frozen_string_literal: true require 'oauth' module Hyrax::User extend ActiveSupport::Concern included do # Adds acts_as_messageable for user mailboxes include Mailboxer::Models::Messageable # Connects this user object to Blacklight's Bookmarks and Folders. include Blacklight::User include Hy...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/valkyrie_lazy_migration.rb
Ruby
apache-2.0
197
main
3,093
# frozen_string_literal: true module Hyrax ## # This mixin is for {Valkyrie::Resource} objects to be able to read/write the same Solr document # as their corresponding {ActiveFedora::Base} object. # # @see https://github.com/samvera/hyrax/pull/6221 Discussion about having one indexed document module Valkyr...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/serializers.rb
Ruby
apache-2.0
197
main
251
# frozen_string_literal: true module Hyrax module Serializers def to_s if title.present? title.join(' | ') elsif label.present? label else I18n.t('hyrax.works.missing_title') end end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/embargoable.rb
Ruby
apache-2.0
197
main
591
# frozen_string_literal: true module Hyrax module Embargoable extend ActiveSupport::Concern include Hydra::AccessControls::Embargoable included do validates :lease_expiration_date, 'hydra/future_date': true, on: :create validates :embargo_release_date, 'hydra/future_date': true, on: :create ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/ability.rb
Ruby
apache-2.0
197
main
14,896
# frozen_string_literal: true module Hyrax ## # Provides Hyrax's engine level user/group authorizations. # # Authorization (allow or deny) of the following actions is managed by the # rules defined here: # # - read: # - show: # - edit: # - update: # - create: # - discover: # - ma...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/with_embargoes_and_leases.rb
Ruby
apache-2.0
197
main
781
# frozen_string_literal: true module Hyrax module WithEmbargoesAndLeases extend ActiveSupport::Concern def embargo=(value) raise TypeError "can't convert #{value.class} into Hyrax::Embargo" unless value.is_a? Hyrax::Embargo @embargo = value self.embargo_id = @embargo.id end def em...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/flexibility.rb
Ruby
apache-2.0
197
main
3,846
# frozen_string_literal: true module Hyrax module Flexibility extend ActiveSupport::Concern included do attribute :schema_version, Valkyrie::Types::String attribute :contexts, Valkyrie::Types::Set.of(Valkyrie::Types::String) end class_methods do def try(term) ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/proxy_deposit.rb
Ruby
apache-2.0
197
main
827
# frozen_string_literal: true module Hyrax module ProxyDeposit extend ActiveSupport::Concern included do property :proxy_depositor, predicate: ::RDF::URI.new('http://scholarsphere.psu.edu/ns#proxyDepositor'), multiple: false do |index| index.as :symbol end # This value is set when ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/has_rendering.rb
Ruby
apache-2.0
197
main
384
# frozen_string_literal: true module Hyrax::HasRendering extend ActiveSupport::Concern included do # rubocop:disable Rails/HasAndBelongsToMany has_and_belongs_to_many :renderings, predicate: Hyrax.config.rendering_predicate, class_name: 'ActiveFedora:...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/user_usage_stats.rb
Ruby
apache-2.0
197
main
426
# frozen_string_literal: true module Hyrax::UserUsageStats def stats @stats ||= UserStat.where(user_id: id).order(date: :asc) end def total_file_views stats.reduce(0) { |total, stat| total + stat.file_views } end def total_file_downloads stats.reduce(0) { |total, stat| total + stat.file_download...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/basic_metadata.rb
Ruby
apache-2.0
197
main
2,477
# frozen_string_literal: true module Hyrax # An optional model mixin to define some simple properties. This must be mixed # after all other properties are defined because no other properties will # be defined once accepts_nested_attributes_for is called module BasicMetadata extend ActiveSupport::Concern ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/naming.rb
Ruby
apache-2.0
197
main
647
# frozen_string_literal: true require_dependency 'hyrax/name' module Hyrax module Naming extend ActiveSupport::Concern module ClassMethods # Override of ActiveModel::Model name that allows us to use our custom name class def model_name(name_class: _hyrax_default_name_class) @_model_name...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/ar_resource.rb
Ruby
apache-2.0
197
main
4,169
# frozen_string_literal: true module Hyrax # An optional model to bring active record like accessors to your Valkyrie resources. This # is simply for simplicity in the console and backward compatibility. module ArResource extend ActiveSupport::Concern class_methods do ## # find a Valkyrie obj...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/work_behavior.rb
Ruby
apache-2.0
197
main
1,588
# frozen_string_literal: true module Hyrax module WorkBehavior extend ActiveSupport::Concern include Hydra::Works::WorkBehavior include HumanReadableType include Hyrax::Noid include Permissions include Serializers include Hydra::WithDepositor include HasRepresentative include HasRe...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/file_set_behavior.rb
Ruby
apache-2.0
197
main
1,299
# frozen_string_literal: true module Hyrax module FileSetBehavior extend ActiveSupport::Concern include Hyrax::WithEvents include Hydra::Works::FileSetBehavior include Hyrax::VirusCheck include Hyrax::FileSet::Characterization include Hydra::WithDepositor include Serializers include Hy...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/works/metadata.rb
Ruby
apache-2.0
197
main
263
# frozen_string_literal: true module Hyrax::Works module Metadata extend ActiveSupport::Concern included do property :arkivo_checksum, predicate: ::RDF::URI.new('http://scholarsphere.psu.edu/ns#arkivoChecksum'), multiple: false end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/solr_document/characterization.rb
Ruby
apache-2.0
197
main
3,062
# frozen_string_literal: true module Hyrax module SolrDocument module Characterization ## # @todo this might not be indexed normally. deprecate? def byte_order self["byte_order_tesim"] end ## # @todo this might not be indexed normally. deprecate? def capture_devi...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/solr_document/ordered_members.rb
Ruby
apache-2.0
197
main
1,872
# frozen_string_literal: true module Hyrax module SolrDocument ## # Decorates an object responding to `#id` with an `#ordered_member_ids` method. # # @note this decorator is intended for use with data representations other # than the core model objects, as an alternative to a direct query of the...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/solr_document/export.rb
Ruby
apache-2.0
197
main
1,738
# frozen_string_literal: true module Hyrax module SolrDocument module Export END_NOTE_MAPPINGS = { '%T' => [:title], '%A' => [:creator], '%C' => [:publication_place], '%D' => [:date_created], '%8' => [:date_uploaded], '%E' => [:contributor], ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/solr_document/metadata.rb
Ruby
apache-2.0
197
main
4,792
# frozen_string_literal: true module Hyrax module SolrDocument module Metadata extend ActiveSupport::Concern class_methods do def attribute(name, type, field) define_method name do type.coerce(self[field]) end end end module Solr cla...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/ability/resource_ability.rb
Ruby
apache-2.0
197
main
435
# frozen_string_literal: true module Hyrax module Ability module ResourceAbility def resource_abilities if admin? can [:manage], ::Hyrax::Resource else can [:edit, :update, :destroy], ::Hyrax::Resource do |res| test_edit(res.id) end can :re...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/ability/collection_ability.rb
Ruby
apache-2.0
197
main
2,510
# frozen_string_literal: true module Hyrax module Ability module CollectionAbility def collection_abilities # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity models = Hyrax::ModelRegistry.collection_classes if admin? ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/ability/flexible_metadata_ability.rb
Ruby
apache-2.0
197
main
240
# frozen_string_literal: true module Hyrax module Ability module FlexibleMetadataAbility def flexible_metadata_abilities can :manage, Hyrax::FlexibleSchema if admin? && Hyrax.config.flexible? end end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/ability/solr_document_ability.rb
Ruby
apache-2.0
197
main
455
# frozen_string_literal: true module Hyrax module Ability module SolrDocumentAbility def solr_document_abilities if admin? can [:manage], ::SolrDocument else can [:edit, :update, :destroy], ::SolrDocument do |solr_doc| test_edit(solr_doc.id) end ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/ability/admin_set_ability.rb
Ruby
apache-2.0
197
main
2,152
# frozen_string_literal: true module Hyrax module Ability module AdminSetAbility def admin_set_abilities # rubocop:disable Metrics/MethodLength, Metrics/AbcSize models = Hyrax::ModelRegistry.admin_set_classes if admin? can :manage, models can :manage_any, models ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/ability/collection_type_ability.rb
Ruby
apache-2.0
197
main
519
# frozen_string_literal: true module Hyrax module Ability module CollectionTypeAbility def collection_type_abilities if admin? can :manage, CollectionType can :create_collection_type, CollectionType else can :create_collection_of_type, CollectionType do |collect...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/ability/permission_template_ability.rb
Ruby
apache-2.0
197
main
608
# frozen_string_literal: true module Hyrax module Ability module PermissionTemplateAbility def permission_template_abilities if admin? can :manage, [Hyrax::PermissionTemplate, Hyrax::PermissionTemplateAccess] else can [:create, :edit, :update, :destroy], Hyrax::Permission...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/file_set/querying.rb
Ruby
apache-2.0
197
main
365
# frozen_string_literal: true module Hyrax class FileSet module Querying extend ActiveSupport::Concern module ClassMethods def where_digest_is(digest_string) where "digest_ssim" => urnify(digest_string) end def urnify(digest_string) "urn:sha1:#{digest_stri...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/file_set/indexing.rb
Ruby
apache-2.0
197
main
246
# frozen_string_literal: true module Hyrax class FileSet module Indexing extend ActiveSupport::Concern included do # the default indexing service self.indexer = Hyrax::FileSetIndexer end end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/file_set/belongs_to_works.rb
Ruby
apache-2.0
197
main
1,165
# frozen_string_literal: true module Hyrax class FileSet module BelongsToWorks extend ActiveSupport::Concern def parents in_works end # Returns the first parent object # This is a hack to handle things like FileSets inheriting access controls from their parent. (see Hyrax:...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/file_set/derivatives.rb
Ruby
apache-2.0
197
main
3,536
# frozen_string_literal: true module Hyrax class FileSet module Derivatives extend ActiveSupport::Concern included do # TODO: These should be moved to an initializer. However, there is a timing bug in place. # If the following Hydra::Derivatives configuration is moved to an init...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/file_set/characterization.rb
Ruby
apache-2.0
197
main
2,520
# frozen_string_literal: true module Hyrax class FileSet ## # This module points the FileSet to the location of the technical metadata. # By default, the file holding the metadata is +:original_file+ and the terms # are listed under +.characterization_terms+. # # Implementations may define th...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/permissions/readable.rb
Ruby
apache-2.0
197
main
460
# frozen_string_literal: true module Hyrax module Permissions module Readable extend ActiveSupport::Concern def public? read_groups.include?(Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC) end def registered? read_groups.include?(Hydra::AccessControls::Ac...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/concerns/hyrax/permissions/writable.rb
Ruby
apache-2.0
197
main
1,121
# frozen_string_literal: true module Hyrax module Permissions module Writable extend ActiveSupport::Concern # we're overriding the permissions= method which is in Hydra::AccessControls::Permissions include Hydra::AccessControls::Permissions include Hydra::AccessControls::Visibility ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/agent.rb
Ruby
apache-2.0
197
main
1,216
# frozen_string_literal: true module Sipity ## # A proxy for something that can take an action. # # * A User can be an agent # * A Group can be an agent (though Group is outside the scope of this system) class Agent < ActiveRecord::Base self.table_name = 'sipity_agents' ENTITY_LEVEL_AGENT_RELATIONS...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/workflow_responsibility.rb
Ruby
apache-2.0
197
main
880
# frozen_string_literal: true module Sipity # In what capacity can an agent act upon all entities for the given # Workflow # # This is an analogue to the Sipity::EntitySpecificResponsibility, but # the responsibility only applies to all entities for the given # Workflow # # @example # An Advisor for...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/workflow.rb
Ruby
apache-2.0
197
main
5,364
# frozen_string_literal: true module Sipity ## # A named workflow for processing an entity. Originally I had thought of # calling this a Type, but once I extracted the Processing submodule, # type felt to much of a noun, not conveying potentiality. Workflow # conveys "things will happen" because of this. cl...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/method.rb
Ruby
apache-2.0
197
main
1,185
# frozen_string_literal: true module Sipity # When a Sipity::Action is taken, each Sipity::Method is loaded and # it's service_name is instantiated and called (all of this done via # the Hyrax::Workflow::ActionTakenService). # # @note # When a user takes the "deposit a work" action, call the "Lookup # ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/workflow_role.rb
Ruby
apache-2.0
197
main
689
# frozen_string_literal: true module Sipity # For a given processing workflow, what roles have a part to play in # the processing? class WorkflowRole < ActiveRecord::Base self.table_name = 'sipity_workflow_roles' belongs_to :role, class_name: 'Sipity::Role' belongs_to :workflow, class_name: 'Sipity::...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/workflow_state_action_permission.rb
Ruby
apache-2.0
197
main
357
# frozen_string_literal: true module Sipity # Who can trigger this event? class WorkflowStateActionPermission < ActiveRecord::Base self.table_name = 'sipity_workflow_state_action_permissions' belongs_to :workflow_role, class_name: 'Sipity::WorkflowRole' belongs_to :workflow_state_action, class_name: 'Si...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/notification_recipient.rb
Ruby
apache-2.0
197
main
492
# frozen_string_literal: true module Sipity # Responsible for defining who receives what email and in what capacity # (eg to:, cc:, bcc:) class NotificationRecipient < ActiveRecord::Base self.table_name = 'sipity_notification_recipients' belongs_to :notification, class_name: 'Sipity::Notification' bel...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/entity_specific_responsibility.rb
Ruby
apache-2.0
197
main
844
# frozen_string_literal: true module Sipity # In what capacity can an agent act upon the given entity? # # This is an analogue to the Sipity::WorkflowResponsibility, but # the responsibility only applies to the given entity. # # @example # An Advisor for a given Student would have an # EntitySpecifi...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/workflow_action.rb
Ruby
apache-2.0
197
main
1,936
# frozen_string_literal: true module Sipity # A named thing that happens within the bounds of a :workflow. # # When a Sipity::WorkflowAction is taken, it may: # * Advance the state to a new Sipity::WorkflowState (as defined by # the :resulting_workflow_state relation) # * Deliver one or more notifications...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/comment.rb
Ruby
apache-2.0
197
main
672
# frozen_string_literal: true module Sipity # Represents a "comment" placed by the given :agent in regards to the give :entity class Comment < ActiveRecord::Base self.table_name = 'sipity_comments' belongs_to :agent, class_name: 'Sipity::Agent' belongs_to :entity, class_name: 'Sipity::Entity' def ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/entity.rb
Ruby
apache-2.0
197
main
2,646
# frozen_string_literal: true module Sipity ## # A proxy for the entity (e.g. a repository Object) that is being processed # via workflows. # # Objects of this class (and their underlying database records) represent # another object in the context of the workflow process. By using a proxy, # we can avoid ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/role.rb
Ruby
apache-2.0
197
main
1,690
# frozen_string_literal: true module Sipity # A role is a responsibility to do things. That is to take actions. It is # easy to conflate a person's role with the groups to which they belong. # A group is a set of people. The association of group with role # indicates that the set of people have the same respons...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/workflow_state_action.rb
Ruby
apache-2.0
197
main
468
# frozen_string_literal: true module Sipity # An actor can take the given action class WorkflowStateAction < ActiveRecord::Base self.table_name = 'sipity_workflow_state_actions' belongs_to :originating_workflow_state, class_name: 'Sipity::WorkflowState' belongs_to :workflow_action, class_name: 'Sipity::...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/notification.rb
Ruby
apache-2.0
197
main
944
# frozen_string_literal: true module Sipity # Responsible for defining a notification that is associated with a given # context; I believe the context is something that will be triggered via # an action however, I don't believe this needs to be a "hard" # relationship. It is instead a polymorphic relationship. ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/notifiable_context.rb
Ruby
apache-2.0
197
main
903
# frozen_string_literal: true module Sipity # A bridge for defining the "contexts" in which emails are sent. # # When an object enters a new state, we want to be able to define what are # the emails that should be sent. # # In Sipity this could be modeled by defining a NotifiableContext for a # WorkflowSt...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity/workflow_state.rb
Ruby
apache-2.0
197
main
1,027
# frozen_string_literal: true module Sipity # Throughout the workflow process, a processed entity may have numerous # states. class WorkflowState < ActiveRecord::Base self.table_name = 'sipity_workflow_states' belongs_to :workflow, class_name: 'Sipity::Workflow' has_many :originating_...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/strategies/hyrax/strategies/yaml_strategy.rb
Ruby
apache-2.0
197
main
867
# frozen_string_literal: true module Hyrax::Strategies class YamlStrategy < Flipflop::Strategies::AbstractStrategy class << self def default_description "Features configured by a YAML configuration file." end end def initialize(**options) @config_file = options.delete(:config) ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/channels/hyrax/notifications_channel.rb
Ruby
apache-2.0
197
main
317
# frozen_string_literal: true module Hyrax class NotificationsChannel < ApplicationCable::Channel def subscribed stream_for current_user end def unsubscribed stop_all_streams end def update_locale(data) current_user.update(preferred_locale: data['locale']) end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/channels/hyrax/application_cable/connection.rb
Ruby
apache-2.0
197
main
662
# frozen_string_literal: true module Hyrax module ApplicationCable class Connection < ActionCable::Connection::Base identified_by :current_user def connect self.current_user = find_verified_user end private def find_verified_user user = ::User.find_by(id: user_id) ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/migrate_resource_service.rb
Ruby
apache-2.0
197
main
1,728
# frozen_string_literal: true # migrates models from AF to valkyrie class MigrateResourceService attr_accessor :resource def initialize(resource:) @resource = resource end def model @model ||= Wings::ModelRegistry.lookup(resource.class).to_s end def call prep_resource Hyrax::Transactions:...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/child_types.rb
Ruby
apache-2.0
197
main
946
# frozen_string_literal: true module Hyrax ## # A list of child work types a user may choose to attach for a given work type # # These lists are used when users select among work types to attach to an # existing work, e.g. from Actions available on the show view. # # @example # child_types = Hyrax::C...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/resource_permissions_visibility_propagator.rb
Ruby
apache-2.0
197
main
1,758
# frozen_string_literal: true module Hyrax ## # Propagates visibility from a valkyrie Work to its FileSets class ResourcePermissionsVisibilityPropagator ## # @!attribute [rw] source # @return [#visibility] attr_accessor :source ## # @!attribute [r] embargo_manager # @return [Hyra...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/fixity_check_failure_service.rb
Ruby
apache-2.0
197
main
755
# frozen_string_literal: true module Hyrax class FixityCheckFailureService < AbstractMessageService attr_reader :log_date, :checksum_audit_log, :file_set def initialize(file_set, checksum_audit_log:) @file_set = file_set @checksum_audit_log = checksum_audit_log @log_date = checksum_audit_lo...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/license_service.rb
Ruby
apache-2.0
197
main
234
# frozen_string_literal: true module Hyrax # Provide select options for the license (dcterms:rights) field class LicenseService < QaSelectService def initialize(_authority_name = nil) super('licenses') end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/location_service.rb
Ruby
apache-2.0
197
main
822
# frozen_string_literal: true module Hyrax class LocationService < ::Qa::Authorities::Geonames CACHE_KEY_PREFIX = 'hyrax_geonames_label-v1-' CACHE_EXPIRATION = 1.week def full_label(uri) return if uri.blank? id = extract_id uri Rails.cache.fetch(cache_key(id), expires_in: CACHE_EXPIRATI...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/tolerant_select_service.rb
Ruby
apache-2.0
197
main
710
# frozen_string_literal: true module Hyrax ## # A more tolerant `QaSelectService`. This service treats terms with no # `active:` property as active terms, instead of erroring with `eKeyError`. class TolerantSelectService < QaSelectService ## # @return [Boolean] indicates whether the term is active; ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/abstract_message_service.rb
Ruby
apache-2.0
197
main
799
# frozen_string_literal: true module Hyrax class AbstractMessageService attr_reader :file_set, :user def initialize(file_set, user) @file_set = file_set @user = user end def call Hyrax::MessengerService.deliver(job_user, user, ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/persist_directly_contained_output_file_service.rb
Ruby
apache-2.0
197
main
2,997
# frozen_string_literal: true module Hyrax # This Service is an implementation of the Hydra::Derivatives::PersistOutputFileService # It supports directly contained files class PersistDirectlyContainedOutputFileService < Hydra::Derivatives::PersistBasicContainedOutputFileService # This method conforms to the s...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/institution.rb
Ruby
apache-2.0
197
main
229
# frozen_string_literal: true module Hyrax class Institution def self.name I18n.t('hyrax.institution_name') end def self.name_full I18n.t('hyrax.institution_name_full', default: name) end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/admin_set_member_service.rb
Ruby
apache-2.0
197
main
1,561
# frozen_string_literal: true module Hyrax ## # Responsible for retrieving admin set's members class AdminSetMemberService ## # @!attribute [r] collection # @return [::Collection] # @!attribute [r] params # @return [ActionController::Parameters] # @!attribute [r] scope # @return ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/thumbnail_path_service.rb
Ruby
apache-2.0
197
main
2,748
# frozen_string_literal: true module Hyrax class ThumbnailPathService class << self # @param [#id] object - to get the thumbnail for # @return [String] a path to the thumbnail def call(object) return default_image if object.try(:thumbnail_id).blank? thumb = fetch_thumbnail(objec...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/file_set_type_service.rb
Ruby
apache-2.0
197
main
1,569
# frozen_string_literal: true module Hyrax ## # Resolves file sets to a mime type. Provides a series of utility methods for # figuring out what a file set is all about. # # @note this service is for `Hyrax::FileSet` Valkyrie Resources. for # ActiveFedora file sets see Hydra::Works::MimeTypes class File...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/ensure_well_formed_admin_set_service.rb
Ruby
apache-2.0
197
main
951
# frozen_string_literal: true module Hyrax # This "service" ensures that we have a well formed AdminSet. # # @note For historical reasons, we lazily apply the default admin # set to curation concerns that don't already have an admin set. # # @see AdminSet # @see Hyrax::PermissionTemplate # @see Hyrax:...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/visibility_intention.rb
Ruby
apache-2.0
197
main
2,621
# frozen_string_literal: true module Hyrax ## # Provides tools for interpreting form input as a visibility. # # @since 3.0.0 class VisibilityIntention PUBLIC = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC PRIVATE = Hydra::AccessControls::AccessRight::VISIBILITY_TEX...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/iiif_authorization_service.rb
Ruby
apache-2.0
197
main
477
# frozen_string_literal: true module Hyrax class IiifAuthorizationService attr_reader :controller def initialize(controller) @controller = controller end # @note we ignore the `action` param here in favor of the `:show` action for all permissions def can?(_action, object) controller.c...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/import_url_failure_service.rb
Ruby
apache-2.0
197
main
269
# frozen_string_literal: true module Hyrax class ImportUrlFailureService < AbstractMessageService def message file_set.errors.full_messages.join(', ') end def subject I18n.t('hyrax.notifications.import_url_failure.subject') end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/flexible_schema_validator_service.rb
Ruby
apache-2.0
197
main
4,589
# frozen_string_literal: true module Hyrax class FlexibleSchemaValidatorService DEFAULT_SCHEMA = Hyrax::Engine.root.join('config', 'metadata_profiles', 'm3_json_schema.json') REQUIRED_CLASSES = [ Hyrax.config.admin_set_model, Hyrax.config.collection_model, Hyrax.config.file_set_model ]....
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/visibility_writer.rb
Ruby
apache-2.0
197
main
1,356
# frozen_string_literal: true module Hyrax ## # Sets ACLs from a visibility string # # @example # resource = Hyrax::Resource.new # writer = Hyrax::VisibilityWriter.new(resource: resource) # resource.read_groups # => [] # # writer.assign_access_for(visibility: 'open') # resource.read_gro...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/visibility_propagator.rb
Ruby
apache-2.0
197
main
1,674
# frozen_string_literal: true module Hyrax ## # @abstract Propagates visibility from a provided object (e.g. a Work) to some # group of its members (e.g. file_sets). class VisibilityPropagator ## # @param source [#visibility] the object to propagate visibility from # # @return [#propagate] ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/file_set_file_service.rb
Ruby
apache-2.0
197
main
2,866
# frozen_string_literal: true module Hyrax ## # A service for accessing {Hyrax::FileMetadata} resources by their status # within a {Hyrax::FileSet}. For example, this is the home for the abstraction # of a "Primary" file for the FileSet, used for versioning and as the default # source for the FileSet label, ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/analytics.rb
Ruby
apache-2.0
197
main
609
# frozen_string_literal: true module Hyrax module Analytics ## # a completely empty module to include if no parser is configured module NullAnalyticsParser; end def self.provider_parser "Hyrax::Analytics::#{Hyrax.config.analytics_provider.to_s.capitalize}".constantize rescue NameError => er...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/services/hyrax/change_depositor_service.rb
Ruby
apache-2.0
197
main
2,664
# frozen_string_literal: true module Hyrax class ChangeDepositorService # Set the given `user` as the depositor of the given `work`; If # `reset` is true, first remove all previous permissions. # # Used to transfer a an existing work, and to set # depositor / proxy_depositor on a work newly deposi...