From 3984c4edcacadeeb9f881e59b555d23dbd1867a3 Mon Sep 17 00:00:00 2001 From: Ben Pennell Date: Wed, 27 Nov 2024 12:36:34 -0500 Subject: [PATCH] BXC-4796 - Limit bulk download access (#1838) * Disentangling bulk download from file list to make it easier to get access to needed data * Styling updates to button * Limit zip download to authenticated or oncampus users. Server returns a property if the user has permission * Fix test * Fixing up style issues and getting more parts working with bulma 1.0 * Fix test and update readme * Convert search clearing links to buttons --- README.md | 2 +- .../auth/api/AccessPrincipalConstants.java | 1 + static/css/sass/cdr_ui_styles.scss | 36 +++------ .../src/assets/common-styles.css | 8 +- .../src/components/clearFacetsButton.vue | 17 +---- .../src/components/clearFilters.vue | 18 ++--- .../src/components/filterTags.vue | 64 ++++++---------- .../src/components/full_record/adminUnit.vue | 4 +- .../full_record/aggregateRecord.vue | 27 ++++--- .../components/full_record/bulkDownload.vue | 10 +-- .../full_record/collectionRecord.vue | 4 +- .../src/components/full_record/fileList.vue | 29 +------ .../components/full_record/folderRecord.vue | 4 +- .../full_record/restrictedContent.vue | 36 ++++----- .../components/full_record/singleUseLink.vue | 4 +- .../src/mixins/fileDownloadUtils.js | 10 +-- .../tests/unit/aggregateRecord.spec.js | 4 + .../tests/unit/bulkDownload.spec.js | 8 +- .../tests/unit/clearFilters.spec.js | 4 +- .../tests/unit/fileList.spec.js | 6 +- .../controllers/FullRecordController.java | 9 ++- .../auth/PatronActionPermissionsUtil.java | 34 +++++++++ .../auth/PatronActionPermissionsUtilTest.java | 75 +++++++++++++++++++ .../services/rest/DownloadBulkController.java | 18 +++-- .../rest/DownloadBulkControllerIT.java | 25 +++++-- 25 files changed, 264 insertions(+), 193 deletions(-) create mode 100644 web-common/src/main/java/edu/unc/lib/boxc/web/common/auth/PatronActionPermissionsUtil.java create mode 100644 web-common/src/test/java/edu/unc/lib/boxc/web/common/auth/PatronActionPermissionsUtilTest.java diff --git a/README.md b/README.md index 8968f1c3a3..5397b5837f 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ mvn -pl '!clamav-java' verify ### Running JavaScript tests ``` # JavaScript Tests -npm --prefix static/js/admin/vue-permissions-editor run test +npm --prefix static/js/admin/vue-cdr-admin run test npm --prefix static/js/vue-cdr-access run test ``` diff --git a/auth-api/src/main/java/edu/unc/lib/boxc/auth/api/AccessPrincipalConstants.java b/auth-api/src/main/java/edu/unc/lib/boxc/auth/api/AccessPrincipalConstants.java index 285d9714be..f73ccc9728 100644 --- a/auth-api/src/main/java/edu/unc/lib/boxc/auth/api/AccessPrincipalConstants.java +++ b/auth-api/src/main/java/edu/unc/lib/boxc/auth/api/AccessPrincipalConstants.java @@ -23,6 +23,7 @@ public class AccessPrincipalConstants { public final static String PATRON_NAMESPACE = "unc:patron:"; public final static String IP_PRINC_NAMESPACE = PATRON_NAMESPACE + "ipp:"; public final static String ADMIN_ACCESS_PRINC = "admin_access"; + public final static String ON_CAMPUS_PRINC = "unc:patron:ipp:on_campus"; public final static Pattern PATRON_PRINC_PATTERN = Pattern.compile("(" + PUBLIC_PRINC diff --git a/static/css/sass/cdr_ui_styles.scss b/static/css/sass/cdr_ui_styles.scss index db723669a0..05cb52e4e8 100644 --- a/static/css/sass/cdr_ui_styles.scss +++ b/static/css/sass/cdr_ui_styles.scss @@ -125,7 +125,7 @@ $box-shadow: inset 3px 3px 10px -1px $box-shadow-color, 0px 16px 22px -15px $box * **/ .search-query-text { - margin: 40px 20px 40px 25px; + margin: 40px 20px 20px 25px; font-size: 24px; h2 { @@ -147,13 +147,6 @@ form.search { } } -.browse-search { - .button.is-focused, - .button:focus { - color: #363636; - } -} - a.search-result-num { background-color: $container-blue; color: white !important; @@ -435,14 +428,18 @@ img.data-thumb { max-width: 60px; } -.child-records { - font-size: 16px; - margin: 30px 50px 25px 50px; +.file-list-header { + margin: 30px 0 5px; h3 { font-size: 16px; - margin-bottom: 30px; + margin: 0; + padding: 0; } +} + +.child-records { + font-size: 16px; .fa.default-img-icon { font-size: 32px; @@ -455,14 +452,6 @@ img.data-thumb { } } - .is-icon { - background-color: $container-blue; - border: 1px solid $container-blue; - border-radius: 5px; - color: white; - padding: 7px; - } - .no-download { background-color: #B8B8B8; border-color: #B8B8B8; @@ -822,11 +811,6 @@ table.dataTable { margin-bottom: 10px; } -.button.is-focused, -.button:focus { - color: white; -} - /* MODs display for work and file pages, plus modalMetadata.vue component */ #mods_data_display { margin: auto; @@ -1156,7 +1140,7 @@ iframe { .clover-viewer { margin: auto; - width: 90%; + width: 95%; } #information-toggle { diff --git a/static/js/vue-cdr-access/src/assets/common-styles.css b/static/js/vue-cdr-access/src/assets/common-styles.css index ddc2c1bf99..5906cf1c01 100644 --- a/static/js/vue-cdr-access/src/assets/common-styles.css +++ b/static/js/vue-cdr-access/src/assets/common-styles.css @@ -35,17 +35,13 @@ a.button.is-link span { background-color: white; } -.image-download-options button { +.button.is-primary { background-color: #1A698C; color: white; - font-family: 'Open Sans', sans-serif; - height: 48px; } -.image-download-options button:hover, -.image-download-options button:focus { +.button.is-primary:hover { background-color: #084b6b; - color: white; } .image-download-options a { diff --git a/static/js/vue-cdr-access/src/components/clearFacetsButton.vue b/static/js/vue-cdr-access/src/components/clearFacetsButton.vue index da3a775cfb..7f527f1d77 100644 --- a/static/js/vue-cdr-access/src/components/clearFacetsButton.vue +++ b/static/js/vue-cdr-access/src/components/clearFacetsButton.vue @@ -2,9 +2,9 @@ Button for clearing all currently active facets limiting the search. --> - - \ No newline at end of file + \ No newline at end of file diff --git a/static/js/vue-cdr-access/src/components/clearFilters.vue b/static/js/vue-cdr-access/src/components/clearFilters.vue index b999d161f3..d9cd1f1535 100644 --- a/static/js/vue-cdr-access/src/components/clearFilters.vue +++ b/static/js/vue-cdr-access/src/components/clearFilters.vue @@ -1,8 +1,10 @@