+++ /dev/null
-begin;
-
--- Create carousel data for all PINES libraries
-
--- create carousel for consortium
-insert into container.carousel (type, owner, name, creator, editor, age_filter, owning_lib_filter, max_items) select 5, id, 'New Items at PINES Libraries across Georgia', 1, 1, '1 mon', (select array(select id from actor.org_unit_descendants(id))), 50 from actor.org_unit where id = 1;
--- create carousels for each library/system
-insert into container.carousel (type, owner, name, creator, editor, age_filter, owning_lib_filter, max_items) select 5, id, 'New Items at ' || name, 1, 1, '6 mons', (select array(select id from actor.org_unit_descendants(id))), 50 from actor.org_unit where id <> 1 and opac_visible;
--- map the carousels to their units so they display
-insert into container.carousel_org_unit (carousel, org_unit, seq) select id, owner, 0 from container.carousel;
--- create buckets for each carousel
-insert into container.biblio_record_entry_bucket (owner, name, btype, pub, owning_lib) select 1, 'PINES-Created Bucket for carousel: ' || id, 'carousel', true, owner from container.carousel;
--- link the carousels to their buckets
-update container.carousel cc set bucket = (select id from container.biblio_record_entry_bucket b where b.owning_lib = cc.owner and b.btype = 'carousel');
--- add admin perms to GlobalAdmins
-insert into permission.grp_perm_map (grp, perm, depth) values ((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'ADMIN_CAROUSEL_TYPE'), 0);
-insert into permission.grp_perm_map (grp, perm, depth) values ((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'ADMIN_CAROUSEL'), 0);
-insert into permission.grp_perm_map (grp, perm, depth) values ((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'REFRESH_CAROUSEL'), 0);
-
--- add booking perms - done on production 2020-01-14
---insert into permission.grp_perm_map (grp, perm, depth, grantable) values
---((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESOURCE_TYPE'), 0, true),
---((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESOURCE'), 0, true),
---((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESOURCE_ATTR'), 0, true),
---((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESOURCE_ATTR_MAP'), 0, true),
---((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESOURCE_ATTR_VALUE'), 0, true),
---((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESERVATION'), 0, true),
---((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESERVATION_ATTR_MAP'), 0, true),
---((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESERVATION_ATTR_VALUE_MAP'), 0, true),
---((select id from permission.grp_tree where name = 'LocalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESOURCE'), 1, true),
---((select id from permission.grp_tree where name = 'LocalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESOURCE_ATTR'), 1, true),
---((select id from permission.grp_tree where name = 'LocalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESOURCE_ATTR_MAP'), 1, true),
---((select id from permission.grp_tree where name = 'LocalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESOURCE_ATTR_VALUE'), 1, true),
---((select id from permission.grp_tree where name = 'LocalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESERVATION'), 1, true),
---((select id from permission.grp_tree where name = 'LocalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESERVATION_ATTR_MAP'), 1, true),
---((select id from permission.grp_tree where name = 'LocalAdmin'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESERVATION_ATTR_VALUE_MAP'), 1, true),
---((select id from permission.grp_tree where name = 'LibraryManager'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESERVATION'), 2, true),
---((select id from permission.grp_tree where name = 'LibraryManager'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESERVATION_ATTR_MAP'), 2, true),
---((select id from permission.grp_tree where name = 'LibraryManager'), (select id from permission.perm_list where code = 'ADMIN_BOOKING_RESERVATION_ATTR_VALUE_MAP'), 2, true);
-
--- Add ILL circulation modifier
-
--- 14 day, no renewal, no holds, OPAC invisible
-
--- Fine: .20/day
-
--- we don't have a 14 day, no renewal duration rule
-insert into config.rule_circ_duration (
- name,
- extended,
- normal,
- shrt,
- max_renewals
- ) values (
- '14_days_0_renew',
- '14 days',
- '14 days',
- '14 days',
- 0
-);
--- create the circ modifier
-insert into config.circ_modifier (
- code,
- name,
- description,
- sip2_media_type
- ) values (
- 'ill-item',
- 'ILL item',
- 'ILL item',
- '001'
-);
--- create the circulation rule
-insert into config.circ_matrix_matchpoint (
- org_unit,
- grp,
- circ_modifier,
- ref_flag,
- circulate,
- duration_rule,
- recurring_fine_rule,
- max_fine_rule
- ) values (
- 1,
- 1,
- 'ill-item',
- false,
- true,
- (select id from config.rule_circ_duration where name = '14_days_0_renew'),
- (select id from config.rule_recurring_fine where name = '20_cent_per_day'),
- (select id from config.rule_max_fine where name = 'overdue_min')
-);
-
--- create a hold rule
-insert into config.hold_matrix_matchpoint (
- requestor_grp,
- holdable
- ) values (
- 1,
- false
-);
-
--- hopeless holds - delayed this because of concerning log errors
-
---INSERT into config.workstation_setting_type (name, grp, datatype, label)
---VALUES (
--- 'eg.grid.hopeless.wide_holds', 'gui', 'object',
--- oils_i18n_gettext(
--- 'eg.grid.hopeless.wide_holds',
--- 'Grid Config: hopeless.wide_holds',
--- 'cwst', 'label'
--- )
---);
---
---ALTER TABLE config.copy_status ADD COLUMN hopeless_prone BOOL NOT NULL DEFAULT FALSE; -- 002.schema.config.sql
---ALTER TABLE action.hold_request ADD COLUMN hopeless_date TIMESTAMP WITH TIME ZONE; -- 090.schema.action.sql
-
--- OpenAthens
-
-CREATE TABLE config.openathens_uid_field (
- id SERIAL PRIMARY KEY,
- name TEXT NOT NULL
-);
-
-INSERT INTO config.openathens_uid_field
- (id, name)
-VALUES
- (1,'id'),
- (2,'usrname')
-;
-
-SELECT SETVAL('config.openathens_uid_field_id_seq'::TEXT, 100);
-
-CREATE TABLE config.openathens_name_field (
- id SERIAL PRIMARY KEY,
- name TEXT NOT NULL
-);
-
-INSERT INTO config.openathens_name_field
- (id, name)
-VALUES
- (1,'id'),
- (2,'usrname'),
- (3,'fullname')
-;
-
-SELECT SETVAL('config.openathens_name_field_id_seq'::TEXT, 100);
-
-CREATE TABLE config.openathens_identity (
- id SERIAL PRIMARY KEY,
- active BOOL NOT NULL DEFAULT true,
- org_unit INT NOT NULL REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
- api_key TEXT NOT NULL,
- connection_id TEXT NOT NULL,
- connection_uri TEXT NOT NULL,
- auto_signon_enabled BOOL NOT NULL DEFAULT true,
- auto_signout_enabled BOOL NOT NULL DEFAULT false,
- unique_identifier INT NOT NULL REFERENCES config.openathens_uid_field (id) DEFAULT 1,
- display_name INT NOT NULL REFERENCES config.openathens_name_field (id) DEFAULT 1,
- release_prefix BOOL NOT NULL DEFAULT false,
- release_first_given_name BOOL NOT NULL DEFAULT false,
- release_second_given_name BOOL NOT NULL DEFAULT false,
- release_family_name BOOL NOT NULL DEFAULT false,
- release_suffix BOOL NOT NULL DEFAULT false,
- release_email BOOL NOT NULL DEFAULT false,
- release_home_ou BOOL NOT NULL DEFAULT false
-);
-
-INSERT INTO permission.perm_list ( id, code, description) VALUES
- ( 620, 'ADMIN_OPENATHENS', oils_i18n_gettext(620,
- 'Allow a user to administer OpenAthens authentication service', 'ppl', 'description'));
-
-INSERT INTO permission.grp_perm_map (grp, perm, depth) values ((select id from permission.grp_tree where name = 'GlobalAdmin'), 620, 0);
-
-commit;
-