grant [permission], to: [grantees] -> result
permission - Symbol (required) - one of [:discover|:read|:edit]
#!/usr/bin/env ruby | |
require 'yaml' | |
data = YAML.load(STDIN.read) | |
kind = data['kind'] | |
# status | |
if kind == 'Route' |
<foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true"> | |
<foxml:datastreamVersion ID="RELS-EXT.0" LABEL="Fedora Object-to-Object Relationship Metadata" CREATED="2014-01-27T19:33:31.713Z" MIMETYPE="application/rdf+xml" SIZE="411"> | |
<foxml:contentDigest TYPE="SHA-256" DIGEST="dc9dd47194e9e6796ca727b232d1b597afde15c430b0777c2a4e1defa5f4f3ea"/> | |
<foxml:xmlContent> | |
<rdf:RDF xmlns:ns0="http://projecthydra.org/ns/relations#" xmlns:ns1="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> | |
<rdf:Description rdf:about="info:fedora/duke:1556"> | |
<ns0:isGovernedBy rdf:resource="info:fedora/duke:1555"/> | |
<ns1:hasModel rdf:resource="info:fedora/afmodel:Collection"/> | |
</rdf:Description> | |
</rdf:RDF> |
scope :in_collection, ->(collection) { | |
where(Ddr::Index::Fields::IS_MEMBER_OF_COLLECTION => collection.respond_to?(:id) ? collection.id : collection) | |
} | |
scope :having_local_id, ->(local_id) { | |
where(Ddr::Index::Fields::LOCAL_ID => local_id) | |
} | |
def self.having_local_id!(local_id) | |
results = having_local_id(local_id).to_a | |
if results.size > 1 |
ActiveSupport::Concern.module_eval do | |
WARNINGS = [ | |
"Are you sure you want to this?", | |
"Come on, now, really?", | |
"Time to refactor?", | |
"Read http://blog.coreyhaines.com/2012/12/why-i-dont-use-activesupportconcern.html ?", | |
"Please don't do this without a good reason.", | |
"No, chunking your mega-class is not a good reason.", | |
"What objects are you trying to hide?", |
def get_objects_for_solr_field_values(solr_field, values, opts = {}) | |
extra_solr_params = opts.delete(:extra_solr_params) || {} | |
documents = get_solr_response_for_field_values(solr_field, values, extra_solr_params)[1] | |
method = opts.delete(:lazy) ? :lazy_reify_solr_results : :reify_solr_results | |
ActiveFedora::SolrService.send(method, documents, opts) | |
end |
require "virtus" | |
# BEFORE | |
class Filter | |
attr_accessor :clauses | |
def initialize(clauses = nil) | |
@clauses = Array(clauses) | |
end | |
end |
ACTIVE = 'A' | |
INACTIVE = 'I' | |
DELETED = 'D' | |
def active? | |
dsState == ACTIVE | |
end | |
def inactive? | |
dsState == INACTIVE |
ActiveFedora::Base.class_eval do | |
# method_missing is defined, so adding methods | |
def auditable? | |
begin | |
self.is_a? ActiveFedora::Auditable | |
rescue | |
false | |
end |
module ActiveFedora | |
module Autoversion | |
def self.included(base) | |
base.class_eval do | |
after_save :create_version | |
end | |
end | |
end | |
end |