From a45dbaeba380b98908ed8e0bbf58113787ef49e9 Mon Sep 17 00:00:00 2001 From: mk-pmb Date: Sat, 27 Apr 2024 01:19:30 +0200 Subject: [PATCH] [docs] Simplify configs by using serviceType and more INHERITS. --- docs/cfg/ubhd-ex01/README.md | 12 +++++ .../ubhd-ex01/acl_chains/logged_in_users.yaml | 30 ++---------- docs/cfg/ubhd-ex01/acl_chains/main.yaml | 2 + ...readers.yaml => doi_request_watchers.yaml} | 2 +- docs/cfg/ubhd-ex01/custom_data/svctpl.yaml | 49 +++++++++++++++++++ docs/cfg/ubhd-ex01/services/0_defaults.yaml | 39 +++++++++++++++ .../services/anno-frontend-tests.yaml | 3 +- docs/cfg/ubhd-ex01/services/diglit.yaml | 35 ++----------- docs/cfg/ubhd-ex01/services/hadw-bw-digi.yaml | 13 +++++ docs/cfg/ubhd-ex01/services/journals.yaml | 9 +--- .../ubhd-ex01/services/klorsch-archiv.yaml | 6 +-- docs/cfg/ubhd-ex01/services/klorsch-bib.yaml | 6 +-- docs/cfg/ubhd-ex01/users/0_guess_author.yaml | 2 +- docs/cfg/ubhd-ex01/users/0_mgr.yaml | 2 +- docs/cfg/ubhd-ex01/users/arno.yaml | 4 +- 15 files changed, 135 insertions(+), 79 deletions(-) rename docs/cfg/ubhd-ex01/acl_user_groups/{diglit_proofreaders.yaml => doi_request_watchers.yaml} (77%) create mode 100644 docs/cfg/ubhd-ex01/custom_data/svctpl.yaml create mode 100644 docs/cfg/ubhd-ex01/services/0_defaults.yaml create mode 100644 docs/cfg/ubhd-ex01/services/hadw-bw-digi.yaml diff --git a/docs/cfg/ubhd-ex01/README.md b/docs/cfg/ubhd-ex01/README.md index 72901ca..fb5f976 100644 --- a/docs/cfg/ubhd-ex01/README.md +++ b/docs/cfg/ubhd-ex01/README.md @@ -26,6 +26,18 @@ Structure This will be explained below in section "Config merging". + +Config fragments +---------------- + +* In some places, configs can __inherit fragments__ from files in the + `custom_data` topic by specifying a key named `INHERITS` which must + be a string or a list of strings. Each string is a __fragment path__, + specified using the [`objdive` path syntax](https://npm.im/objdive). + The first path segment refers to an entry name in the `custom_data` topic. + + + Available config topics ----------------------- diff --git a/docs/cfg/ubhd-ex01/acl_chains/logged_in_users.yaml b/docs/cfg/ubhd-ex01/acl_chains/logged_in_users.yaml index 67fcb8a..c1a4838 100644 --- a/docs/cfg/ubhd-ex01/acl_chains/logged_in_users.yaml +++ b/docs/cfg/ubhd-ex01/acl_chains/logged_in_users.yaml @@ -14,13 +14,6 @@ # decide: # shutdown: deny - - - if: always - aclSubChain: - - '?useracl_<$userId>' - - '?svcacl_<$serviceId>' - - - if: memberOfAclGroup: 'doi_sources' decide: @@ -31,24 +24,11 @@ decide: search_hasStamp__ubhd_doiAssign: allow - - - param: 'serviceId' - if: - paramInList: - - 'diglit' - - 'klorsch-bib' - - 'klorsch-archiv' - aclSubChain: 'diglit-like_services' - - - - param: 'serviceId' - if: - paramInList: - - 'journals' - aclSubChain: 'journal-like_services' - - - + - if: always + aclSubChain: + - '?useracl_<$userId>' + - '?svcacl_<$serviceId>' + - '<$serviceType>_services' diff --git a/docs/cfg/ubhd-ex01/acl_chains/main.yaml b/docs/cfg/ubhd-ex01/acl_chains/main.yaml index 43ce180..ee9bb83 100644 --- a/docs/cfg/ubhd-ex01/acl_chains/main.yaml +++ b/docs/cfg/ubhd-ex01/acl_chains/main.yaml @@ -24,6 +24,8 @@ - if: isLoggedIn + unless: + slotEmpty: serviceType aclSubChain: logged_in_users diff --git a/docs/cfg/ubhd-ex01/acl_user_groups/diglit_proofreaders.yaml b/docs/cfg/ubhd-ex01/acl_user_groups/doi_request_watchers.yaml similarity index 77% rename from docs/cfg/ubhd-ex01/acl_user_groups/diglit_proofreaders.yaml rename to docs/cfg/ubhd-ex01/acl_user_groups/doi_request_watchers.yaml index 581ed0e..0d9e876 100644 --- a/docs/cfg/ubhd-ex01/acl_user_groups/diglit_proofreaders.yaml +++ b/docs/cfg/ubhd-ex01/acl_user_groups/doi_request_watchers.yaml @@ -2,7 +2,7 @@ # -*- coding: UTF-8, tab-width: 4 -*- --- -^: # <-- Group name. `^` means to use the basename of the filename. +^: usernames: # You can also declare group membership in a user config file. diff --git a/docs/cfg/ubhd-ex01/custom_data/svctpl.yaml b/docs/cfg/ubhd-ex01/custom_data/svctpl.yaml new file mode 100644 index 0000000..979be28 --- /dev/null +++ b/docs/cfg/ubhd-ex01/custom_data/svctpl.yaml @@ -0,0 +1,49 @@ +%YAML 1.2 +# -*- coding: UTF-8, tab-width: 4 -*- +--- + +^: + # This data is used for `INHERITS` in service config example files. + + approvalFeed: + type: 'approval' + feedTitle: 'Annos waiting for approval' # optional + + linkTpl: '/static/local/redir/approve-anno.html?%as' + # Many RSS readers require an absolute URL. Our RSS formatter + # will thus replace a leading slash with its public base URL. + # For available slots, see `src/hnd/anno/rssLinkSlots.mjs`. + + + diglit-like: + targetUrlMetadata: + vSubDirs: + - 'projectName' + - 'pageNumStr' + # vSubDir = virtual subdirectory maps parts of the URL into the + # ACL meta data namespace, so you can use it in ACL conditions. + # They will also be displayed in "access denied" error messages + # to help debug the conitions that caused the error. + + staticAclMeta: + serviceType: 'diglit-like' + + + + journals-like: + targetUrlMetadata: + vSubDirs: + - 'zsKuerzel' + - null # expected to always be 'article' + - null # expected to always be 'view' + - 'submissionId' + + staticAclMeta: + serviceType: 'journals-like' + + + + + + +... diff --git a/docs/cfg/ubhd-ex01/services/0_defaults.yaml b/docs/cfg/ubhd-ex01/services/0_defaults.yaml new file mode 100644 index 0000000..4c19204 --- /dev/null +++ b/docs/cfg/ubhd-ex01/services/0_defaults.yaml @@ -0,0 +1,39 @@ +%YAML 1.2 +# -*- coding: UTF-8, tab-width: 4 -*- +--- + +'': + annoBrowserRedirect: '%sc/%bi/image,info' + # ^-- For available slots, see `src/hnd/anno/browserRedirect.mjs` + + approvalRequired: true + + autoRequestNextVersionDoi: true + # ^- If enabled, when a revision is submitted for a version that has + # a DOI, a DOI request is stamped onto the newly submitted version. + + + rssFeeds: + '': # <- Empty sub URL = Defaults for all feeds for this service. + # And since this is in the service defaults, these settings + # will set the defaults for all feeds in all services. + + keyHash: '' + # Empty key hash disables access to the feed. + # This is usually a good default because usually you want a + # different key for each feed. + # For your convenience, we include a bcrypt token generator: + # `../../../../util/create_bcrypt_rss_token.sh` + + # prefix: 'https://…' + # ^-- When omitted, assumes `1` (the number); and numbers + # denote the n-th item from targetUrlMetadata. + # Thus, omitting the prefix means to use the first + # targetUrlMetadata prefix URL. + + + + + + +... diff --git a/docs/cfg/ubhd-ex01/services/anno-frontend-tests.yaml b/docs/cfg/ubhd-ex01/services/anno-frontend-tests.yaml index ae276b8..fe02670 100644 --- a/docs/cfg/ubhd-ex01/services/anno-frontend-tests.yaml +++ b/docs/cfg/ubhd-ex01/services/anno-frontend-tests.yaml @@ -2,8 +2,7 @@ # -*- coding: UTF-8, tab-width: 4 -*- --- -^: # <-- Service name. `^` means to use the basename of the filename. - +^: targetUrlMetadata: prefixes: - 'http://anno.test/' diff --git a/docs/cfg/ubhd-ex01/services/diglit.yaml b/docs/cfg/ubhd-ex01/services/diglit.yaml index 1154f82..5119cdc 100644 --- a/docs/cfg/ubhd-ex01/services/diglit.yaml +++ b/docs/cfg/ubhd-ex01/services/diglit.yaml @@ -2,53 +2,26 @@ # -*- coding: UTF-8, tab-width: 4 -*- --- -^: # <-- Service name. `^` means to use the basename of the filename. +^: + INHERITS: 'svctpl.diglit-like' targetUrlMetadata: prefixes: - 'https://digi.ub.uni-heidelberg.de/diglit/' # Example annotation: 0b3c9340-11f7-3ec8-8721-09504062a007 - vSubDirs: - - 'projectName' - - 'pageNumStr' - # vSubDir = virtual subdirectory maps parts of the URL into the - # ACL meta data namespace, so you can use it in ACL conditions. - # They will also be displayed in "access denied" error messages - # to help debug the conitions that caused the error. - - - annoBrowserRedirect: '%sc/%bi/image,info' - # ^-- For available slots, see `src/hnd/anno/browserRedirect.mjs` - - approvalRequired: yes - - autoRequestNextVersionDoi: yes - # ^- If enabled, when a revision is submitted for a version that has - # a DOI, a DOI request is stamped onto the newly submitted version. - - rssFeeds: team23: # <- The sub URL (inside /rssb) of this feed + INHERITS: 'svctpl.approvalFeed' keyHash: '$2y$05$pumfI6EZRlq/Od5zPfjefOPYIwDDswZ0IzT409Ww6ekF7GrD8iTPm' # Example plaintext token is: `xmUndc5rSLjp9a81FBbmWesgVwZobm1O` # => URL will be /rssb/team23?key=xmUn… - # For your convenience, we include a bcrypt token generator: - # `../../../../util/create_bcrypt_rss_token.sh` - type: 'approval' - # prefix: 'https://…' - # ^-- When omitted, assumes `1` (the number); and numbers denote - # the n-th item from targetUrlMetadata. Thus, omitting the - # prefix means to use the first targetUrlMetadata prefix URL. - feedTitle: 'DigLit annos waiting for approval' # optional - linkTpl: '/static/local/redir/approve-anno.html?%as' - # Many RSS readers require an absolute URL. Our RSS formatter - # will thus replace a leading slash with its public base URL. + diff --git a/docs/cfg/ubhd-ex01/services/hadw-bw-digi.yaml b/docs/cfg/ubhd-ex01/services/hadw-bw-digi.yaml new file mode 100644 index 0000000..942ddb4 --- /dev/null +++ b/docs/cfg/ubhd-ex01/services/hadw-bw-digi.yaml @@ -0,0 +1,13 @@ +%YAML 1.2 +# -*- coding: UTF-8, tab-width: 4 -*- +--- + +^: + INHERITS: 'svctpl.diglit-like' + + targetUrlMetadata: + prefixes: + - 'https://digi.hadw-bw.de/view/' + + +... diff --git a/docs/cfg/ubhd-ex01/services/journals.yaml b/docs/cfg/ubhd-ex01/services/journals.yaml index 398c096..a830cea 100644 --- a/docs/cfg/ubhd-ex01/services/journals.yaml +++ b/docs/cfg/ubhd-ex01/services/journals.yaml @@ -2,19 +2,14 @@ # -*- coding: UTF-8, tab-width: 4 -*- --- -^: # <-- Service name. `^` means to use the basename of the filename. +^: + INHERITS: 'svctpl.diglit-like' targetUrlMetadata: prefixes: - - 'http://journals.ub.uni-heidelberg.de/index.php/' - 'https://journals.ub.uni-heidelberg.de/index.php/' # … arch-inf/article/view/81388 # Example annotation: btwujJsWTBWL-IYNk-1raQ - vSubDirs: - - 'zsKuerzel' - - null # expected to always be 'article' - - null # expected to always be 'view' - - 'submissionId' ... diff --git a/docs/cfg/ubhd-ex01/services/klorsch-archiv.yaml b/docs/cfg/ubhd-ex01/services/klorsch-archiv.yaml index 6cbc62e..dab32e1 100644 --- a/docs/cfg/ubhd-ex01/services/klorsch-archiv.yaml +++ b/docs/cfg/ubhd-ex01/services/klorsch-archiv.yaml @@ -2,15 +2,13 @@ # -*- coding: UTF-8, tab-width: 4 -*- --- -^: # <-- Service name. `^` means to use the basename of the filename. +^: + INHERITS: 'svctpl.diglit-like' targetUrlMetadata: prefixes: - 'https://archivum-laureshamense-digital.de/view/' # Example annotations: a10a4cf67a aea8699a8e ef5d92d228 fb25d8d0a6 - vSubDirs: - - 'projectName' - - 'pageNumStr' ... diff --git a/docs/cfg/ubhd-ex01/services/klorsch-bib.yaml b/docs/cfg/ubhd-ex01/services/klorsch-bib.yaml index f370339..e0cf484 100644 --- a/docs/cfg/ubhd-ex01/services/klorsch-bib.yaml +++ b/docs/cfg/ubhd-ex01/services/klorsch-bib.yaml @@ -2,15 +2,13 @@ # -*- coding: UTF-8, tab-width: 4 -*- --- -^: # <-- Service name. `^` means to use the basename of the filename. +^: + INHERITS: 'svctpl.diglit-like' targetUrlMetadata: prefixes: - 'https://bibliotheca-laureshamensis-digital.de/bav/' # Example annotation: 3d82c273-c104-3023-90dc-bb48f0d4ba87 - vSubDirs: - - 'projectName' - - 'pageNumStr' ... diff --git a/docs/cfg/ubhd-ex01/users/0_guess_author.yaml b/docs/cfg/ubhd-ex01/users/0_guess_author.yaml index 3909e49..a36a9b8 100644 --- a/docs/cfg/ubhd-ex01/users/0_guess_author.yaml +++ b/docs/cfg/ubhd-ex01/users/0_guess_author.yaml @@ -22,7 +22,7 @@ # !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! -'': # <-- Empty username = not a user but server-wide settings. +'': missing_author_fallback_identity_keys: # This option is the stopgap described above. diff --git a/docs/cfg/ubhd-ex01/users/0_mgr.yaml b/docs/cfg/ubhd-ex01/users/0_mgr.yaml index 544d4db..2187dd4 100644 --- a/docs/cfg/ubhd-ex01/users/0_mgr.yaml +++ b/docs/cfg/ubhd-ex01/users/0_mgr.yaml @@ -2,7 +2,7 @@ # -*- coding: UTF-8, tab-width: 4 -*- --- -'': # <-- Empty username = not a user but server-wide settings. +'': author_agent_uuid5_baseurl: '' diff --git a/docs/cfg/ubhd-ex01/users/arno.yaml b/docs/cfg/ubhd-ex01/users/arno.yaml index 7ca9bf0..fa0679c 100644 --- a/docs/cfg/ubhd-ex01/users/arno.yaml +++ b/docs/cfg/ubhd-ex01/users/arno.yaml @@ -62,13 +62,11 @@ - 'svc_diglit/publisher' - 'svc_journals/author' - 'svc_journals/publisher' + - 'doi_sources' # You can also declare group membership in a group config file. # Membership declarations merge cumulatively, so this is redundant: - - 'svc_diglit/proofreaders' - - 'doi_request_watchers' - - 'doi_sources' upstream_userid_aliases: