Class: AdminSet
- Inherits:
-
ActiveFedora::Base
- Object
- ActiveFedora::Base
- AdminSet
- Includes:
- Hydra::AccessControls::Permissions, Hydra::PCDM::CollectionBehavior, Hyrax::HasRepresentative, Hyrax::HumanReadableType, Hyrax::Noid, Hyrax::Permissions
- Defined in:
- app/models/admin_set.rb
Overview
There is an interplay between an AdminSet and a PermissionTemplate. Given that AdminSet is an ActiveFedora::Base and PermissionTemplate is ActiveRecord::Base we don’t have the usual :has_many or :belongs_to methods to assist in defining that relationship. However, from a conceptual standpoint:
-
An AdminSet has_one :permission_tempate
-
A PermissionTemplate belongs_to :admin_set
When an object is added as a member of an AdminSet, the AdminSet’s associated PermissionTemplate is applied to that object (e.g. some of the object’s attributes are updated as per the rules of the permission template)
Constant Summary collapse
- DEFAULT_ID =
Hyrax::AdminSetCreateService::DEFAULT_ID
- DEFAULT_TITLE =
Hyrax::AdminSetCreateService::DEFAULT_TITLE
- DEFAULT_WORKFLOW_NAME =
Hyrax.config.default_active_workflow_name
Class Attributes collapse
Class Method Summary collapse
Instance Method Summary collapse
- #active_workflow ⇒ Sipity::Workflow
-
#assign_id ⇒ Object
return an id for the AdminSet.
- #collection_type_gid ⇒ Object
-
#permission_template ⇒ Hyrax::PermissionTemplate
A bit of an analogue for a ‘has_one :admin_set` as it crosses from Fedora to the DB.
- #to_rdf_representation ⇒ Object
- #to_s ⇒ Object
Methods included from Hyrax::Permissions::Readable
#private?, #public?, #registered?
Methods included from Hyrax::Permissions::Writable
Methods included from Hyrax::HumanReadableType
#human_readable_type, #to_solr
Methods inherited from ActiveFedora::Base
Instance Attribute Details
#internal_resource ⇒ String
38 |
# File 'app/models/admin_set.rb', line 38 class_attribute :internal_resource, default: "AdminSet" |
Class Method Details
.to_rdf_representation ⇒ Object
44 45 46 |
# File 'app/models/admin_set.rb', line 44 def self.to_rdf_representation internal_resource end |
Instance Method Details
#active_workflow ⇒ Sipity::Workflow
86 87 88 |
# File 'app/models/admin_set.rb', line 86 def active_workflow Sipity::Workflow.find_active_workflow_for(admin_set_id: id) end |
#assign_id ⇒ Object
return an id for the AdminSet. defaults to calling Hyrax::Noid, but needs a fall back if noid is off
94 95 96 |
# File 'app/models/admin_set.rb', line 94 def assign_id super || SecureRandom.uuid end |
#collection_type_gid ⇒ Object
65 66 67 68 |
# File 'app/models/admin_set.rb', line 65 def collection_type_gid # allow AdminSet to behave more like a regular Collection Hyrax::CollectionType.find_or_create_admin_set_type.to_global_id end |
#permission_template ⇒ Hyrax::PermissionTemplate
A bit of an analogue for a ‘has_one :admin_set` as it crosses from Fedora to the DB
78 79 80 |
# File 'app/models/admin_set.rb', line 78 def Hyrax::PermissionTemplate.find_by!(source_id: id) end |
#to_rdf_representation ⇒ Object
48 49 50 |
# File 'app/models/admin_set.rb', line 48 def to_rdf_representation internal_resource end |
#to_s ⇒ Object
70 71 72 |
# File 'app/models/admin_set.rb', line 70 def to_s title.presence || 'No Title' end |