From c45ff160ec4f4d8ce5ebafd36374ee3e6258aaac Mon Sep 17 00:00:00 2001 From: Brian Moses Hall Date: Mon, 8 Apr 2024 23:37:16 -0400 Subject: [PATCH] Addresses #148 Add Apache service for running CGI under Docker --- Dockerfile | 23 +++++- apache/000-default.conf | 73 +++++++++++++++++++ apache/apache.sh | 21 ++++++ apache/auth/000_none.conf | 1 + apache/auth/emergency_access_affiliate.conf | 8 ++ apache/auth/enhanced_text_user.conf | 8 ++ .../auth/ht_affiliate_hathitrust_member.conf | 8 ++ .../auth/ht_affiliate_umich_entitlement.conf | 9 +++ apache/auth/ht_affiliate_umich_member.conf | 10 +++ apache/auth/ht_total_user.conf | 8 ++ apache/auth/library_ipaddr_user.conf | 3 + apache/auth/ordinary_user_google.conf | 7 ++ apache/auth/ordinary_user_umich_friend.conf | 9 +++ apache/auth/ssd_proxy_user.conf | 8 ++ apache/auth/ssd_user.conf | 8 ++ cgi/CRMS.pm | 27 +++---- docker-compose.yml | 23 ++++++ docker/db/sql/001_crms_schema.sql | 2 +- docker/db/sql/001a_mysqlrep_schema.sql | 40 ++++++++++ docker/db/sql/006_crms_institutions.sql | 7 ++ docker/db/sql/007_crms_users.sql | 7 ++ docker/db/sql/008_crms_menus.sql | 11 +++ docker/db/sql/009_crms_menuitems.sql | 43 +++++++++++ 23 files changed, 345 insertions(+), 19 deletions(-) create mode 100644 apache/000-default.conf create mode 100755 apache/apache.sh create mode 100644 apache/auth/000_none.conf create mode 100644 apache/auth/emergency_access_affiliate.conf create mode 100644 apache/auth/enhanced_text_user.conf create mode 100644 apache/auth/ht_affiliate_hathitrust_member.conf create mode 100644 apache/auth/ht_affiliate_umich_entitlement.conf create mode 100644 apache/auth/ht_affiliate_umich_member.conf create mode 100644 apache/auth/ht_total_user.conf create mode 100644 apache/auth/library_ipaddr_user.conf create mode 100644 apache/auth/ordinary_user_google.conf create mode 100644 apache/auth/ordinary_user_umich_friend.conf create mode 100644 apache/auth/ssd_proxy_user.conf create mode 100644 apache/auth/ssd_user.conf create mode 100644 docker/db/sql/001a_mysqlrep_schema.sql create mode 100644 docker/db/sql/006_crms_institutions.sql create mode 100644 docker/db/sql/007_crms_users.sql create mode 100644 docker/db/sql/008_crms_menus.sql create mode 100644 docker/db/sql/009_crms_menuitems.sql diff --git a/Dockerfile b/Dockerfile index 14e4f47f..2e33e102 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:bullseye +FROM debian:bullseye AS crms-base RUN sed -i 's/main.*/main contrib non-free/' /etc/apt/sources.list @@ -167,3 +167,24 @@ RUN wget -O /usr/local/bin/wait-for https://github.com/eficode/wait-for/releases RUN mkdir -p $ROOTDIR COPY . $ROOTDIR WORKDIR $ROOTDIR + +FROM crms-base AS apache + +RUN apt-get -y install apache2 libapache2-mod-perl2 + +RUN a2dissite '*' +RUN a2disconf other-vhosts-access-log +RUN a2dismod 'mpm_*' +RUN a2enmod headers \ + mpm_prefork \ + rewrite \ + proxy \ + proxy_http \ + cgi + +COPY apache/000-default.conf /etc/apache2/sites-enabled +STOPSIGNAL SIGWINCH + +COPY apache/apache.sh / +RUN chmod +x /apache.sh +ENTRYPOINT ["/apache.sh"] diff --git a/apache/000-default.conf b/apache/000-default.conf new file mode 100644 index 00000000..a7dc9751 --- /dev/null +++ b/apache/000-default.conf @@ -0,0 +1,73 @@ +ServerName apache +ErrorLog /dev/stdout +CustomLog /dev/stdout combined +Listen 8080 + + + ServerAdmin hathitrust@localhost + DocumentRoot /htapps/babel + + LogLevel debug + ErrorLog /dev/stdout + CustomLog /dev/stdout combined + + RewriteEngine On + + ## SetEnv/SetEnvIf for environment variables + SetEnv SDRROOT /htapps/babel + SetEnv SDRDATAROOT /sdr1 + SetEnv ASSERTION_EMAIL hathitrust-system@umich.edu + SetEnv HT_DEV www-data + # SetEnv HT_IGNORE_GEOIP true + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + + ### CGI SCRIPTS + + + Options +ExecCGI + SetHandler cgi-script + + SetHandler cgi-script + + PassEnv CRMS_DB_HOST + PassEnv CRMS_DB_HOST_DEVELOPMENT + PassEnv CRMS_HT_DB_HOST + PassEnv CRMS_REMOTE_USER + + + + RewriteCond %{DOCUMENT_ROOT}/$1/web/$2 -f + RewriteRule ^/([^/]+)/(.*) /$1/web/$2 [last] + + RewriteCond %{DOCUMENT_ROOT}/$1/web/ -d + RewriteRule ^/([^/]+)/?$ /$1/web/ [last] + + RewriteCond %{DOCUMENT_ROOT}/$2/cgi/$3 -f + RewriteRule ^/(cgi)/([^/]+)/([^/]+)(.*)$ /$2/cgi/$3$4 [skip] + + RewriteCond %{DOCUMENT_ROOT}/$2/cgi/$2 -f + RewriteRule ^/(cgi)/([^/]+)(.*)$ /$2/cgi/$2$3 + + #RewriteCond %{DOCUMENT_ROOT}/$1/cgi/$3.choke -f + #RewriteRule ^/([^/]+)/(cgi)/([^/]+)(.*)$ /$1/cgi/$3.choke$4 [last] + + # If we matched one of the above CGI rules, but DIDN'T match the choke rule; + # we should now match this; this should ensure we don't then fall through to + # try the catalog rules. + RewriteCond %{DOCUMENT_ROOT}/$1/cgi/$3 -f + RewriteRule ^/([^/]+)/(cgi)/([^/]+)(.*)$ /$1/cgi/$3$4 [last] + + AliasMatch ^/favicon.ico$ /htapps/babel/firebird-common/dist/favicon.ico + + + ### AUTH + + IncludeOptional "auth/active_auth.conf" + + + diff --git a/apache/apache.sh b/apache/apache.sh new file mode 100755 index 00000000..79de3355 --- /dev/null +++ b/apache/apache.sh @@ -0,0 +1,21 @@ +#! /bin/bash + +# Apache gets grumpy about PID files pre-existing +if [ ! -d /tmp/apache2 ] +then + mkdir -p /tmp/apache2/{run,lock,log} +fi + +rm -f /tmp/apache2/apache2*.pid + +export APACHE_PID_FILE=/tmp/apache2/run/apache2.pid +export APACHE_RUN_DIR=/tmp/apache2/run +export APACHE_LOCK_DIR=/tmp/apache2/lock +export APACHE_LOG_DIR=/tmp/apache2/log + +# Won't be effective if we pass user from docker-compose; that's OK - hence +# shenanigans above +export APACHE_RUN_USER=www-data +export APACHE_RUN_GROUP=www-data + +exec apache2 -DFOREGROUND diff --git a/apache/auth/000_none.conf b/apache/auth/000_none.conf new file mode 100644 index 00000000..60d79964 --- /dev/null +++ b/apache/auth/000_none.conf @@ -0,0 +1 @@ +# none: no auth headers diff --git a/apache/auth/emergency_access_affiliate.conf b/apache/auth/emergency_access_affiliate.conf new file mode 100644 index 00000000..e8ea3087 --- /dev/null +++ b/apache/auth/emergency_access_affiliate.conf @@ -0,0 +1,8 @@ +# emergency_access_affiliate: user with institution with ETAS enabled +SetEnv AUTH_TYPE shibboleth +SetEnv REMOTE_USER testuser@etas.example +SetEnv Shib_Identity_Provider https://idp.etas.example/ +SetEnv affiliation member@etas.example +SetEnv displayName "ETAS Testuser" +SetEnv email testuser@etas.example +SetEnv eppn testuser@etas.example diff --git a/apache/auth/enhanced_text_user.conf b/apache/auth/enhanced_text_user.conf new file mode 100644 index 00000000..82a6542a --- /dev/null +++ b/apache/auth/enhanced_text_user.conf @@ -0,0 +1,8 @@ +# enhanced_text_user: user with affiliation member@nfb.org +SetEnv AUTH_TYPE shibboleth +SetEnv REMOTE_USER nfbuser@nfb.org +SetEnv Shib_Identity_Provider pumex-idp +SetEnv affiliation member@nfb.org +SetEnv displayName "NFB User" +SetEnv email nfbuser@nfb.org +SetEnv eppn nfbuser@nfb.org diff --git a/apache/auth/ht_affiliate_hathitrust_member.conf b/apache/auth/ht_affiliate_hathitrust_member.conf new file mode 100644 index 00000000..a988dabe --- /dev/null +++ b/apache/auth/ht_affiliate_hathitrust_member.conf @@ -0,0 +1,8 @@ +# ht_affiliate: hathitrust user with eduPersonScopedAffiliation member@umich.edu +SetEnv AUTH_TYPE shibboleth +SetEnv REMOTE_USER testuser@hathitrust.org +SetEnv Shib_Identity_Provider https://idp.hathitrust.org/entity +SetEnv affiliation member@hathitrust.org +SetEnv displayName "HathiTrust Testuser" +SetEnv email testuser@hathitrust.org +SetEnv eppn testuser@hathitrust.org diff --git a/apache/auth/ht_affiliate_umich_entitlement.conf b/apache/auth/ht_affiliate_umich_entitlement.conf new file mode 100644 index 00000000..82d034e4 --- /dev/null +++ b/apache/auth/ht_affiliate_umich_entitlement.conf @@ -0,0 +1,9 @@ +# ht_affiliate: umich user with common-lib-terms entitlement & no affiliation +SetEnv AUTH_TYPE shibboleth +SetEnv REMOTE_USER https://shibboleth.umich.edu/idp/shibboleth!http://www.hathitrust.org/shibboleth-sp!dW1pY2h0ZXN0dXNlcg== +SetEnv Shib_Identity_Provider https://shibboleth.umich.edu/idp/shibboleth +SetEnv displayName "Umich Test-Entitlement" +SetEnv email entitlement@umich.edu +SetEnv entitlement urn:mace:dir:entitlement:common-lib-terms +SetEnv eppn entitlement@umich.edu +SetEnv persistent_id https://shibboleth.umich.edu/idp/shibboleth!http://www.hathitrust.org/shibboleth-sp!dW1pY2h0ZXN0dXNlcg== diff --git a/apache/auth/ht_affiliate_umich_member.conf b/apache/auth/ht_affiliate_umich_member.conf new file mode 100644 index 00000000..1ec67a6b --- /dev/null +++ b/apache/auth/ht_affiliate_umich_member.conf @@ -0,0 +1,10 @@ +# ht_affiliate: umich user with eduPersonScopedAffiliation member@umich.edu +SetEnv AUTH_TYPE shibboleth +SetEnv REMOTE_USER https://shibboleth.umich.edu/idp/shibboleth!http://www.hathitrust.org/shibboleth-sp!dW1pY2h0ZXN0dXNlcg== +SetEnv umichCosignFactor UMICH.EDU +SetEnv Shib_Identity_Provider https://shibboleth.umich.edu/idp/shibboleth +SetEnv affiliation member@umich.edu +SetEnv displayName "Umich Testuser" +SetEnv email testuser@umich.edu +SetEnv eppn testuser@umich.edu +SetEnv persistent_id https://shibboleth.umich.edu/idp/shibboleth!http://www.hathitrust.org/shibboleth-sp!dW1pY2h0ZXN0dXNlcg== diff --git a/apache/auth/ht_total_user.conf b/apache/auth/ht_total_user.conf new file mode 100644 index 00000000..0ea0b4c5 --- /dev/null +++ b/apache/auth/ht_total_user.conf @@ -0,0 +1,8 @@ +# ht_total_user: REMOTE_USER matches user in ht_users with ht_users.access=total +SetEnv AUTH_TYPE shibboleth +SetEnv REMOTE_USER totaluser@hathitrust.org +SetEnv Shib_Identity_Provider https://idp.hathitrust.org/entity +SetEnv affiliation member@hathitrust.org +SetEnv displayName "HathiTrust Totaluser" +SetEnv email totaluser@hathitrust.org +SetEnv eppn totaluser@hathitrust.org diff --git a/apache/auth/library_ipaddr_user.conf b/apache/auth/library_ipaddr_user.conf new file mode 100644 index 00000000..98008214 --- /dev/null +++ b/apache/auth/library_ipaddr_user.conf @@ -0,0 +1,3 @@ +# library_ipaddr_user: "in-library' user - SDRINST and SDRLIB both non-blank +SetEnv SDRINST umich +SetEnv SDRLIB umich diff --git a/apache/auth/ordinary_user_google.conf b/apache/auth/ordinary_user_google.conf new file mode 100644 index 00000000..d6a59aae --- /dev/null +++ b/apache/auth/ordinary_user_google.conf @@ -0,0 +1,7 @@ +# ordinary user: user with Google login +SetEnv AUTH_TYPE shibboleth +SetEnv REMOTE_USER 999999@google.com +SetEnv Shib_Identity_Provider https://google.cirrusidentity.com/gateway +SetEnv displayName "Google Testuser" +SetEnv email google.testuser@gmail.com +SetEnv eppn 999999@google.com diff --git a/apache/auth/ordinary_user_umich_friend.conf b/apache/auth/ordinary_user_umich_friend.conf new file mode 100644 index 00000000..c38cd865 --- /dev/null +++ b/apache/auth/ordinary_user_umich_friend.conf @@ -0,0 +1,9 @@ +# ordinary_user: umich friend account +SetEnv AUTH_TYPE shibboleth +SetEnv REMOTE_USER https://shibboleth.umich.edu/idp/shibboleth!http://www.hathitrust.org/shibboleth-sp!dW1pY2hmcmllbmQ= +SetEnv umichCosignFactor friend +SetEnv Shib_Identity_Provider https://shibboleth.umich.edu/idp/shibboleth +SetEnv displayName "Umich Friend" +SetEnv email umichfriend@whatever.example +SetEnv eppn umichfriend+whatever.example@umich.edu +SetEnv persistent_id https://shibboleth.umich.edu/idp/shibboleth!http://www.hathitrust.org/shibboleth-sp!dW1pY2hmcmllbmQ= diff --git a/apache/auth/ssd_proxy_user.conf b/apache/auth/ssd_proxy_user.conf new file mode 100644 index 00000000..31ece2e1 --- /dev/null +++ b/apache/auth/ssd_proxy_user.conf @@ -0,0 +1,8 @@ +# ssd_proxy_user: REMOTE_USER matches user in ht_users with ht_users.role=ssdproxy +SetEnv AUTH_TYPE shibboleth +SetEnv REMOTE_USER ssdproxy@hathitrust.org +SetEnv Shib_Identity_Provider https://idp.hathitrust.org/entity +SetEnv affiliation member@hathitrust.org +SetEnv displayName "HathiTrust Ssdproxy" +SetEnv email ssdproxy@hathitrust.org +SetEnv eppn ssdproxy@hathitrust.org diff --git a/apache/auth/ssd_user.conf b/apache/auth/ssd_user.conf new file mode 100644 index 00000000..20fa142d --- /dev/null +++ b/apache/auth/ssd_user.conf @@ -0,0 +1,8 @@ +# ssd_user: REMOTE_USER matches user in ht_users with ht_users.role=ssd +SetEnv AUTH_TYPE shibboleth +SetEnv REMOTE_USER ssduser@hathitrust.org +SetEnv Shib_Identity_Provider https://idp.hathitrust.org/entity +SetEnv affiliation member@hathitrust.org +SetEnv displayName "HathiTrust Ssduser" +SetEnv email ssduser@hathitrust.org +SetEnv eppn ssduser@hathitrust.org diff --git a/cgi/CRMS.pm b/cgi/CRMS.pm index 4759c10e..aca775ff 100755 --- a/cgi/CRMS.pm +++ b/cgi/CRMS.pm @@ -52,15 +52,20 @@ sub new $self->ClearErrors(); $self->set('verbose', $args{'verbose'}); # Only need to authorize when running as CGI. - if ($ENV{'GATEWAY_INTERFACE'}) - { + if ($ENV{'GATEWAY_INTERFACE'}) { $CGI::LIST_CONTEXT_WARN = 0; my $cgi = $args{'cgi'}; print "Warning: no CGI passed to CRMS->new()\n" unless $cgi; $self->set('cgi', $cgi); $self->set('debugSql', $args{'debugSql'}); $self->set('debugVar', $args{'debugVar'}); - $self->SetupUser(); + if ($ENV{CRMS_REMOTE_USER}) { + #print STDERR "CRMS_REMOTE_USER\n"; + $self->set('user', $ENV{CRMS_REMOTE_USER}); + $self->set('remote_user', $ENV{CRMS_REMOTE_USER}); + } else { + $self->SetupUser(); + } } $self->DebugVar('self', $self); return $self; @@ -6091,16 +6096,10 @@ sub GetUserIPs my $sql = 'SELECT iprestrict,mfa FROM ht_users WHERE userid=? OR email=?'. ' ORDER BY IF(role="crms",1,0) DESC'; - my $sdr_dbh = $self->get('ht_repository'); - if (!defined $sdr_dbh) - { - $sdr_dbh = $self->ConnectToSdrDb('ht_repository'); - $self->set('ht_repository', $sdr_dbh) if defined $sdr_dbh; - } my ($ipr, $mfa); my $t1 = Time::HiRes::time(); eval { - my $ref = $sdr_dbh->selectall_arrayref($sql, undef, $user, $user); + my $ref = $self->SelectAllSDR($sql, $user, $user); my $t2 = Time::HiRes::time(); $self->DebugSql($sql, 1000.0*($t2-$t1), $ref, 'ht_repository', $user, $user); $ipr = $ref->[0]->[0]; @@ -6173,14 +6172,8 @@ sub IsUserExpired ' FROM ht_users WHERE userid=? OR email=?'. ' ORDER BY IF(role="crms",1,0) DESC'; #print "$sql
\n"; - my $sdr_dbh = $self->get('ht_repository'); - if (!defined $sdr_dbh) - { - $sdr_dbh = $self->ConnectToSdrDb('ht_repository'); - $self->set('ht_repository', $sdr_dbh) if defined $sdr_dbh; - } eval { - my $ref = $sdr_dbh->selectall_arrayref($sql, undef, $user, $user); + my $ref = $self->SelectAllSDR($sql, $user, $user); $data{'expires'} = $ref->[0]->[0]; $data{'status'} = $ref->[0]->[1]; $data{'days'} = $ref->[0]->[2]; diff --git a/docker-compose.yml b/docker-compose.yml index 8063b122..5268348e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,29 @@ services: ports: - 3307:3306 + apache: + build: + context: . + target: apache + user: ${CURRENT_USER} + volumes: + - .:/htapps/babel/crms + - ./apache/000-default.conf:/etc/apache2/sites-enabled/000-default.conf + - ./apache/auth:/etc/apache2/auth + environment: + SDRROOT: /htapps/babel + CRMS_DB_HOST: mariadb + CRMS_DB_HOST_DEVELOPMENT: mariadb + CRMS_HT_DB_HOST: mariadb_ht + CRMS_REMOTE_USER: autocrms + depends_on: + - mariadb + - mariadb_ht + ports: + - "8080:8080" + - "5173:5173" + - "8173:8173" + test: build: . volumes: diff --git a/docker/db/sql/001_crms_schema.sql b/docker/db/sql/001_crms_schema.sql index b16e1e0c..256b457f 100644 --- a/docker/db/sql/001_crms_schema.sql +++ b/docker/db/sql/001_crms_schema.sql @@ -728,7 +728,7 @@ CREATE TABLE `institutions` ( `suffix` varchar(31) DEFAULT NULL, `report` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=105 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- diff --git a/docker/db/sql/001a_mysqlrep_schema.sql b/docker/db/sql/001a_mysqlrep_schema.sql new file mode 100644 index 00000000..29df3184 --- /dev/null +++ b/docker/db/sql/001a_mysqlrep_schema.sql @@ -0,0 +1,40 @@ +CREATE DATABASE IF NOT EXISTS mysqlrep; +USE mysqlrep; + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `delay` +-- + +DROP TABLE IF EXISTS `delay`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `delay` ( + `client` varchar(32) NOT NULL, + `seconds` int(11) DEFAULT NULL, + `time` timestamp /* mariadb-5.3 */ NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`client`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +GRANT ALL PRIVILEGES ON `mysqlrep`.* TO 'crms'@'%' IDENTIFIED BY 'crms'; diff --git a/docker/db/sql/006_crms_institutions.sql b/docker/db/sql/006_crms_institutions.sql new file mode 100644 index 00000000..0913f9f4 --- /dev/null +++ b/docker/db/sql/006_crms_institutions.sql @@ -0,0 +1,7 @@ +use crms; + +LOCK TABLES `institutions` WRITE; +/*!40000 ALTER TABLE `institutions` DISABLE KEYS */; +INSERT INTO `institutions` VALUES (0,'University of Michigan','UM','umich.edu',0); +/*!40000 ALTER TABLE `institutions` ENABLE KEYS */; +UNLOCK TABLES; diff --git a/docker/db/sql/007_crms_users.sql b/docker/db/sql/007_crms_users.sql new file mode 100644 index 00000000..dc591d4c --- /dev/null +++ b/docker/db/sql/007_crms_users.sql @@ -0,0 +1,7 @@ +use crms; + +LOCK TABLES `users` WRITE; +/*!40000 ALTER TABLE `users` DISABLE KEYS */; +INSERT INTO `users` VALUES ('autocrms',NULL,'Default User',1,1,1,1,NULL,'',1,NULL,NULL); +/*!40000 ALTER TABLE `users` ENABLE KEYS */; +UNLOCK TABLES; diff --git a/docker/db/sql/008_crms_menus.sql b/docker/db/sql/008_crms_menus.sql new file mode 100644 index 00000000..02971a30 --- /dev/null +++ b/docker/db/sql/008_crms_menus.sql @@ -0,0 +1,11 @@ +USE crms; + +LOCK TABLES `menus` WRITE; +/*!40000 ALTER TABLE `menus` DISABLE KEYS */; +INSERT INTO `menus` VALUES (0,'Review','minor',NULL,0,NULL), + (1,'Search/Browse','major',NULL,1,NULL), + (2,'Documentation','total',NULL,2,1), + (3,'Stats/Reports','orange',NULL,3,NULL), + (4,'Administrative','red',NULL,4,NULL); +/*!40000 ALTER TABLE `menus` ENABLE KEYS */; +UNLOCK TABLES; diff --git a/docker/db/sql/009_crms_menuitems.sql b/docker/db/sql/009_crms_menuitems.sql new file mode 100644 index 00000000..f2c628c4 --- /dev/null +++ b/docker/db/sql/009_crms_menuitems.sql @@ -0,0 +1,43 @@ +USE crms; + +LOCK TABLES `menuitems` WRITE; +/*!40000 ALTER TABLE `menuitems` DISABLE KEYS */; +INSERT INTO `menuitems` VALUES + (0,'Review','crms?p=review','review','r',NULL,0), + (0,'Provisional Matches','crms?p=provisionals','undReviews','e',NULL,1), + (0,'Conflicts','crms?p=conflicts','expert','e',NULL,2), + (0,'My Unprocessed Reviews','crms?p=editReviews','editReviews','r',NULL,3), + (0,'My Held Reviews','crms?p=holds','holds','r',NULL,4), + (0,'Automatic Rights Inheritance','crms?p=inherit;auto=1','inherit','ea',NULL,5), + (0,'Rights Inheritance Pending Ppproval','crms?p=inherit;auto=0','inherit','ea',NULL,6), + (1,'Historical Reviews','crms?p=adminHistoricalReviews','adminHistoricalReviews',NULL,NULL,0), + (1,'Active Reviews','crms?p=adminReviews','adminReviews','eax',NULL,1), + (1,'All Held Reviews','crms?p=adminHolds','adminHolds','ea',NULL,2), + (1,'Queue','/crms/queue','queue','ea',NULL,3), + (1,'Final Determinations','crms?p=exportData','exportData','ea',NULL,4), + (1,'Candidates','crms?p=candidates','candidates','ea',NULL,5), + (1,'Filtered Volumes','crms?p=und','und','ea',NULL,6), + (2,'CRMS Documentation','https://www.hathitrust.org/CRMSdocumentation',NULL,NULL,'_blank',1), + (2,'Review Search Help','/crms/web/pdf/ReviewSearchHelp.pdf',NULL,NULL,'_blank',7), + (2,'Review Search Terms','/crms/web/pdf/ReviewSearchTerms.pdf',NULL,NULL,'_blank',8), + (2,'User Levels/Privileges','/crms/web/pdf/UserLevelsPrivileges.pdf',NULL,'a','_blank',12), + (2,'System-Generated Reviews','/crms/web/pdf/SystemGeneratedReviews.pdf',NULL,'a','_blank',14), + (2,'CRMS Status Codes','/crms/web/pdf/CRMSStatusCodes.pdf',NULL,'a','_blank',15), + (3,'My Review Stats','crms?p=userRate','userRate','r',NULL,1), + (3,'All Review Stats','crms?p=adminUserRate','adminUserRate','ea',NULL,2), + (3,'System Summary','crms?p=queueStatus','queueStatus','ea',NULL,8), + (3,'Export Stats','crms?p=exportStats','exportStats','ea',NULL,9), + (4,'User Accounts','/crms/users','adminUser','eai',NULL,1), + (4,'Institutions','crms?p=institutions','institutions','a',NULL,2), + (4,'Query Rights Database','crms?p=rights','rights',NULL,NULL,3), + (4,'Query Bibliographic Rights','crms?p=bib_rights','rights',NULL,NULL,3), + (4,'Track Volumes','crms?p=track','track',NULL,NULL,4), + (4,'All Locked Volumes','crms?p=adminQueue','adminQueue','ea',NULL,5), + (4,'Add to Queue','/crms/queue/new','queueAdd','ea',NULL,6), + (4,'Set System Status','crms?p=systemStatus','systemStatus','ea',NULL,7), + (4,'System Administration','crms?p=debug','debug','s',NULL,8), + (4,'Projects','crms?p=projects','projects','a',NULL,9), + (4,'Keio Data','crms?p=keio','keio','a',NULL,10), + (4,'Licensing','crms?p=licensing','licensing','a',NULL,11); +/*!40000 ALTER TABLE `menuitems` ENABLE KEYS */; +UNLOCK TABLES;