Skip to content

Instantly share code, notes, and snippets.

@jambun
jambun / qsa.md
Created October 16, 2023 05:07
foooo

2023-10-13

things to demo for wp4 - restricted records:

  • ATL and IMPSS Security Level column renamed Access Classification

  • access classification on AO

    • 3 levels and null (Non-sensitive, Sensitive, Highly Sensitive)
  • inherited by PR/DR

unless RealtimeIndexing.respond_to?(:disable)
RealtimeIndexing.class_eval do
def self.disable(&block)
begin
Thread.current[:realtime_indexing_disabled] = true
block.call
ensure
Thread.current[:realtime_indexing_disabled] = false
end
end
RealtimeIndexing.class_eval do
def self.disable(&block)
begin
Thread.current[:realtime_indexing_disabled] = true
block.call
ensure
DB.after_commit do
Thread.current[:realtime_indexing_disabled] = false
end
end
RealtimeIndexing.class_eval do
def self.disable(&block)
Thread.current[:realtime_indexing_disabled] = true
block.call
# Thread.current[:realtime_indexing_disabled] = false
end
def self.record_update(target, uri)
unless Thread.current[:realtime_indexing_disabled]
@jambun
jambun / config.rb
Created June 18, 2020 01:07
aeon fulfillment config
AppConfig[:aeon_fulfillment] = {
"repo1" => {
:aeon_web_url => "https://aeon-1-dev.its.yale.edu/aeon.dll",
:aeon_external_system_id => "ArchivesSpace",
:request_in_new_tab => true,
:hide_button_for_access_restriction_types => ['RestrictedSpecColly'],
:aeon_site_code => 'MSS',
:requests_permitted_for_containers_only => true,
:hide_button_for_accessions => false,
:document_type_map => {
@jambun
jambun / rap.rb
Created April 17, 2020 04:38
worky but duplicated propagate logic
def self.attach_raps(model_class, ids, rap)
RAP.filter(:"#{model_class.table_name}_id" => ids).update(RAPs.supported_models.map {|model| [:"#{model.table_name}_id", nil]}.to_h)
model_class.filter(:id => ids).each do |obj|
RAP.create_from_json(JSONModel(:rap).from_hash(rap), {:"#{obj.class.table_name}_id" => obj.id})
obj.mark_as_system_modified
if obj.is_a?(ArchivalObject)
Resource.rap_needs_propagate(obj.root_record_id)
elsif obj.is_a?(Resource)
@jambun
jambun / rap.rb
Created April 17, 2020 04:03
plausible?
def self.attach_raps(model_class, ids, rap)
objs = model_class.filter(:id => ids).all
jsons = model_class.sequel_to_jsonmodel(objs)
RAP.filter(:"#{model_class.table_name}_id" => ids).update(RAPs.supported_models.map {|model| [:"#{model.table_name}_id", nil]}.to_h)
objs.zip(jsons).each do |obj, json|
json['rap_attached'] = rap.to_hash
RAP.create_from_json(JSONModel(:rap).from_hash(rap), {:"#{obj.class.table_name}_id" => obj.id})
@jambun
jambun / 003_add_revision.rb
Created April 8, 2020 00:40
this is very slow - can we make it faster?
Sequel.migration do
up do
alter_table(:history) do
add_column(:revision, Integer, :null => false, :default => 1)
end
revision = 1
last_version = false
@jambun
jambun / enumangler.rb
Last active August 29, 2015 14:20
enumangler
require 'net/http'
require 'json'
require 'uri'
require 'optparse'
class Enumangler
def initialize(opts)
@backend_url = URI.parse(opts[:backend_url])
@username = opts[:username]