Bug 33408: Prevent access to erm module by URL if sys pref is disabled

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0efb53b3a2)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Pedro Amorim 2023-04-05 11:45:45 +00:00 committed by Matt Blenkinsop
parent f6ca974ea7
commit 8c410fdec3
6 changed files with 16 additions and 32 deletions

View file

@ -214,15 +214,18 @@ export default {
error => {}
)
)
return Promise.all(promises)
return Promise.all(promises).then(values => {
this.loaded()
this.initialized = true
})
}
const sysprefs_client = APIClient.sysprefs
sysprefs_client.sysprefs
.get("ERMModule")
.then(value => {
this.ERMModule = value
if (!this.ERMModule) {
this.ERMModule = value.value
if (this.ERMModule == 0) {
this.loaded()
return this.setError(
this.$__(
@ -233,10 +236,6 @@ export default {
}
return fetch_config()
})
.then(() => {
this.loaded()
this.initialized = true
})
},
components: {
Breadcrumb,

View file

@ -117,14 +117,11 @@ function get_licenses_to_relate() {
}
describe("Agreement CRUD operations", () => {
before(() => {
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}');
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}');
});
beforeEach(() => {
cy.login();
cy.title().should("eq", "Koha staff interface");
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}');
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}');
});
it("List agreements", () => {

View file

@ -22,14 +22,11 @@ function get_package() {
}
describe("Dialog operations", () => {
before(() => {
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}');
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}');
});
beforeEach(() => {
cy.login();
cy.title().should("eq", "Koha staff interface");
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}');
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}');
});
it("There are no ... defined", () => {

View file

@ -33,14 +33,11 @@ function get_license() {
}
describe("License CRUD operations", () => {
before(() => {
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}');
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}');
});
beforeEach(() => {
cy.login();
cy.title().should("eq", "Koha staff interface");
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}');
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}');
});
it("List license", () => {

View file

@ -24,14 +24,11 @@ function get_package() {
}
describe("Package CRUD operations", () => {
before(() => {
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}');
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}');
});
beforeEach(() => {
cy.login();
cy.title().should("eq", "Koha staff interface");
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}');
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}');
});
it("List package", () => {

View file

@ -18,14 +18,11 @@ function get_packages_to_relate() {
}
describe("Title CRUD operations", () => {
before(() => {
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}');
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}');
});
beforeEach(() => {
cy.login();
cy.title().should("eq", "Koha staff interface");
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}');
cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}');
});
it("Import titles", () => {