class Collection
A Collection
is a conceptual and administrative entity containing a set of items.
Public Instance Methods
components_from_solr()
click to toggle source
Returns the SolrDocuments for Components associated with the Collection
.
@return A lazy enumerator of SolrDocuments.
# File app/models/collection.rb, line 25 def components_from_solr query = "#{Ddr::Index::Fields::COLLECTION_URI}:#{RSolr.solr_escape(id)}" filter = ActiveFedora::SolrQueryBuilder.construct_query_for_rel(:has_model => Component.to_class_uri) results = ActiveFedora::SolrService.query(query, fq: filter, rows: 100000) results.lazy.map {|doc| SolrDocument.new(doc)} end
default_entities_for_permission(type, access)
click to toggle source
Returns a list of entities (either users or groups) having a default access level on objects governed by the Collection
.
@param type [String] the type of entity, “user” or “group”. @param access [String] the default access level, “discover”, “read”, or “edit”. @return [Array<String>] the entities (users or groups)
# File app/models/collection.rb, line 38 def default_entities_for_permission(type, access) default_permissions.collect { |p| p[:name] if p[:type] == type and p[:access] == access }.compact end
grant_roles_to_creator(creator)
click to toggle source
# File app/models/collection.rb, line 48 def grant_roles_to_creator(creator) roles.grant role_type: Ddr::Auth::Roles::CURATOR, agent: creator.agent, scope: Ddr::Auth::Roles::RESOURCE_SCOPE roles.grant role_type: Ddr::Auth::Roles::CURATOR, agent: creator.agent, scope: Ddr::Auth::Roles::POLICY_SCOPE end
publishable?()
click to toggle source
# File app/models/collection.rb, line 57 def publishable? true end
Private Instance Methods
set_admin_policy()
click to toggle source
# File app/models/collection.rb, line 63 def set_admin_policy self.admin_policy = self save end