Bugzilla – Attachment 181366 Details for
Bug 38930
Add a permissions store for Vue apps
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38930: (DO NOT PUSH) Add an example to ERM
Bug-38930-DO-NOT-PUSH-Add-an-example-to-ERM.patch (text/plain), 5.62 KB, created by
Matt Blenkinsop
on 2025-04-23 11:28:12 UTC
(
hide
)
Description:
Bug 38930: (DO NOT PUSH) Add an example to ERM
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2025-04-23 11:28:12 UTC
Size:
5.62 KB
patch
obsolete
>From 1e847425f69944497863cc19e3cc652a879d683c Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Fri, 17 Jan 2025 17:05:46 +0000 >Subject: [PATCH] Bug 38930: (DO NOT PUSH) Add an example to ERM > >--- > Koha/REST/V1/ERM.pm | 8 ++++++-- > api/v1/swagger/definitions/erm_config.yaml | 3 +++ > .../prog/js/vue/components/ERM/AgreementsList.vue | 6 ++++++ > .../intranet-tmpl/prog/js/vue/components/ERM/Main.vue | 5 +++++ > koha-tmpl/intranet-tmpl/prog/js/vue/modules/erm.ts | 3 +++ > 5 files changed, 23 insertions(+), 2 deletions(-) > >diff --git a/Koha/REST/V1/ERM.pm b/Koha/REST/V1/ERM.pm >index f1c6bd966d6..3263f528427 100644 >--- a/Koha/REST/V1/ERM.pm >+++ b/Koha/REST/V1/ERM.pm >@@ -39,6 +39,11 @@ Return the configuration options needed for the ERM Vue app > > sub config { > my $c = shift->openapi->valid_input or return; >+ >+ my $patron = $c->stash('koha.user'); >+ my $userflags = C4::Auth::getuserflags( $patron->flags, $patron->id ); >+ my $permissions = Koha::Auth::Permissions->get_authz_from_flags( { flags => $userflags } ); >+ > return $c->render( > status => 200, > openapi => { >@@ -46,8 +51,7 @@ sub config { > ERMModule => C4::Context->preference('ERMModule'), > ERMProviders => [ split ',', C4::Context->preference('ERMProviders') ] > }, >- >- # TODO Add permissions >+ permissions => $permissions, > }, > ); > } >diff --git a/api/v1/swagger/definitions/erm_config.yaml b/api/v1/swagger/definitions/erm_config.yaml >index 2e980775714..c59697f7a4e 100644 >--- a/api/v1/swagger/definitions/erm_config.yaml >+++ b/api/v1/swagger/definitions/erm_config.yaml >@@ -4,4 +4,7 @@ properties: > settings: > type: object > description: List of sysprefs used for the ERM module >+ permissions: >+ type: object >+ description: List of permissions for the user > additionalProperties: false >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue >index f3a3884766a..5e78a5fd6b2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue >@@ -6,6 +6,9 @@ > :to="{ name: 'AgreementsFormAdd' }" > icon="plus" > :title="$__('New agreement')" >+ v-if=" >+ isUserPermitted('CAN_user_suggestions_suggestions_create') >+ " > /> > </Toolbar> > <fieldset v-if="agreement_count > 0" class="filters"> >@@ -72,6 +75,8 @@ export default { > const vendorStore = inject("vendorStore"); > const { vendors } = storeToRefs(vendorStore); > >+ const { isUserPermitted } = inject("permissionsStore"); >+ > const { setConfirmationDialog, setMessage } = inject("mainStore"); > > const { get_lib_from_av, map_av_dt_filter } = inject("ERMStore"); >@@ -94,6 +99,7 @@ export default { > escape_str, > agreement_table_settings, > filters, >+ isUserPermitted, > }; > }, > data: function () { >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue >index 061d4847bc8..cdb5c63d35e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue >@@ -50,6 +50,9 @@ export default { > const { config, authorisedValues } = storeToRefs(ERMStore); > const { loadAuthorisedValues } = ERMStore; > >+ const permissionsStore = inject("permissionsStore"); >+ const { userPermissions } = storeToRefs(permissionsStore); >+ > return { > vendorStore, > ERMStore, >@@ -59,6 +62,7 @@ export default { > loaded, > loadAuthorisedValues, > authorisedValues, >+ userPermissions, > }; > }, > data() { >@@ -90,6 +94,7 @@ export default { > const client = APIClient.erm; > client.config.get().then(config => { > this.config = config; >+ this.userPermissions = config.permissions; > if (this.config.settings.ERMModule != 1) { > this.loaded(); > return this.setError( >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/erm.ts b/koha-tmpl/intranet-tmpl/prog/js/vue/modules/erm.ts >index 4dcca91eddc..775f771e621 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/erm.ts >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/modules/erm.ts >@@ -24,6 +24,7 @@ import { useVendorStore } from "../stores/vendors"; > import { useERMStore } from "../stores/erm"; > import { useNavigationStore } from "../stores/navigation"; > import { useReportsStore } from "../stores/usage-reports"; >+import { usePermissionsStore } from "../stores/permissions"; > import i18n from "../i18n"; > > const pinia = createPinia(); >@@ -31,6 +32,7 @@ const pinia = createPinia(); > const mainStore = useMainStore(pinia); > const navigationStore = useNavigationStore(pinia); > const routes = navigationStore.setRoutes(routesDef); >+const permissionsStore = usePermissionsStore(pinia); > > const router = createRouter({ > history: createWebHistory(), >@@ -50,6 +52,7 @@ const rootComponent = app > app.config.unwrapInjectedRef = true; > app.provide("vendorStore", useVendorStore(pinia)); > app.provide("mainStore", mainStore); >+app.provide("permissionsStore", permissionsStore); > app.provide("navigationStore", navigationStore); > const ERMStore = useERMStore(pinia); > app.provide("ERMStore", ERMStore); >-- >2.48.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38930
:
176826
|
176827
|
176828
|
178245
|
178246
|
178247
|
181365
|
181366
|
181609
|
181622
|
181624
|
181625
|
181722
|
181723